[PATCH] pidns14

Container-init may be immune to unhandled fatal signals (like SIGUSR1)
even if they are from ancestor namespace. SIGKILL/SIGSTOP are the only
reliable signals to a container-init from ancestor namespace. Make sure
that container-init will not respond to signals other than
SIGKILL/SIGSTOP

Signed-off-by: M. Mohan Kumar <[email protected]>
---
 testcases/kernel/containers/pidns/pidns14.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/containers/pidns/pidns14.c 
b/testcases/kernel/containers/pidns/pidns14.c
index e95bf95..41602cd 100644
--- a/testcases/kernel/containers/pidns/pidns14.c
+++ b/testcases/kernel/containers/pidns/pidns14.c
@@ -67,9 +67,8 @@ int child_fn(void *ttype)
                tst_resm(TBROK, "pidns is not created.");
                cleanup();
        }
-       pause();
-       tst_resm(TFAIL, "Oops! Container init resumed after receiving SIGUSR1");
-       return -1;
+       sleep(10);
+       return 0;
 }
 
 /*
@@ -111,9 +110,11 @@ int main(int argc, char *argv[])
        if (waitpid(cpid, &status, 0) < 0)
                tst_resm(TWARN, "waitpid() failed.");
 
-       if ((WIFSIGNALED(status)) && (WTERMSIG(status) == SIGUSR1))
-               tst_resm(TPASS, "Container init is killed as expected, "
-                               " when the SIGUSR1 is passed from parent\n");
+       if (WIFEXITED(status))
+               tst_resm(TPASS, "Container init returned as expected\n");
+       else if ((WIFSIGNALED(status)) && (WTERMSIG(status) == SIGUSR1))
+               tst_resm(TFAIL, "Container init is killed when the SIGUSR1 "
+                               "is passed from parent\n");
         else
                tst_resm(TFAIL, "After sending signal kill -USR1, "
                                "returned unexpected error\n");
-- 
1.6.0.2


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to