Page MenuHomeFreeBSD

Add some tests for page fault signals and codes
ClosedPublic

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

Details

Summary

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
https://reviews.freebsd.org/D21566
before it can pass.

PR: 211924

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
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
tests/sys/vm/page_fault_signal.c
59

Why is this sigfillset needed ?

83

Perhaps add volatile somewhere ? Or use C11 atomic_store relaxed.

85

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

141

Don't you need to truncate shmfd before access ?

kib added inline comments.Sep 13 2019, 7:34 AM
tests/sys/vm/page_fault_signal.c
141

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.
tests/sys/vm/page_fault_signal.c
59

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.

83

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.

85

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.
tests/sys/vm/page_fault_signal.c
85

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.