This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #12847] dprintf/vdprintf can cause fork to fail (child process crash)
- From: Rich Felker <dalias at aerifal dot cx>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: frekel at zes dot com, libc-alpha at sourceware dot org
- Date: Sat, 21 Sep 2013 15:45:16 -0400
- Subject: Re: [PATCH][BZ #12847] dprintf/vdprintf can cause fork to fail (child process crash)
- Authentication-results: sourceware.org; auth=none
- References: <20130921191346 dot GA9202 at domone dot kolej dot mff dot cuni dot cz>
On Sat, Sep 21, 2013 at 09:13:46PM +0200, OndÅej BÃlka wrote:
> Hi,
>
> This bug has a simple patch from Frank Reker in bugzilla, see
> http://sourceware.org/bugzilla/show_bug.cgi?id=12847
>
> Is it ok to commit or is cause somewhere else?
> One possibility would be adding null check to _IO_lock_init.
>
> 2013-09-21 Frank Reker <frekel@zes.com>
>
> * nptl/sysdeps/unix/sysv/linux/fork.c (fresetlockfiles): Handle
> case when lock is NULL.
>
> ---
> nptl/sysdeps/unix/sysv/linux/fork.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c
> index ff08942..9704593 100644
> --- a/nptl/sysdeps/unix/sysv/linux/fork.c
> +++ b/nptl/sysdeps/unix/sysv/linux/fork.c
> @@ -45,7 +45,8 @@ fresetlockfiles (void)
> _IO_ITER i;
>
> for (i = _IO_iter_begin(); i != _IO_iter_end(); i = _IO_iter_next(i))
> - _IO_lock_init (*((_IO_lock_t *) _IO_iter_file(i)->_lock));
> + if (_IO_iter_file(i)->_lock)
> + _IO_lock_init (*((_IO_lock_t *) _IO_iter_file(i)->_lock));
> }
dprintf FILEs should not even *be* in this list. That is the
underlying bug.
Rich