coreutils
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Crash in gettext() after fork() on Mac OS X


From: Pádraig Brady
Subject: Re: [Bug-tar] Crash in gettext() after fork() on Mac OS X
Date: Sat, 23 Nov 2013 18:48:32 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 11/23/2013 06:24 PM, Eric Blake wrote:
> On 11/23/2013 11:12 AM, Pádraig Brady wrote:
>> So in summary we're restricted in what we can call
>> between fork() and exec() in the child of a multithreaded program.
> 
> Between fork() and either exec() or _exit().
> 
>> A very quick look at sort.c suggests that that is only
>> the _("dup2 failed") call we have to worry about.
>> dup2() itself is async-signal-safe according to POSIX.
>> I'd just remove the _("") in that case.
> 
> That's a malloc taken in the (successful) exec() path; but we also have
> calls to _() if exec failed which are also unsafe and need scrubbing.
> 

Right.

Also digging into error() a bit.
It's probably OK on libc as it uses alloca() and this post says it's safe:
https://sourceware.org/ml/libc-help/2009-09/msg00030.html
Though on other platforms vfprintf() is used which isn't safe.

Pádraig.



reply via email to

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