bug-bash
[Top][All Lists]
Advanced

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

Re: The memory occupied by bash has been increasing due to the fork bomb


From: Chet Ramey
Subject: Re: The memory occupied by bash has been increasing due to the fork bomb
Date: Thu, 16 Mar 2023 15:40:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 3/11/23 6:41 AM, zju wrote:

The change was made in this pr:
https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=ea31c00845c858098d232bd014bf27b5a63a668b
 
<https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=ea31c00845c858098d232bd014bf27b5a63a668b>

The logic goes like this for interactive shells (non-interactive shells
don't ignore SIGTERM):


block SIGTERM in the parent
set the SIGTERM handler to SIG_DFL in the parent
fork, so the child, which still has SIGTERM blocked, has no pending signals
in the parent, restore the SIGTERM handler to SIG_IGN
if fork fails, abandon, reset the signal mask, and jump back to top level
        - this is where other pipeline processes get sent SIGTERM       
in the child, unblock SIGTERM -- if it received a SIGTERM after fork, it
will handle it now and exit due to the disposition being SIG_DFL

You might want to run a system call tracer and look at calls to kill and
sigaction.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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