Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak found with asan run in mdcache_alloc_state() #1105

Closed
yogendra-t opened this issue Mar 25, 2024 · 4 comments
Closed

Memory leak found with asan run in mdcache_alloc_state() #1105

yogendra-t opened this issue Mar 25, 2024 · 4 comments

Comments

@yogendra-t
Copy link
Contributor

When ran asan with 5.7 ganesha, below major memory leak is reported.

Direct leak of 102144 byte(s) in 266 object(s) allocated from:
#0 0x7f91ad147dc0 in calloc (/lib64/libasan.so.5+0xefdc0)
#1 0x7f91a238426a ()
#2 0x7f91acd5c9a1 in mdcache_alloc_state /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c:888
#3 0x7f91acd12e73 in open4_ex /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/Protocols/NFS/nfs4_op_open.c:966
#4 0x7f91acd1439d in nfs4_op_open /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/Protocols/NFS/nfs4_op_open.c:1404
#5 0x7f91accfc811 in process_one_op /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/Protocols/NFS/nfs4_Compound.c:912
#6 0x7f91accfdae3 in nfs4_Compound /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/Protocols/NFS/nfs4_Compound.c:1376
#7 0x7f91acc48b62 in nfs_rpc_process_request /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/MainNFSD/nfs_worker_thread.c:1517
#8 0x7f91acc490f5 in nfs_rpc_valid_NFS /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/MainNFSD/nfs_worker_thread.c:1732
#9 0x7f91ac968740 in svc_vc_decode /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/libntirpc/src/svc_vc.c:1046
#10 0x7f91ac963c5e in svc_request /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/libntirpc/src/svc_rqst.c:1202
#11 0x7f91ac968645 in svc_vc_recv /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/libntirpc/src/svc_vc.c:1019
#12 0x7f91ac963bde in svc_rqst_xprt_task_recv /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/libntirpc/src/svc_rqst.c:1183
#13 0x7f91ac964772 in svc_rqst_epoll_loop /usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/libntirpc/src/svc_rqst.c:1564
#14 0x7f91ac96fc39 (/lib64/libntirpc.so.5.0+0x34c39)
#15 0x7f91aaef81c9 in start_thread (/lib64/libpthread.so.0+0x81c9)

Looks like state is not freed which is allocated in mdcache_alloc_state().

(/usr/src/debug/gpfs.nfs-ganesha-5.7-ibm013.00.asan.el8.x86_64/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c:888)

subcall_raw(exp,
	state = sub_export->exp_ops.alloc_state(sub_export, state_type,
						related_state)
       );
@ffilz
Copy link
Member

ffilz commented Mar 25, 2024

I think you're missing this patch:

a9a42e7 FSALs state_free function called by free_state doesnt actually free

@xiaods
Copy link

xiaods commented May 19, 2024

@yogendra-t Please confirm if it has been resolved when you have the chance. Thank you.

@ffilz
Copy link
Member

ffilz commented May 20, 2024

This fix BTW is merged upstream and in V5.8

@xiaods
Copy link

xiaods commented May 21, 2024

/close as resolved

@dang dang closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants