Summary: | [arm64] Weird pmap bug when using O_WRONLY and mmap with PROT_WRITE | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Emmanuel Vadot <manu> | ||||
Component: | arm | Assignee: | freebsd-arm (Nobody) <freebsd-arm> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | jah, mikael | ||||
Priority: | --- | ||||||
Version: | CURRENT | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
I don't know if this works, since I don't have arm64 hardware or a qemu instance to test with, but could you try this? Index: sys/arm64/arm64/trap.c =================================================================== --- sys/arm64/arm64/trap.c (revision 366629) +++ sys/arm64/arm64/trap.c (working copy) @@ -301,7 +301,7 @@ break; default: ftype = (esr & ISS_DATA_WnR) == 0 ? VM_PROT_READ : - VM_PROT_READ | VM_PROT_WRITE; + VM_PROT_WRITE; break; } (In reply to Jason A. Harmening from comment #1) Yeah andrew@ send me this exact same patch yesterday and it fixes the issue. Good to know, I'll back off and wait for Andrew to make the fix then. |
Created attachment 218664 [details] repro There is a weird pmap bug that prevent us of opening a file in O_WRONLY and mmap it with PROT_WRITE. mmap success (MAP_FAILED isn't returned) but we receive sigsegv with SEGV_ACCERR as the code. This was found in pkg (See PR 250059). Attached is a small program to reproduce the bug, it works on all other platform for what I could see. This mimic what pkg is doing and could probably be smaller but ... Just create a directory, add file.sample in this directory and put some data in it and run ./prog directory It should copy the content of the 'file.sample' to 'file' but instead segfault.