mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
tests: Handle SIGSEGV in the vm stack mprotect exec test
To exit gracefully handle SIGSEGV and mark the test as failed. MFC after: 3 days
This commit is contained in:
parent
5c0a1c15ff
commit
f8bc606aad
|
@ -12,8 +12,15 @@
|
|||
#include <vm/vm_param.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void
|
||||
sigsegv_handler(int sig __unused)
|
||||
{
|
||||
|
||||
atf_tc_fail("Invalid stack protection mode after grows");
|
||||
}
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(mprotect_exec_test);
|
||||
ATF_TC_BODY(mprotect_exec_test, tc)
|
||||
|
@ -22,6 +29,8 @@ ATF_TC_BODY(mprotect_exec_test, tc)
|
|||
char *addr, *guard;
|
||||
size_t alloc_size;
|
||||
|
||||
signal(SIGSEGV, sigsegv_handler);
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
ATF_REQUIRE(pagesize > 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue