This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH][BZ #12847] dprintf/vdprintf can cause fork to fail (child process crash)
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: frekel at zes dot com
- Cc: libc-alpha at sourceware dot org
- Date: Sat, 21 Sep 2013 21:13:46 +0200
- Subject: [PATCH][BZ #12847] dprintf/vdprintf can cause fork to fail (child process crash)
- Authentication-results: sourceware.org; auth=none
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));
}
--
1.8.3.2