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
F81690266: D21624.id62135.diff
Sat, Apr 20, 12:07 AM
F81661593: D21624.diff
Fri, Apr 19, 3:09 PM
Unknown Object (File)
Feb 27 2024, 2:54 AM
Unknown Object (File)
Feb 24 2024, 8:19 AM
Unknown Object (File)
Feb 23 2024, 11:56 AM
Unknown Object (File)
Feb 23 2024, 11:48 AM
Unknown Object (File)
Feb 23 2024, 11:43 AM
Unknown Object (File)
Feb 23 2024, 11:43 AM
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.