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: Pádraig Brady
Subject: Re: SIGTERM ignored before exec race
Date: Thu, 28 Mar 2013 10:58:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 03/26/2013 03:23 PM, Chet Ramey wrote:
> 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,...);

Ah that looks good thanks.
The two CHECK_SIGTERM; calls in that clause confused me
(I'm still not sure both calls are required).
In any case I can't see any races now :)

> 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.

right.

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

I can't.

thanks!
Pádraig.




reply via email to

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