bug-bash
[Top][All Lists]
Advanced

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

Re: SEGFAULT if bash script make "source" for itself


From: Eric Blake
Subject: Re: SEGFAULT if bash script make "source" for itself
Date: Thu, 28 Aug 2014 12:30:36 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 08/28/2014 12:02 PM, bogun.dmitriy@gmail.com wrote:
> IMHO any user action should not lead to SIGSEGV! I am not objecting against
> recursive "sourse" itself. But when I got SIGSEGV from "bash", I have no
> idea why this is happened. I have made recursive "sourse" by mistake and
> spend a lot of time looking up what exactly lead to SIGSEGV.

SIGSEGV is what happens on stack overflow, unless you integrate a stack
overflow detector like GNU libsigsegv with your sources to catch the
segv and replace it with a nice error message.

As to whether or not user code should be able to cause stack overflow,
we can't prevent it.  Reliably preventing stack overflow would be
equivalent to solving the Halting Problem, which we cannot do; so all we
can do is detect when it happens.

> 
> Put a configurable limit on the deep of recursive source. There is almost
> no variant for legal usage of recursive source on deep... 10000 for
> example. If someone need such recursion deep, he alway can raise limit or
> turn it off by setting it to 0.

The GNU Coding Standards state that GNU software cannot have arbitrary
limits by default.  Any limit we pick, other than unlimited (your
proposal of turning it to 0), would be an arbitrary limit for someone
who has a machine with more memory and a larger stack.  So 0 is the only
sane default, but that's no different than what we already have.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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