On 8/26/21 3:31 PM, Peter Maydell wrote:
Side note: for cases like this where we can tell MAPERR from
ACCERR based on info the exception handler passes to us, should
we prefer that or the "check the page flags" approach that
force_sigsegv_for_addr() takes ? I feel like the former is
nicer, because in a multithreaded program some other thread
might have changed whether the page is mapped between our taking
the fault and getting here. But maybe that's always racy...
Both ways are racy.
After having played with SIGBUS, what I believe should happen is that we clean up the
signal handling such that we can pass through the host MAPERR/ACCERR, remapping any fault
address, after filtering the write-protect case that we care about.
I'm not sure how much effort it would be to do that. Certainly the test matrix is pretty
darn large. But perhaps it would simplify the huge SIGBUS patch set, and thus make it all
worthwhile.
r~