bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGTERM ignored before exec race


From: Chet Ramey
Subject: Re: SIGTERM ignored before exec race
Date: Tue, 26 Mar 2013 11:23:18 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

On 3/25/13 6:45 PM, Pádraig Brady wrote:

> OK thanks for the pointer.
> So the race is narrowed rather than closed?
> As we have:
> 
> execute_disk_command()
> {
>   int pid = fork();
>   if (pid == 0) /* child */
>     {
>        CHECK_SIGTERM; /* Honor received SIGTERM.  */
>        do stuff;
>        CHECK_SIGTERM; /* Honor received SIGTERM.  */
> /* --->SIGTERM still ignored if received here?<--- */
>        exec(...);
>     }

Please don't omit the code immediately following the fork that restores
the signal handlers.  The execute_disk_command() code actually looks like
this:

  pid = make_child (blah...);
  if (pid == 0)
    {
      reset_terminating_signals ();     /* XXX */
      /* Cancel traps, in trap.c. */
      restore_original_signals ();

      CHECK_SIGTERM;

      ...

      exec (blah,...);

There is code in make_child that resets the sigterm status (RESET_SIGTERM),
since fork() is supposed to clear the set of pending signals anyway.

Please see if you can reproduce it with the current devel branch code.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]