[Bug nscd/16453] nscd segfaults with a large number of members in a netgroup
cvs-commit at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Thu Jan 16 04:53:00 GMT 2014
http://sourceware.org/bugzilla/show_bug.cgi?id=16453
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 5d29ccce66cc903fd9aa6e8f74c6be4dbc03d1f5 (commit)
via 980cb5180e1b71224a57ca52b995c959b7148c09 (commit)
from 2393fc0119fa291ff01b7b912dda2069257c8600 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5d29ccce66cc903fd9aa6e8f74c6be4dbc03d1f5
commit 5d29ccce66cc903fd9aa6e8f74c6be4dbc03d1f5
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jan 16 10:19:18 2014 +0530
Mention addition of multiple precision fallback libm probes in NEWS
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=980cb5180e1b71224a57ca52b995c959b7148c09
commit 980cb5180e1b71224a57ca52b995c959b7148c09
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jan 16 10:20:22 2014 +0530
Don't use alloca in addgetnetgrentX (BZ #16453)
addgetnetgrentX has a buffer which is grown as per the needs of the
requested size either by using alloca or by falling back to malloc if
the size is larger than 1K. There are two problems with the alloca
bits: firstly, it doesn't really extend the buffer since it does not
use the return value of the extend_alloca macro, which is the location
of the reallocated buffer. Due to this the buffer does not actually
extend itself and hence a subsequent write may overwrite stuff on the
stack.
The second problem is more subtle - the buffer growth on the stack is
discontinuous due to block scope local variables. Combine that with
the fact that unlike realloc, extend_alloca does not copy over old
content and you have a situation where the buffer just has garbage in
the space where it should have had data.
This could have been fixed by adding code to copy over old data
whenever we call extend_alloca, but it seems unnecessarily
complicated. This code is not exactly a performance hotspot (it's
called when there is a cache miss, so factors like network lookup or
file reads will dominate over memory allocation/reallocation), so this
premature optimization is unnecessary.
Thanks Brad Hubbard <bhubbard@redhat.com> for his help with debugging
the problem.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
NEWS | 5 ++++-
nscd/netgroupcache.c | 37 ++++++-------------------------------
3 files changed, 15 insertions(+), 32 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list