Permalink
Browse files

Remove the SIGSTOP test, it isn't reliable from one kernel version to…

… another.

I did the following sanity check: the same binary of PRoot running the
same binary of this test doesn't behave the same on several Linux
distro.  In all cases the child doesn't remain stopped, it runs
(verified with strace too):

    The kernel behavior described in the previous paragraph causes a
    problem with transparent handling of stopping signals.  If the
    tracer restarts the tracee after group-stop, the stopping signal
    is effectively ignored -- the tracee doesn't remain stopped, it
    runs.  If the tracer doesn't restart the tracee before entering
    into the next waitpid(2), future SIGCONT signals will not be
    reported to the tracer; this would cause the SIGCONT signals to
    have no effect on the tracee.

    -- ptrace.2 from man-pages 3.42

However, in some cases the child's status reported to the parent is
"stopped" [1] and in other cases this status is "exited" [2].  I'm not
even sure it is a deterministic behavior.

[1]: CentOS-6/i586, CentOS-6/x86_64, Debian_6.0/x86_64,
  Mandriva_2009.1/i586, Mandriva_2009.1/x86_64, Mandriva_2010/i586,
  Mandriva_2010/x86_64, Mandriva_2010.1/i586, Mandriva_2010.1/x86_64,
  Mandriva_2011/i586, Mandriva_2011/x86_64, RedHat_RHEL-5/x86_64,
  RedHat_RHEL-6/i586, RedHat_RHEL-6/x86_64, SLE_10_SDK/i586,
  SLE_11_SP2/i586, ScientificLinux_6/i586, ScientificLinux_6/x86_64,
  openSUSE_12.1/i586, openSUSE_12.1/x86_64, openSUSE_Factory/i586,
  openSUSE_Tumbleweed/x86_64, xUbuntu_8.04/i586, xUbuntu_9.04/i586

[2]: CentOS_CentOS-5/i586, CentOS_CentOS-5/x86_64, Debian_5.0/i586,
  Debian_5.0/x86_64, Debian_6.0/i586, Fedora_15/i586,
  Fedora_15/x86_64, Fedora_16/i586, Fedora_16/x86_64,
  RedHat_RHEL-4/i586, RedHat_RHEL-4/x86_64, RedHat_RHEL-5/i586,
  SLE_10_SDK/x86_64, SLE_11/i586, SLE_11/x86_64, SLE_11_SP1/i586,
  SLE_11_SP1/x86_64, SLE_11_SP2/x86_64, openSUSE_11.1_Evergreen/i586,
  openSUSE_11.1_Evergreen/x86_64, openSUSE_11.3/i586,
  openSUSE_11.3/x86_64, openSUSE_11.4/i586, openSUSE_11.4/x86_64,
  openSUSE_Factory/x86_64, openSUSE_Tumbleweed/i586,
  xUbuntu_10.04/i586, xUbuntu_10.04/x86_64, xUbuntu_10.10/i586,
  xUbuntu_10.10/x86_64, xUbuntu_11.04/i586, xUbuntu_11.04/x86_64,
  xUbuntu_11.10/i586, xUbuntu_11.10/x86_64, xUbuntu_8.04/x86_64,
  xUbuntu_9.04/x86_64, xUbuntu_9.10/i586, xUbuntu_9.10/x86_64

Change-Id: I0739f032ba73c349c75cb2a79f92e06e93e08b24
Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
  • Loading branch information...
1 parent 314b953 commit acbcaed1b85eed691e80e20839fe8887f49ebb5d @cedric-vincent cedric-vincent committed May 16, 2012
Showing with 11 additions and 6 deletions.
  1. +11 −6 tests/{test-77777777.c → test-77777777.c.unreliable}
@@ -5,12 +5,6 @@
#include <sys/types.h>
#include <unistd.h>
-void handler(int signo)
-{
- if (signo == SIGSTOP)
- exit(EXIT_SUCCESS);
-}
-
int main()
{
int child_status;
@@ -29,6 +23,7 @@ int main()
perror("raise(SIGSTOP)");
exit(EXIT_FAILURE);
}
+ sleep(1);
exit(EXIT_FAILURE);
default: /* parent */
@@ -37,6 +32,16 @@ int main()
perror("waitpid()");
exit(EXIT_FAILURE);
}
+
+ if (WIFEXITED(child_status))
+ printf("exited, status=%d\n", WEXITSTATUS(child_status));
+ else if (WIFSIGNALED(child_status))
+ printf("killed by signal %d\n", WTERMSIG(child_status));
+ else if (WIFSTOPPED(child_status))
+ printf("stopped by signal %d\n", WSTOPSIG(child_status));
+ else if (WIFCONTINUED(child_status))
+ printf("continued\n");
+
if (WIFSTOPPED(child_status))
exit(EXIT_SUCCESS);
else

0 comments on commit acbcaed

Please sign in to comment.