[Intel-gfx] [PATCH i-g-t] lib/tests: explicitly raise SIGSEGV

Morton, Derek J derek.j.morton at intel.com
Thu Sep 24 06:13:32 PDT 2015


This relies on signal.h being included by wait.h. Would it be better to include it explicitly?

-----Original Message-----
From: Intel-gfx [mailto:intel-gfx-bounces at lists.freedesktop.org] On Behalf Of Thomas Wood
Sent: Thursday, September 24, 2015 11:30 AM
To: intel-gfx at lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t] lib/tests: explicitly raise SIGSEGV

Dereferencing a NULL pointer is undefined behaviour and may not always result in a segmentation fault. Explicitly raise the SIGSEGV signal to test handling of this signal.

Signed-off-by: Thomas Wood <thomas.wood at intel.com>
---
 lib/tests/igt_segfault.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/tests/igt_segfault.c b/lib/tests/igt_segfault.c index b420b1a..bc7641d 100644
--- a/lib/tests/igt_segfault.c
+++ b/lib/tests/igt_segfault.c
@@ -57,11 +57,15 @@ bool runc;
 char test[] = "test";
 char *argv_run[] = { test };
 
+static void crashme(void)
+{
+	raise(SIGSEGV);
+}
+
 static int do_fork(void)
 {
 	int pid, status;
 	int argc;
-	void (*crashme)(void) = NULL;
 
 	switch (pid = fork()) {
 	case -1:
--
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list