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

dht: fix asan use-after-free bug #4248

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

mohit84
Copy link
Contributor

@mohit84 mohit84 commented Oct 23, 2023

The client is throwing below stacktrace while asan is enabled. The client is facing an issue while application is trying to call removexattr in 2x1 subvol and non-mds subvol is down. As we can see in below stacktrace dht_setxattr_mds_cbk is calling dht_setxattr_non_mds_cbk and dht_setxattr_non_mds_cbk is trying to wipe local because call_cnt is 0 but dht_setxattr_mds_cbk is trying to access frame->local that;s why it is crashed.

x621000051c34 is located 1844 bytes inside of 4164-byte region [0x621000051500,0x621000052544) freed by thread T7 here:

Solution: Use switch instead of using if statement to wind a operation, in case of switch
the code will not try to access local after wind a operation for last dht subvol.

Fixes: #3732
Change-Id: I031bc814d6df98058430ef4de7040e3370d1c677
(Cherry picke from commit 11ff6f5)
(Reviwed on upstream link #4242)

Fixes: #3732
Change-Id: I031bc814d6df98058430ef4de7040e3370d1c677

The client is throwing below stacktrace while asan is enabled. The client is facing
an issue while application is trying to call removexattr in 2x1 subvol and non-mds
subvol is down. As we can see in below stacktrace dht_setxattr_mds_cbk is calling
dht_setxattr_non_mds_cbk and dht_setxattr_non_mds_cbk is trying to wipe local because
call_cnt is 0 but dht_setxattr_mds_cbk is trying to access frame->local that;s why
it is crashed.

x621000051c34 is located 1844 bytes inside of 4164-byte region [0x621000051500,0x621000052544) freed by thread T7 here:

Solution: Use switch instead of using if statement to wind a operation, in case of switch
          the code will not try to access local after wind a operation for last dht subvol.

> Fixes: gluster#3732
> Change-Id: I031bc814d6df98058430ef4de7040e3370d1c677
> (Cherry picke from commit 11ff6f5)
> (Reviwed on upstream link gluster#4242)

Fixes: gluster#3732
Change-Id: I031bc814d6df98058430ef4de7040e3370d1c677
Signed-off-by: Mohit Agrawal <[email protected]>
@mohit84
Copy link
Contributor Author

mohit84 commented Oct 23, 2023

/run regression

@Shwetha-Acharya Shwetha-Acharya merged commit 9c58028 into gluster:release-10 Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants