Created attachment 218664 [details]
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.
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?
--- sys/arm64/arm64/trap.c (revision 366629)
+++ sys/arm64/arm64/trap.c (working copy)
@@ -301,7 +301,7 @@
ftype = (esr & ISS_DATA_WnR) == 0 ? VM_PROT_READ :
- VM_PROT_READ | VM_PROT_WRITE;
(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.
Fixed in https://svnweb.freebsd.org/base?view=revision&revision=366665