Page MenuHomeFreeBSD

Add some tests for page fault signals and codes
ClosedPublic

Authored by jilles on Sep 12 2019, 7:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 1:45 PM
Unknown Object (File)
Thu, Nov 14, 2:05 PM
Unknown Object (File)
Mon, Oct 28, 12:34 PM
Unknown Object (File)
Wed, Oct 23, 3:40 AM
Unknown Object (File)
Oct 6 2024, 9:46 PM
Unknown Object (File)
Oct 2 2024, 3:02 AM
Unknown Object (File)
Sep 29 2024, 11:47 PM
Unknown Object (File)
Sep 29 2024, 8:41 PM
Subscribers

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 - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tests/sys/vm/page_fault_signal.c
58 ↗(On Diff #62004)

Why is this sigfillset needed ?

82 ↗(On Diff #62004)

Perhaps add volatile somewhere ? Or use C11 atomic_store relaxed.

84 ↗(On Diff #62004)

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

140 ↗(On Diff #62004)

Don't you need to truncate shmfd before access ?

tests/sys/vm/page_fault_signal.c
140 ↗(On Diff #62004)

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.

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

jilles added inline comments.
tests/sys/vm/page_fault_signal.c
58 ↗(On Diff #62004)

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.

82 ↗(On Diff #62004)

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.

84 ↗(On Diff #62004)

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

jilles marked an inline comment as done.

Add more volatile

kib added inline comments.
tests/sys/vm/page_fault_signal.c
84 ↗(On Diff #62004)

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.