[Bugs] [Bug 1464327] glusterfs client crashes when reading large directory
bugzilla at redhat.com
bugzilla at redhat.com
Thu Jul 6 10:39:20 UTC 2017
https://bugzilla.redhat.com/show_bug.cgi?id=1464327
--- Comment #7 from Worker Ant <bugzilla-bot at gluster.org> ---
COMMIT: https://review.gluster.org/17706 committed in master by Jeff Darcy
(jeff at pl.atyp.us)
------
commit e14ea3f5c37475e12a3b7fb7bd3165b0a4e77c51
Author: Csaba Henk <csaba at redhat.com>
Date: Wed Jul 5 17:48:37 2017 +0200
groups: don't allocate auxiliary gid list on stack
When glusterfs wants to retrieve the list of auxiliary gids
of a user, it typically allocates a sufficiently big gid_t
array on stack and calls getgrouplist(3) with it. However,
"sufficiently big" means to be of maximum supported gid list
size, which in GlusterFS is GF_MAX_AUX_GROUPS = 64k.
That means a 64k * sizeof(gid_t) = 256k allocation, which is
big enough to overflow the stack in certain cases.
A further observation is that stack allocation of the gid list
brings no gain, as in all cases the content of the gid list
eventually gets copied over to a heap allocated buffer.
So we add a convenience wrapper of getgrouplist to libglusterfs
called gf_getgrouplist which calls getgrouplist with a sufficiently
big heap allocated buffer (it takes care of the allocation too).
We are porting all the getgrouplist invocations to gf_getgrouplist
and thus eliminate the huge stack allocation.
BUG: 1464327
Change-Id: Icea76d0d74dcf2f87d26cb299acc771ca3b32d2b
Signed-off-by: Csaba Henk <csaba at redhat.com>
Reviewed-on: https://review.gluster.org/17706
Smoke: Gluster Build System <jenkins at build.gluster.org>
Reviewed-by: Niels de Vos <ndevos at redhat.com>
Reviewed-by: Amar Tumballi <amarts at redhat.com>
CentOS-regression: Gluster Build System <jenkins at build.gluster.org>
--
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=glgF6GE36z&a=cc_unsubscribe
More information about the Bugs
mailing list