Page MenuHomeFreeBSD

Add some tests for page fault signals and codes

Authored by jilles on Sep 12 2019, 7:53 PM.



It is useful to have some tests for page fault signals.

More tests would be useful but creating the conditions (such as various kinds
of running out of memory and I/O errors) is more complicated.

The test page_fault_signal__bus_objerr_1 depends on
before it can pass.

PR: 211924

Diff Detail

rS FreeBSD src repository
Lint OK
No Unit Test Coverage
Build Status
Buildable 26511
Build 24912: arc lint + arc unit

Event Timeline

jilles created this revision.Sep 12 2019, 7:53 PM
kib added inline comments.Sep 13 2019, 7:20 AM

Why is this sigfillset needed ?


Perhaps add volatile somewhere ? Or use C11 atomic_store relaxed.


I wonder if we want to be more formal there, and add a fence before accesses to last_sig and last_code.


Don't you need to truncate shmfd before access ?

kib added inline comments.Sep 13 2019, 7:34 AM

I see, you did not extended shmfd at all. I think it would be more interesting to ensure that at least one page is allowed.

jilles updated this revision to Diff 62135.Sep 15 2019, 9:51 PM

Add another testcase for access past end of non-empty object

jilles marked 3 inline comments as done.Sep 16 2019, 9:54 PM
jilles added inline comments.

To prevent the signal handler being entered again between siglongjmp and sigsetjmp.

This is not a very strong reason, but I need to initialize sa.sa_mask in any case.


Not sure if that's needed, given that mmap() and munmap() are not magical the way malloc() and free() are, but I'm adding it anyway.


last_sig and last_code are volatile, which should suffice for communication with a signal handler in the same thread.

jilles updated this revision to Diff 62186.Sep 16 2019, 9:56 PM
jilles marked an inline comment as done.

Add more volatile

kib accepted this revision.Sep 17 2019, 7:43 AM
kib added inline comments.

volatile semantic for gcc and clang only guarantee that the access occurs, it does not provide any guarantee when.

This revision is now accepted and ready to land.Sep 17 2019, 7:43 AM
This revision was automatically updated to reflect the committed changes.