Re: readdir() harmful in threaded code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Juste to make sure there is no misunderstanding here: unfortunately I 
do not have time right now to submit a fix. It would be nice if someone
else coule look at it.

On Wed, Feb 10, 2016 at 01:48:52PM +0000, Emmanuel Dreyfus wrote:
> Hi
> 
> After obtaining a core in a regression, I noticed there are a few readdir()
> use in threaded code. This is begging for a crash, as readdir() maintains
> an internal state that will be trashed on concurent use. readdir_r()
> should be used instead.
> 
> A quick search shows readdir(à usage here:
> contrib/fuse-util/mount_util.c:30
> extras/test/ld-preload-test/ld-preload-test.c:310
> extras/test/test-ffop.c:550
> libglusterfs/src/compat.c:256
> libglusterfs/src/compat.c:315
> libglusterfs/src/syscall.c:97
> tests/basic/fops-sanity.c:662
> tests/utils/arequal-checksum.c:331
> 
> Occurences in contrib, extra and tests are probably harmless are there
> are usage in standalone programs that are not threaded. We are left with
> three groups of problems:
> 
> 1) libglusterfs/src/compat.c:256 and libglusterfs/src/compat.c:315
> This is Solaris compatibility code. Is it used at all?
> 
> 2)  libglusterfs/src/syscall.c:97 This is the sys_readdir() wrapper, 
> which is in turn used in:
> libglusterfs/src/run.c:284
> xlators/features/bit-rot/src/stub/bit-rot-stub-helpers.c:582
> xlators/features/changelog/lib/src/gf-history-changelog.c:854
> xlators/features/index/src/index.c:471
> xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
> xlators/storage/posix/src/posix.c:3700
> xlators/storage/posix/src/posix.c:5896
> 
> 3) We also find sys_readdir() in libglusterfs/src/common-utils.h for
> GF_FOR_EACH_ENTRY_IN_DIR() which in turn appears in:
> libglusterfs/src/common-utils.c:3979
> libglusterfs/src/common-utils.c:4002
> xlators/mgmt/glusterd/src/glusterd-hooks.c:365
> xlators/mgmt/glusterd/src/glusterd-hooks.c:379
> xlators/mgmt/glusterd/src/glusterd-store.c:651
> xlators/mgmt/glusterd/src/glusterd-store.c:661
> xlators/mgmt/glusterd/src/glusterd-store.c:1781
> xlators/mgmt/glusterd/src/glusterd-store.c:1806
> xlators/mgmt/glusterd/src/glusterd-store.c:3044
> xlators/mgmt/glusterd/src/glusterd-store.c:3072
> xlators/mgmt/glusterd/src/glusterd-store.c:3593
> xlators/mgmt/glusterd/src/glusterd-store.c:3606
> xlators/mgmt/glusterd/src/glusterd-store.c:4032
> xlators/mgmt/glusterd/src/glusterd-store.c:4111
> 
> There a hive of sprious bugs to squash here.
> 
> -- 
> Emmanuel Dreyfus
> manu@xxxxxxxxxx
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel@xxxxxxxxxxx
> http://www.gluster.org/mailman/listinfo/gluster-devel

-- 
Emmanuel Dreyfus
manu@xxxxxxxxxx
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://www.gluster.org/mailman/listinfo/gluster-devel




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux