Skip to contentSkip to conversation

syscalls: modify_ldt02: Fix failure

PATCH New Cyril Hrubis 2 participants 2 messages May 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls: modify_ldt02: Fix failure

The test was wrong to begin with, if we want to get SEGFAULT from the waitpid() we cannot setup a handler that catches it and exits with 0.

Fixes f5e8e6b11ce8 ("syscalls/modify_ldt: Replace TINFO with TPASS or TFAIL")
---
 .../kernel/syscalls/modify_ldt/modify_ldt02.c     | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
testcases/kernel/syscalls/modify_ldt/modify_ldt02.c +1 -14
index e34d3d54d..f911aa5fd 100644
@@ -120,6 +120,7 @@ int main(int ac, char **av)
 
 		tst_old_flush();
 		if ((pid = FORK_OR_VFORK()) == 0) {
+			signal(SIGSEGV, SIG_DFL);
 			val = read_segment(0);
 			exit(1);
 		}
@@ -168,24 +169,10 @@ int read_segment(unsigned int index)
 	return res;
 }
 
-void sigsegv_handler(int sig)
-{
-	tst_resm(TINFO, "received signal: %d", sig);
-	exit(0);
-}
-
 void setup(void)
 {
-	struct sigaction act;
-
-	memset(&act, 0, sizeof(act));
-	sigemptyset(&act.sa_mask);
-
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
-	act.sa_handler = sigsegv_handler;
-	(void)sigaction(SIGSEGV, &act, NULL);
-
 	TEST_PAUSE;
 }
 
Signature · 1 line
2.26.3
#1 lore raw

PATCH 1/1 syscalls: modify_ldt02: Fix failure

Hi Cyril,

Quoted 4 lines

The test was wrong to begin with, if we want to get SEGFAULT from the waitpid() we cannot setup a handler that catches it and exits with 0.

Fixes f5e8e6b11ce8 ("syscalls/modify_ldt: Replace TINFO with TPASS or TFAIL")

Thanks a lot!

Kind regards,
Petr