diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-06-05 12:51:28 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-06-11 03:29:32 +0000 |
commit | fda036e79e9e49f15e238295a883807416d26feb (patch) | |
tree | dc77af51e94f72da03e5a62e746d7363207b22a3 /contrib/userspace-rcu | |
parent | 9af05a85a03a89c1e070483067f66df1a6fe42c4 (diff) |
libglusterfs: fix use-after-destroy mutex error
Found with GCC ThreadSanitizer:
WARNING: ThreadSanitizer: use of an invalid mutex (e.g. uninitialized or destroyed) (pid=188590)
#0 pthread_mutex_lock <null> (libtsan.so.0+0x528ac)
#1 client_ctx_del /path/to/glusterfs/libglusterfs/src/client_t.c:535 (libglusterfs.so.0+0xc681a)
#2 client_destroy_cbk /path/to/glusterfs/xlators/protocol/server/src/server.c:944 (server.so+0xaf6e)
#3 gf_client_destroy_recursive /path/to/glusterfs/libglusterfs/src/client_t.c:295 (libglusterfs.so.0+0xc5058)
#4 client_destroy /path/to/glusterfs/libglusterfs/src/client_t.c:330 (libglusterfs.so.0+0xc60e4)
...
Location is heap block of size 272 at 0x7b440001a180 allocated by thread T7:
#0 calloc <null> (libtsan.so.0+0x3075a)
#1 __gf_calloc /path/to/glusterfs/libglusterfs/src/mem-pool.c:151 (libglusterfs.so.0+0x6e42b)
#2 gf_client_get /path/to/glusterfs/libglusterfs/src/client_t.c:155 (libglusterfs.so.0+0xc571a)
...
The problem is that client_destroy() may call client_ctx_del() (which attempts to lock
'sratch_ctx.lock') via recursive deletion from gf_client_destroy_recursive(), so
destroying mutex before entering recursive deletion is an error. It should be destroyed
later - just before the client context is freed.
Change-Id: I730a628714d2b404e3f019ae552403da16b51b68
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Fixes: #1285
Diffstat (limited to 'contrib/userspace-rcu')
0 files changed, 0 insertions, 0 deletions