Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Aug 2023 18:03:04 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f8bc606aad35 - main - tests: Handle SIGSEGV in the vm stack mprotect exec test
Message-ID:  <202308241803.37OI34l4059339@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=f8bc606aad35daf9853e3198f14d4a7baba36fcb

commit f8bc606aad35daf9853e3198f14d4a7baba36fcb
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-08-24 18:02:52 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-08-24 18:02:52 +0000

    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
---
 tests/sys/vm/stack/stack_mprotect_exec_test.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/sys/vm/stack/stack_mprotect_exec_test.c b/tests/sys/vm/stack/stack_mprotect_exec_test.c
index d12d99ea39ee..ba5a1d5cb859 100644
--- a/tests/sys/vm/stack/stack_mprotect_exec_test.c
+++ b/tests/sys/vm/stack/stack_mprotect_exec_test.c
@@ -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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308241803.37OI34l4059339>