-
Notifications
You must be signed in to change notification settings - Fork 502
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
V5.6: heap-use-after-free: freed during RELEASE_LOCKOWNER, used in subsequent PUTFH (on MacOS), in NFSv4 #1119
Comments
Here is a snippet from the server logs. |
I think this will fix the issue: https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1193187?usp=search |
Patch updated. All handling of the gsh_refstr has been clarified. Documentation (comments and function documentation) has now been provided. I also cleaned up so code is used more in common and more clearly. |
I tested patchset 2 locally and it does fix my issue. I need to deliver a fix to my users quickly. Even if you submit this fix to V6-dev* today, I am still using V5.6. If you submitted the fix to V5.*, we would still have to carefully import it into our build. With that in mind, I am thinking maybe I submit a local fix on my side while I give our developers more time to review your more extensive fix. So I have this question for you: does this fix look acceptable to you:
|
As a downstream only fix, that should fix the immediate issue. I do encourage changing to the more complete fix ASAP and perhaps only release this temporary fix in a fork, but all of that is up to you how to handle. |
Changing to verified based on comment above. |
Also, please feel free to add a Verified +1 to the Gerrithub review, and code review +1 if you are comfortable doing so. |
I am getting an easily reproducible heap-use-after-free with my custom FSAL on MacOS.
Client and server are both on MacOS, the client is the MacOS kernel
I am running with ganesha V5.6
My server only supports NFSv4
My fsal is configured with
lock_support=false
andlock_support_async_block=false
My fsal does not implement
lock_op2
Please notice MacOS kernel sends compound request: PUTFH, RELEASE_LOCKOWNER (I'm not sure if it is really necessary to send PUTFH, but that's what darwin does)
It strongly feels like refcounts gone wrong
I think what's used-after-free is either op_ctx->ctx_fullpath or op_ctx->ctx_pseudopath (or maybe fullpath / pseudopath?).
I suspect the issue is somewhere in release_lock_owner:
https://github.com/nfs-ganesha/nfs-ganesha/blob/V5.6/src/SAL/nfs4_state.c#L708-L745
The text was updated successfully, but these errors were encountered: