glusterfs
glusterfs copied to clipboard
core: glusterfs encounter a SIGSEGV in __gf_free
glusterfs encounter a SIGSEGV in __gf_free called from glusterfs_volfile_fetch_on
The glusterfs(fuse client) is showing a below stacktrace
Program terminated with signal 11, Segmentation fault.
#0 __gf_free (free_ptr=free_ptr@entry=0x556c7d749040) at mem-pool.c:326
326 if (!num_allocs) {
(gdb) bt
#0 __gf_free (free_ptr=free_ptr@entry=0x556c7d749040) at mem-pool.c:326
#1 0x0000556c64722f9c in STACK_DESTROY (stack=0x556c7d749040)
at ../../libglusterfs/src/glusterfs/stack.h:199
#2 glusterfs_volfile_fetch_one (ctx=ctx@entry=0x556c6692e000, volfile_id=
After analyse a stacktrace we found the crash is due to double free in glusterfs_vofile_fetch_one. The function is calling mgmt_submit_request that is calling rpc_clnt_submit function. The rpc_clnt_submit function is calling cbkfn in case of error that eventually destroying the stacktrace and return an error to the parent. The parent function glusterfs_volfile_fetch_one is also calling STACK_DESTROY so the process is getting crash.
Solution: Avoid frame cleanup in case of error return by mgmt_submit_request.