-
Notifications
You must be signed in to change notification settings - Fork 12
sunrpc: handle SVC_GARBAGE during svc auth processing as auth error #402
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
Conversation
jira VULN-71606 cve CVE-2025-38089 commit-author Jeff Layton <[email protected]> commit 94d10a4 upstream-diff The following commits cause merge conflicts since they are not present in the ciqlts9_2 branch: 6d037b1 ("SUNRPC: Remove the rpc_stat variable in svc_process_common()") ab42f4d ("sunrpc: don't change ->sv_stats if it doesn't exist") 649a692 ("SUNRPC: Convert RPC Reply header encoding to use xdr_stream") tianshuo han reported a remotely-triggerable crash if the client sends a kernel RPC server a specially crafted packet. If decoding the RPC reply fails in such a way that SVC_GARBAGE is returned without setting the rq_accept_statp pointer, then that pointer can be dereferenced and a value stored there. If it's the first time the thread has processed an RPC, then that pointer will be set to NULL and the kernel will crash. In other cases, it could create a memory scribble. The server sunrpc code treats a SVC_GARBAGE return from svc_authenticate or pg_authenticate as if it should send a GARBAGE_ARGS reply. RFC 5531 says that if authentication fails that the RPC should be rejected instead with a status of AUTH_ERR. Handle a SVC_GARBAGE return as an AUTH_ERROR, with a reason of AUTH_BADCRED instead of returning GARBAGE_ARGS in that case. This sidesteps the whole problem of touching the rpc_accept_statp pointer in this situation and avoids the crash. Cc: [email protected] Fixes: 29cd292 ("SUNRPC: Fix encoding of accepted but unsuccessful RPC replies") Reported-by: tianshuo han <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]> (cherry picked from commit 94d10a4) Signed-off-by: Shreeya Patel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, I'm not sure we'd be able to ingest the changes to err_bad_auth
so its more consistent with 9.4.
It seem like all the use of rpc_stat
that is pulled out of the err_garbage
fall through is take care of else where but seems like its just in general a little dangerous.
It might be worth taking this as a pre-conditional (cve-pre
) so that we don't have rely on a local variable.
6d037b1
I was also a little concerned about the difference in calls from err_bad_auth
but to doeal with that we'd need at least these:
0ae060c
8dd41d7
These aren't blockers, but maybe something to consider
@PlaidCat I had similar thoughts about making it consistent with 9.4, but I think for now it’s safer to integrate only this patch (the rpc_stat variable removal). This change is self-contained and has a lower risk of breaking anything. I also tried applying the following two patches as part of a pre-cve. But they don’t apply cleanly due to additional missing dependencies, and integrating them now might be risky since they introduce changes that we may not be able to test thoroughly. I will update the PR to include a pre-cve patch for rpc_stat variable removal and test it. Thanks for the review. |
So I tried to add this patch 6d037b1 but kselftest is failing.
Attaching the patch that I added and kselftest logs. I will try to investigate it. |
I see, this is kinda what I thought might happen. None of the upstream shas for the ones you looked at are directly linked to a CVE so I think the investigation you did is sufficient. Thanks for looking into it and seeing what things break or needed additional dependencies ... I don't want to go down the path of syncing this subsystem if it its a series of inter-dependent CVEs Go ahead and merge when you're ready |
Commit message
Kernel build logs
kernel-build.log
Kselftests
kselftest-before.log
kselftest-after.log