summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2011-07-15 01:13:10 +0000
committerAnand Avati <avati@gluster.com>2011-07-16 12:47:22 -0700
commit6e0af764e68e429a70693a81c4a7c7343dcf0839 (patch)
treeb27fbf3fe4960f82b3ee83343021def573fc3b82 /cli/src/cli-rpc-ops.c
parent0c9648c1a02d91c8ea2f1315f1db23cd7531d715 (diff)
posix: perform readdir filling in locked region
When two application threads share an open dir fd (DIR *) and issue readdirs, storage/posix will receive separate readdir fops in separate threads in parallel. This has two-fold issues 1. In the following pair of operations - entry = readdir(dir) and strcpy (gf_dirent->name, entry->d_name) @entry is a static buffer in libc which can get reused by another thread to get filled with a longer name. This can cause the second operation to overflow the buffer as the allocation was for the smaller name. 2. In the following pair of operations - seekdir (dir, offset) and entry = readdir(dir) If two threads are executing these sequence in parallel in separate threads, then one of them will end up reading wrong/unexpected entries. It would be sufficient to fix 1. by using readdir_r but that still keeps the second race open. Hence the patch moves all the set of operations to a locked region which solves both races. Change-Id: I36e596a96e254d3a82ff5f3669fa67ec72ef0833 Signed-off-by: Anand Avati <avati@gluster.com> BUG: 3171 (Crash in server) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3171
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
0 files changed, 0 insertions, 0 deletions