This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #12847] dprintf/vdprintf can cause fork to fail (child process crash)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]