Hi

Please find a patch to fix the sigsegv error on pidns13.c on containers.

Result:
# ./pidns13
pidns13     0  INFO  :  cinit1: setup handler for async I/O on pipe
pidns13     0  INFO  :  cinit2: writing some data in pipe
pidns13     1  PASS  :  cinit1: si_fd is 3, si_code is 1
pidns13     0  WARN  :  cinit(pid 1): control should have not reached here!


Regards
Veerendra C


Signed-off-by: Veerendra C <[email protected]>
Index: pidns/pidns13.c
===================================================================
--- pidns.orig/pidns13.c
+++ pidns/pidns13.c
@@ -196,7 +196,7 @@ int child_fn(void *arg)
 int main(int argc, char *argv[])
 {
 	int status, stack_size=getpagesize() * 4;
-	int *cinit_no;
+	int *cinit_no = malloc(sizeof(int));
 	void *stack1 = malloc(stack_size);
 	void *stack2 = malloc(stack_size);
 	void *childstack1, *childstack2;
@@ -209,8 +209,8 @@ int main(int argc, char *argv[])
 	}
 
 	/* container creation on PID namespace */
-	if (!stack1 || !stack2) {
-		tst_resm(TBROK, "parent: stack creation failed.");
+	if (!stack1 || !stack2 || !cinit_no) {
+		tst_resm(TBROK, "memory allocation failed.");
 		cleanup();
 	}
 
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to