SUNRPC: Check if we need to recalculate slack estimates
Subsystems (3)
PATCH 1/1 SUNRPC: Check if we need to recalculate slack estimates
If the incoming GSS verifier is larger than what we previously recorded on the gss_auth, that would indicate the GSS cred/context used for that RPC is using a different enctype than the one used by the machine cred/context, and we should recalculate the slack variables accordingly.
--- net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/sunrpc/auth_gss/auth_gss.c +8 -0
@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)if (maj_stat) goto bad_mic; +/* +* Normally we only recalculate the slack variables once after +* creating a new gss_auth, but we should also do it if the incoming +* verifier has a larger size than what was previously recorded. +*/ +if (cred->cr_auth->au_verfsize < (XDR_QUADLEN (len) +2 )) +__set_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags); +/* We leave it to unwrap to calculate au_rslack. For now we just * calculate the length of the verifier: */ if (test_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags))
Signature · 1 line
2.51.0
Quoted 16 lines · Scott Mayhew
If the incoming GSS verifier is larger than what we previously recorded on the
gss_auth, that would indicate the GSS cred/context used for that RPC is using a different enctype than the one used by the machine cred/context, and we should recalculate the slack variables accordingly.Signed-off-by Scott Mayhew <[email protected]>--- net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/sunrpc/auth_gss/auth_gss.c +0
-0
net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1727
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)if (maj_stat) goto bad_mic; +/* +* Normally we only recalculate the slack variables once after +* creating a new gss_auth, but we should also do it if the incoming +* verifier has a larger size than what was previously recorded.
No quibble with the code change, but IMO the comment should work a little harder to explain why the increase is needed. Something like:
* When the incoming verifier is larger than expected, the
* GSS context is using a different enctype than the one used
* initially by the machine credential. Force a slack size update
* to maintain good payload alignment.
I'm summarizing based on your commit message above...
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0+*/ +if (cred->cr_auth->au_verfsize < (XDR_QUADLEN (len) +2 )) +__set_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags); +/* We leave it to unwrap to calculate au_rslack. For now we just * calculate the length of the verifier: */ if (test_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags))
Signature · 1 line
Chuck Lever
Hi Chuck, Scott,
Quoted 36 lines · Chuck Lever
Quoted 16 lines · Scott Mayhew
If the incoming GSS verifier is larger than what we previously recorded on the
gss_auth, that would indicate the GSS cred/context used for that RPC is using a different enctype than the one used by the machine cred/context, and we should recalculate the slack variables accordingly.Signed-off-by Scott Mayhew <[email protected]>--- net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/sunrpc/auth_gss/auth_gss.c +0
-0net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1727
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)if (maj_stat) goto bad_mic; +/* +* Normally we only recalculate the slack variables once after +* creating a new gss_auth, but we should also do it if the incoming +* verifier has a larger size than what was previously recorded. No quibble with the code change, but IMO the comment should work a little harder to explain why the increase is needed. Something like:
* When the incoming verifier is larger than expected, the
* GSS context is using a different enctype than the one used
* initially by the machine credential. Force a slack size update
* to maintain good payload alignment.I'm summarizing based on your commit message above...
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1734
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0+*/ +if (cred->cr_auth->au_verfsize < (XDR_QUADLEN (len) +2 )) +__set_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags); +/* We leave it to unwrap to calculate au_rslack. For now we just * calculate the length of the verifier: */ if (test_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags))
I was looking in Debian for the state of this and noticed this was later on never applied/submitted to mainline, is this correct? Did it felt through the cracks or is it considered not to be a problem to further tackle?
Thanks a lot for your work and your help!
Regards,
Salvatore
Quoted 39 lines · Salvatore Bonaccorso
Hi Chuck, Scott,
Quoted 36 lines · Chuck Lever
Quoted 16 lines · Scott Mayhew
If the incoming GSS verifier is larger than what we previously recorded on the
gss_auth, that would indicate the GSS cred/context used for that RPC is using a different enctype than the one used by the machine cred/context, and we should recalculate the slack variables accordingly.Signed-off-by Scott Mayhew <[email protected]>--- net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/sunrpc/auth_gss/auth_gss.c +0
-0net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1727
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)if (maj_stat) goto bad_mic; +/* +* Normally we only recalculate the slack variables once after +* creating a new gss_auth, but we should also do it if the incoming +* verifier has a larger size than what was previously recorded. No quibble with the code change, but IMO the comment should work a little harder to explain why the increase is needed. Something like:
* When the incoming verifier is larger than expected, the
* GSS context is using a different enctype than the one used
* initially by the machine credential. Force a slack size update
* to maintain good payload alignment.I'm summarizing based on your commit message above...
Quoted 12 lines
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1734
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0+*/ +if (cred->cr_auth->au_verfsize < (XDR_QUADLEN (len) +2 )) +__set_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags); +/* We leave it to unwrap to calculate au_rslack. For now we just * calculate the length of the verifier: */ if (test_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags))I was looking in Debian for the state of this and noticed this was later on never applied/submitted to mainline, is this correct? Did it felt through the cracks or is it considered not to be a problem to further tackle?
Hello Salvatore -
After further consideration, we concluded the above change is not an adequate repair for this issue. The winter holidays have prevented further progress, but I expect Scott will continue looking into a better fix starting next week.
Signature · 1 line
Chuck Lever
Quoted 52 lines · Salvatore Bonaccorso
Hi Chuck, Scott,
Quoted 36 lines · Chuck Lever
Quoted 16 lines · Scott Mayhew
If the incoming GSS verifier is larger than what we previously recorded on the
gss_auth, that would indicate the GSS cred/context used for that RPC is using a different enctype than the one used by the machine cred/context, and we should recalculate the slack variables accordingly.Signed-off-by Scott Mayhew <[email protected]>--- net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/sunrpc/auth_gss/auth_gss.c +0
-0net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1727
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)if (maj_stat) goto bad_mic; +/* +* Normally we only recalculate the slack variables once after +* creating a new gss_auth, but we should also do it if the incoming +* verifier has a larger size than what was previously recorded. No quibble with the code change, but IMO the comment should work a little harder to explain why the increase is needed. Something like:
* When the incoming verifier is larger than expected, the
* GSS context is using a different enctype than the one used
* initially by the machine credential. Force a slack size update
* to maintain good payload alignment.I'm summarizing based on your commit message above...
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1734
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0+*/ +if (cred->cr_auth->au_verfsize < (XDR_QUADLEN (len) +2 )) +__set_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags); +/* We leave it to unwrap to calculate au_rslack. For now we just * calculate the length of the verifier: */ if (test_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags))I was looking in Debian for the state of this and noticed this was later on never applied/submitted to mainline, is this correct? Did it felt through the cracks or is it considered not to be a problem to further tackle?
Quoted 1 line
Thanks a lot for your work and your help!
Sorry for the delay. After having had a chance to take a deeper look, I think it would be better to try to address this from the rpc.gssd side instead of trying to make the kernel cope with having to bounce around between different encryption types.
Unfortunately I fat-fingered your email address when I sent the patches, so here's the link:
https://lore.kernel.org/linux-nfs/[email protected]/T/#t
-Scott
Quoted 4 lines
Regards,
Salvatore
Hi Scott,
Quoted 56 lines · Scott Mayhew
Quoted 52 lines · Salvatore Bonaccorso
Hi Chuck, Scott,
Quoted 36 lines · Chuck Lever
Quoted 16 lines · Scott Mayhew
If the incoming GSS verifier is larger than what we previously recorded on the
gss_auth, that would indicate the GSS cred/context used for that RPC is using a different enctype than the one used by the machine cred/context, and we should recalculate the slack variables accordingly.Signed-off-by Scott Mayhew <[email protected]>--- net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/sunrpc/auth_gss/auth_gss.c +0
-0net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1727
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)if (maj_stat) goto bad_mic; +/* +* Normally we only recalculate the slack variables once after +* creating a new gss_auth, but we should also do it if the incoming +* verifier has a larger size than what was previously recorded. No quibble with the code change, but IMO the comment should work a little harder to explain why the increase is needed. Something like:
* When the incoming verifier is larger than expected, the
* GSS context is using a different enctype than the one used
* initially by the machine credential. Force a slack size update
* to maintain good payload alignment.I'm summarizing based on your commit message above...
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c gss_validate(struct rpc_task *task, struct xdr_stream *xdr) · line 1734
Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4
-0+*/ +if (cred->cr_auth->au_verfsize < (XDR_QUADLEN (len) +2 )) +__set_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags); +/* We leave it to unwrap to calculate au_rslack. For now we just * calculate the length of the verifier: */ if (test_bit (RPCAUTH_AUTH_UPDATE_SLACK , &cred->cr_auth->au_flags))I was looking in Debian for the state of this and noticed this was later on never applied/submitted to mainline, is this correct? Did it felt through the cracks or is it considered not to be a problem to further tackle?
Quoted 1 line
Thanks a lot for your work and your help!
Quoted 8 lines
Sorry for the delay. After having had a chance to take a deeper look, I think it would be better to try to address this from the rpc.gssd side instead of trying to make the kernel cope with having to bounce around between different encryption types.
Unfortunately I fat-fingered your email address when I sent the patches, so here's the link:
https://lore.kernel.org/linux-nfs/[email protected]/T/#t
Thank you for the notice, I will watch the thread there with the new patches.
Many thanks for all your work!
Regards,
Salvatore