VIDA-NYU / reprozip

ReproZip is a tool that simplifies the process of creating reproducible experiments from command-line executions, a frequently-used common denominator in computational science.
https://www.reprozip.org/
BSD 3-Clause "New" or "Revised" License
305 stars 34 forks source link

_pytracer unconditionally resumes on signal #30

Closed remram44 closed 10 years ago

remram44 commented 10 years ago

In tracer.c, line 676:

    /* Continue on SIGTRAP */
    else if(WIFSTOPPED(status))
    {
#ifdef DEBUG
        fprintf(stderr, "Resuming %d on signal\n", pid);
#endif
        ptrace(PTRACE_SYSCALL, pid, NULL, NULL);
    }

This resumes a stopped process even if it was not suspended by a signal originating from ptrace. For example, run reprozip trace bash, run another bash in there and type suspend.

remram44 commented 10 years ago

This was initially added by 389c2a0c, but only concerned SIGTRAP signals. It was later changed by 5941b021 to resume for every signal. I do not remember which signal was an issue; probably the initial SIGSTOP since I also added PTRACE_O_TRACEFORK in that commit.

remram44 commented 10 years ago

On branch master:

outer shell$ reprozip trace bash
a$ bash
b$ suspend
b$ exit
exit
a$ exit
exit
Configuration file written in .reprozip/config.yml
Edit that file then run the packer -- use 'reprozip pack -h' for help

On branch signals:

outer shell$ reprozip trace --dont-identify-packages bash
a$ bash
b$ suspend
[1]+  Stoppé                 bash
b$ a$ exit # I didn't type that -- looks like bash A is getting a signal
exit
WARNING:root:Program exited with non-zero code 147
Configuration file written in .reprozip/config.yml
Edit that file then run the packer -- use 'reprozip pack -h' for help
outer shell$ reset # terminal is left in raw mode
remram44 commented 10 years ago

I folded the branch signals as 3a604f36 but this still doesn't look fixed.