Skip to contentSkip to conversation

Revert "SUNRPC: Fail faster on bad verifier"

PATCH In review [email protected] 3 participants 9 messages Sep 6, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 Revert "SUNRPC: Fail faster on bad verifier"

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

The premise of this commit was incorrect. There are exactly 2 cases where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force a new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out, and the client retransmitted the request using a new sequence number, as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")
---
 net/sunrpc/clnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task, struct xdr_stream *xdr)
 
 out_verifier:
 	trace_rpc_bad_verifier(task);
-	goto out_err;
+	goto out_garbage;
 
 out_msg_denied:
 	error = -EACCES;
Signature · 1 line
2.41.0
#1 lore raw
Quoted 13 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

The premise of this commit was incorrect. There are exactly 2 cases where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

That was the purpose of 0701214cd6e6.

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

Quoted 29 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force a new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out, and the client retransmitted the request using a new sequence number, as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")

---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task, struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

author maintainer
#2 lore raw
Quoted 16 lines · Chuck Lever III
Quoted 13 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

The premise of this commit was incorrect. There are exactly 2 cases where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

Quoted 7 lines

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

That was the purpose of 0701214cd6e6.

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation code. There is no discussion about whether or not it needs to be reverted.

If the TLS code needs special treatment, then a separate patch is needed to fix tls_validate() to return something that can be caught by rpc_decode_header and interpreted differently to the EIO and EACCES error codes currently being returned by RPCSEC_GSS, AUTH_SYS and others.

Quoted 42 lines
Quoted 32 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force a
  new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out, and
  the client retransmitted the request using a new sequence number, as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")

---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task,
 struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]
#3 lore raw
Quoted 23 lines · Trond Myklebust
Quoted 18 lines · Chuck Lever III
Quoted 13 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

The premise of this commit was incorrect. There are exactly 2 cases where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

Quoted 7 lines
Quoted 5 lines

That was the purpose of 0701214cd6e6.

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation code.

If that were truly the case, it's amazing that the client has hobbled along for the past 14 months with no-one noticing the breakage until now.

Seriously, though, treating a bad verifier as garbage args is not intuitive. If it's that critical there needs to be a comment in the code explaining why.

Quoted 1 line

There is no discussion about whether or not it needs to be reverted.

The patch description is wrong, though, to exclude AUTH_TLS.

The reverting patch description claims to be an exhaustive list of all the cases, but it doesn't mention the AUTH_TLS case at all.

Quoted 5 lines

If the TLS code needs special treatment, then a separate patch is needed to fix tls_validate() to return something that can be caught by rpc_decode_header and interpreted differently to the EIO and EACCES error codes currently being returned by RPCSEC_GSS, AUTH_SYS and others.

That could have been brought up when 0701214cd6e6 was first posted for review. Interesting that the decoder currently does not distinguish between EIO and EACCES.

Thanks for the suggestion, I'll have a look.

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force a
new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out, and
the client retransmitted the request using a new sequence number, as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")

---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task,
 struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 15 lines
Quoted 10 lines
Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]

--
Chuck Lever

author maintainer
#4 lore raw
Quoted 35 lines · Chuck Lever III
Quoted 26 lines

On Sep 6, 2023, at 10:33 AM, Trond Myklebust <[email protected]> wrote:

Quoted 20 lines · Chuck Lever III
Quoted 8 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

Quoted 7 lines

The premise of this commit was incorrect. There are exactly 2 cases
where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

Quoted 8 lines
Quoted 5 lines

That was the purpose of 0701214cd6e6.

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation code.

Quoted 8 lines

If that were truly the case, it's amazing that the client has hobbled along for the past 14 months with no-one noticing the breakage until now.

Seriously, though, treating a bad verifier as garbage args is not intuitive. If it's that critical there needs to be a comment in the code explaining why.

It is necessary because of the peculiarities of RPCSEC_GSS and the session semantics it implements.
See https://datatracker.ietf.org/doc/html/rfc2203#section-5.3.3.1 and in particular, the paragraph discussing retransmissions by the client.

Quoted 17 lines
Quoted 2 lines

There is no discussion about whether or not it needs to be reverted.

The patch description is wrong, though, to exclude AUTH_TLS.

The reverting patch description claims to be an exhaustive list of all the cases, but it doesn't mention the AUTH_TLS case at all.

Quoted 6 lines

If the TLS code needs special treatment, then a separate patch is needed to fix tls_validate() to return something that can be caught by
rpc_decode_header and interpreted differently to the EIO and EACCES error codes currently being returned by RPCSEC_GSS, AUTH_SYS and others.

Quoted 6 lines

That could have been brought up when 0701214cd6e6 was first posted for review. Interesting that the decoder currently does not distinguish between EIO and EACCES.

Thanks for the suggestion, I'll have a look.

Now that I look at it, I think your approach to satisfying RFC9289 is not correct.
Since this is a transport level issue, why should we not just mark the xprt for disconnection, and then retry? It is entirely possible that some load balancer/floating IP has just moved the connection to some node that was not expecting to do TLS. The only case where that should not be assumed is the case where the error happens right at the very beginning of the mount, when disconnecting should normally suffice to trigger the RPC_TASK_SOFTCONN code anyway.

Quoted 58 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force
a
  new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out,
and
  the client retransmitted the request using a new sequence number,
  as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")
Signed-off-by Trond Myklebust

<[email protected]>
---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task,
 struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 15 lines
Quoted 10 lines
Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]

--
Chuck Lever

#5 lore raw
Quoted 49 lines · Trond Myklebust
Quoted 35 lines · Chuck Lever III
Quoted 26 lines

On Sep 6, 2023, at 10:33 AM, Trond Myklebust <[email protected]> wrote:

Quoted 20 lines · Chuck Lever III
Quoted 8 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

Quoted 7 lines

The premise of this commit was incorrect. There are exactly 2 cases
where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

Quoted 8 lines
Quoted 5 lines

That was the purpose of 0701214cd6e6.

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation code.

Quoted 8 lines

If that were truly the case, it's amazing that the client has hobbled along for the past 14 months with no-one noticing the breakage until now.

Seriously, though, treating a bad verifier as garbage args is not intuitive. If it's that critical there needs to be a comment in the code explaining why.

Quoted 4 lines

It is necessary because of the peculiarities of RPCSEC_GSS and the session semantics it implements.
See https://datatracker.ietf.org/doc/html/rfc2203#section-5.3.3.1 and in particular, the paragraph discussing retransmissions by the client.

Retrying is fine.

But the counter in the client is called "garbage_retries". That's not what is going on the EACCES case, though the behavior is close enough -- it's code re-use (good) without appropriate documentation (bad).

The decoder treats EIO and EACCES exactly the same way. Again, code reuse (good) without appropriate documentation (bad).

I tried to address that in my RFC patch by adding a small explanatory comment and by adding an API contract for rpcauth_checkverf().

Quoted 21 lines
Quoted 21 lines
Quoted 2 lines

There is no discussion about whether or not it needs to be reverted.

The patch description is wrong, though, to exclude AUTH_TLS.

The reverting patch description claims to be an exhaustive list of all the cases, but it doesn't mention the AUTH_TLS case at all.

Quoted 6 lines

If the TLS code needs special treatment, then a separate patch is needed to fix tls_validate() to return something that can be caught by
rpc_decode_header and interpreted differently to the EIO and EACCES error codes currently being returned by RPCSEC_GSS, AUTH_SYS and others.

That could have been brought up when 0701214cd6e6 was first posted for review. Interesting that the decoder currently does not distinguish between EIO and EACCES.

Quoted 5 lines
Quoted 2 lines

Thanks for the suggestion, I'll have a look.

Now that I look at it, I think your approach to satisfying RFC9289 is not correct.

I'm not following what aspect of the implementation is problematic. I'm going to assume you mean the implementation of opportunism.

Quoted 4 lines

Since this is a transport level issue, why should we not just mark the xprt for disconnection, and then retry? It is entirely possible that some load balancer/floating IP has just moved the connection to some node that was not expecting to do TLS.

Depending on the security policy chosen by the client's administrator, that could either be a security problem or a "don't care" situation.

If the administrator wants the client to _require_ TLS, then connecting to a load balancer where TLS suddenly becomes unavailable after a reconnect is a hard error. This prevents STRIPTLS attacks. That's good security.

If the administrator wants to allow operation to continue even if TLS is not available, then the client can recover by not using TLS. That's rather terrible security, but can be desirable to improve backward compatibility.

Quoted 4 lines

The only case where that should
not be assumed is the case where the error happens right at the very beginning of the mount, when disconnecting should normally suffice to trigger the RPC_TASK_SOFTCONN code anyway.

If TLS goes away after a reconnect, that's a problem. Whether further operation should stop depends on the administrator's chosen security policy.

The security policies are NFS-level settings (eg, mount options). RPC just indicates to NFS whether the traffic is protected or not.

When NFS asks RPC to ensure the communication channel is protected, that means every reconnect is protected. Communication with that security policy cannot happen without protection.

Trust me, the security community will have it no other way.

If you need opportunism in this case, then I can add back the "xprtsec=auto" mount option, which you asked me to remove a while back.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 46 lines
Quoted 36 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force
a
new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out,
and
the client retransmitted the request using a new sequence
number,
as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")
Signed-off-by Trond Myklebust

<[email protected]>
---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task,
 struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]

--
Chuck Lever

--
Chuck Lever

author maintainer
#6 lore raw
Quoted 155 lines · Chuck Lever III
Quoted 54 lines

On Sep 6, 2023, at 12:18 PM, Trond Myklebust <[email protected]> wrote:

Quoted 39 lines · Chuck Lever III
Quoted 31 lines

On Sep 6, 2023, at 10:33 AM, Trond Myklebust
<[email protected]>
wrote:

Quoted 24 lines · Chuck Lever III
Quoted 9 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit
0701214cd6e66585a999b132eb72ae0489beb724.

Quoted 8 lines

The premise of this commit was incorrect. There are exactly 2
cases
where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

That was the purpose of 0701214cd6e6.

Quoted 7 lines
Quoted 3 lines

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation
code.

Quoted 8 lines

If that were truly the case, it's amazing that the client has hobbled along for the past 14 months with no-one noticing the breakage until now.

Seriously, though, treating a bad verifier as garbage args is not intuitive. If it's that critical there needs to be a comment in the code explaining why.

Quoted 6 lines

It is necessary because of the peculiarities of RPCSEC_GSS and the session semantics it implements.
See
https://datatracker.ietf.org/doc/html/rfc2203#section-5.3.3.1 and
in particular, the paragraph discussing retransmissions by the client.

Retrying is fine.

But the counter in the client is called "garbage_retries". That's not what is going on the EACCES case, though the behavior is close enough -- it's code re-use (good) without appropriate documentation (bad).

The decoder treats EIO and EACCES exactly the same way. Again, code reuse (good) without appropriate documentation (bad).

I tried to address that in my RFC patch by adding a small explanatory comment and by adding an API contract for rpcauth_checkverf().

Quoted 25 lines
Quoted 25 lines
Quoted 2 lines

There is no discussion about whether or not it needs to be reverted.

The patch description is wrong, though, to exclude AUTH_TLS.

The reverting patch description claims to be an exhaustive list of all the cases, but it doesn't mention the AUTH_TLS case at all.

Quoted 10 lines

If the TLS code needs special treatment, then a separate patch is
needed to fix tls_validate() to return something that can be caught
by
rpc_decode_header and interpreted differently to the EIO and EACCES
error codes currently being returned by RPCSEC_GSS, AUTH_SYS and
others.

That could have been brought up when 0701214cd6e6 was first posted for review. Interesting that the decoder currently does not distinguish between EIO and EACCES.

Quoted 6 lines
Quoted 2 lines

Thanks for the suggestion, I'll have a look.

Now that I look at it, I think your approach to satisfying RFC9289 is
not correct.

I'm not following what aspect of the implementation is problematic. I'm going to assume you mean the implementation of opportunism.

Quoted 7 lines

Since this is a transport level issue, why should we not just mark the
xprt for disconnection, and then retry? It is entirely possible that
some load balancer/floating IP has just moved the connection to some
node that was not expecting to do TLS.

Depending on the security policy chosen by the client's administrator,
that could either be a security problem or a "don't care" situation.

If the administrator wants the client to _require_ TLS, then connecting to a load balancer where TLS suddenly becomes unavailable after a reconnect is a hard error. This prevents STRIPTLS attacks. That's good security.

If the administrator wants to allow operation to continue even if TLS is not available, then the client can recover by not using TLS. That's
rather terrible security, but can be desirable to improve backward compatibility.

Quoted 6 lines

The only case where that should
not be assumed is the case where the error happens right at the very
beginning of the mount, when disconnecting should normally suffice to
trigger the RPC_TASK_SOFTCONN code anyway.

If TLS goes away after a reconnect, that's a problem. Whether further operation should stop depends on the administrator's chosen security policy.

The security policies are NFS-level settings (eg, mount options). RPC just indicates to NFS whether the traffic is protected or not.

When NFS asks RPC to ensure the communication channel is protected, that means every reconnect is protected. Communication with that security policy cannot happen without protection.

Quoted 5 lines

Trust me, the security community will have it no other way.

If you need opportunism in this case, then I can add back the "xprtsec=auto" mount option, which you asked me to remove a while back.

I don't see how described behaviour would cause the operation to proceed without TLS. I'm saying disconnect and then retry TLS negotiation, and then eventually fail.

Quoted 67 lines
Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
Quoted 52 lines
Quoted 42 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will
force
a
  new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed
out,
and
  the client retransmitted the request using a new sequence number,
  as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")
Signed-off-by Trond Myklebust

<[email protected]>
---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task
 *task,
 struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]

--
Chuck Lever

--
Chuck Lever

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]
#7 lore raw
Quoted 162 lines · Trond Myklebust
Quoted 157 lines · Chuck Lever III
Quoted 54 lines

On Sep 6, 2023, at 12:18 PM, Trond Myklebust <[email protected]> wrote:

Quoted 39 lines · Chuck Lever III
Quoted 31 lines

On Sep 6, 2023, at 10:33 AM, Trond Myklebust
<[email protected]>
wrote:

Quoted 24 lines · Chuck Lever III
Quoted 9 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit
0701214cd6e66585a999b132eb72ae0489beb724.

Quoted 8 lines

The premise of this commit was incorrect. There are exactly 2
cases
where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

That was the purpose of 0701214cd6e6.

Quoted 7 lines
Quoted 3 lines

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation
code.

Quoted 8 lines

If that were truly the case, it's amazing that the client has hobbled along for the past 14 months with no-one noticing the breakage until now.

Seriously, though, treating a bad verifier as garbage args is not intuitive. If it's that critical there needs to be a comment in the code explaining why.

Quoted 6 lines

It is necessary because of the peculiarities of RPCSEC_GSS and the session semantics it implements.
See
https://datatracker.ietf.org/doc/html/rfc2203#section-5.3.3.1 and in particular, the paragraph discussing retransmissions by the client.

Retrying is fine.

But the counter in the client is called "garbage_retries". That's not what is going on the EACCES case, though the behavior is close enough -- it's code re-use (good) without appropriate documentation (bad).

The decoder treats EIO and EACCES exactly the same way. Again, code reuse (good) without appropriate documentation (bad).

I tried to address that in my RFC patch by adding a small explanatory comment and by adding an API contract for rpcauth_checkverf().

Quoted 25 lines
Quoted 25 lines
Quoted 2 lines

There is no discussion about whether or not it needs to be reverted.

The patch description is wrong, though, to exclude AUTH_TLS.

The reverting patch description claims to be an exhaustive list of all the cases, but it doesn't mention the AUTH_TLS case at all.

Quoted 10 lines

If the TLS code needs special treatment, then a separate patch is
needed to fix tls_validate() to return something that can be caught
by
rpc_decode_header and interpreted differently to the EIO and EACCES
error codes currently being returned by RPCSEC_GSS, AUTH_SYS and
others.

That could have been brought up when 0701214cd6e6 was first posted for review. Interesting that the decoder currently does not distinguish between EIO and EACCES.

Quoted 6 lines
Quoted 2 lines

Thanks for the suggestion, I'll have a look.

Now that I look at it, I think your approach to satisfying RFC9289 is
not correct.

I'm not following what aspect of the implementation is problematic. I'm going to assume you mean the implementation of opportunism.

Quoted 7 lines

Since this is a transport level issue, why should we not just mark the
xprt for disconnection, and then retry? It is entirely possible that
some load balancer/floating IP has just moved the connection to some
node that was not expecting to do TLS.

Depending on the security policy chosen by the client's administrator,
that could either be a security problem or a "don't care" situation.

If the administrator wants the client to _require_ TLS, then connecting to a load balancer where TLS suddenly becomes unavailable after a reconnect is a hard error. This prevents STRIPTLS attacks. That's good security.

If the administrator wants to allow operation to continue even if TLS is not available, then the client can recover by not using TLS. That's
rather terrible security, but can be desirable to improve backward compatibility.

Quoted 6 lines

The only case where that should
not be assumed is the case where the error happens right at the very
beginning of the mount, when disconnecting should normally suffice to
trigger the RPC_TASK_SOFTCONN code anyway.

If TLS goes away after a reconnect, that's a problem. Whether further operation should stop depends on the administrator's chosen security policy.

The security policies are NFS-level settings (eg, mount options). RPC just indicates to NFS whether the traffic is protected or not.

When NFS asks RPC to ensure the communication channel is protected, that means every reconnect is protected. Communication with that security policy cannot happen without protection.

Trust me, the security community will have it no other way.

Quoted 7 lines
Quoted 3 lines

If you need opportunism in this case, then I can add back the "xprtsec=auto" mount option, which you asked me to remove a while back.

I don't see how described behaviour would cause the operation to proceed without TLS. I'm saying disconnect and then retry TLS negotiation, and then eventually fail.

As I said above:

Quoted 1 line
Quoted 1 line

I'm not following what aspect of the implementation is problematic.

I still don't understand what you want changed. (Not arguing, just not understanding).

One or the other side will disconnect if the probe fails. My memory might be failing, but I'm not aware of the client continuing to use a connection after sending an RPC_AUTH_TLS probe that fails. Also I'm not aware that RFC 9289 requires disconnection after a probe failure, though I believe that the Linux implementation does disconnect.

By "continuing operation" I mean simply that either the client tries to reconnect with TLS (in the _requires_ case) or the client reconnects with no probe and no TLS (in the _opportunistic_ case). A TLS failure, after the initial contact with the server, will not cause a non-probe RPC to terminate.

If we don't disconnect after a probe failure, I can look into changing that. But I think we already work that way.

--
Chuck Lever

#8 lore raw
In reply to Chuck Lever III
Quoted 61 lines · Chuck Lever III
Quoted 49 lines · Trond Myklebust
Quoted 35 lines · Chuck Lever III
Quoted 26 lines

On Sep 6, 2023, at 10:33 AM, Trond Myklebust <[email protected]> wrote:

Quoted 20 lines · Chuck Lever III
Quoted 8 lines · On Sep 5, 2023, at 9:03 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.

Quoted 7 lines

The premise of this commit was incorrect. There are exactly 2 cases
where rpcauth_checkverf() will return an error:

1) If there was an XDR decode problem (i.e. garbage data).
2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.

There's also the AUTH_TLS probe:

https://www.rfc-editor.org/rfc/rfc9289.html#section-4.1-7

Quoted 8 lines
Quoted 5 lines

That was the purpose of 0701214cd6e6.

Reverting this commit is likely to cause problems when our TLS-capable client interacts with a server that knows nothing of AUTH_TLS.

The patch completely broke the semantics of the header validation code.

Quoted 8 lines

If that were truly the case, it's amazing that the client has hobbled along for the past 14 months with no-one noticing the breakage until now.

Seriously, though, treating a bad verifier as garbage args is not intuitive. If it's that critical there needs to be a comment in the code explaining why.

Quoted 4 lines

It is necessary because of the peculiarities of RPCSEC_GSS and the session semantics it implements.
See https://datatracker.ietf.org/doc/html/rfc2203#section-5.3.3.1 and in particular, the paragraph discussing retransmissions by the client.

Retrying is fine.

But the counter in the client is called "garbage_retries". That's not what is going on the EACCES case, though the behavior is close enough -- it's code re-use (good) without appropriate documentation (bad).

Quoted 8 lines

The decoder treats EIO and EACCES exactly the same way. Again, code reuse (good) without appropriate documentation (bad).

I tried to address that in my RFC patch by adding a small explanatory comment and by adding an API contract for rpcauth_checkverf().

So this has come out of discussion that Trond and I are having as what should happen when rpcauth_checkverf fails.

The problem we are running into and fairly easy to repo with iptables drop <server ip> ; sleep 60 ;iptables accept <server ip>

Our systems are currently running either ubuntu 18.04 4.15 based or ubutunu 22.04 5.15 based both exhibit problem and neither has the change.

The problem happens before xdr_inline_decode and the switch statement
so I don't think the change has any affect on the problem we trying to sort out where the gss checksum does not match due to the re-trans due to the RPC timeout.

--Russell

Quoted 135 lines
Quoted 22 lines
Quoted 22 lines
Quoted 3 lines

There is no discussion about whether or not it needs to be reverted.

The patch description is wrong, though, to exclude AUTH_TLS.

The reverting patch description claims to be an exhaustive list of all the cases, but it doesn't mention the AUTH_TLS case at all.

Quoted 6 lines

If the TLS code needs special treatment, then a separate patch is needed to fix tls_validate() to return something that can be caught by
rpc_decode_header and interpreted differently to the EIO and EACCES error codes currently being returned by RPCSEC_GSS, AUTH_SYS and others.

That could have been brought up when 0701214cd6e6 was first posted for review. Interesting that the decoder currently does not distinguish between EIO and EACCES.

Quoted 5 lines
Quoted 2 lines

Thanks for the suggestion, I'll have a look.

Now that I look at it, I think your approach to satisfying RFC9289 is not correct.

I'm not following what aspect of the implementation is problematic. I'm going to assume you mean the implementation of opportunism.

Quoted 4 lines

Since this is a transport level issue, why should we not just mark the xprt for disconnection, and then retry? It is entirely possible that some load balancer/floating IP has just moved the connection to some node that was not expecting to do TLS.

Depending on the security policy chosen by the client's administrator, that could either be a security problem or a "don't care" situation.

If the administrator wants the client to _require_ TLS, then connecting to a load balancer where TLS suddenly becomes unavailable after a reconnect is a hard error. This prevents STRIPTLS attacks. That's good security.

If the administrator wants to allow operation to continue even if TLS is not available, then the client can recover by not using TLS. That's rather terrible security, but can be desirable to improve backward compatibility.

Quoted 4 lines

The only case where that should
not be assumed is the case where the error happens right at the very beginning of the mount, when disconnecting should normally suffice to trigger the RPC_TASK_SOFTCONN code anyway.

If TLS goes away after a reconnect, that's a problem. Whether further operation should stop depends on the administrator's chosen security policy.

The security policies are NFS-level settings (eg, mount options). RPC just indicates to NFS whether the traffic is protected or not.

When NFS asks RPC to ensure the communication channel is protected, that means every reconnect is protected. Communication with that security policy cannot happen without protection.

Trust me, the security community will have it no other way.

If you need opportunism in this case, then I can add back the "xprtsec=auto" mount option, which you asked me to remove a while back.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 46 lines
Quoted 36 lines

In the second case, there are again 2 subcases:

a) The GSS context expires, in which case gss_validate() will force
a
new context negotiation on retry by invalidating the cred.
b) The sequence number check failed because an RPC call timed out,
and
the client retransmitted the request using a new sequence
number,
as required by RFC2203.

In neither subcase is this a fatal error.

Fixes 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")
Signed-off-by Trond Myklebust

<[email protected]>
---
net/sunrpc/clnt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +0 -0
index 12c46e129db8..5a7de7e55548 100644
@@ -2724,7 +2724,7 @@ rpc_decode_header(struct rpc_task *task,
 struct xdr_stream *xdr)
 

out_verifier:
trace_rpc_bad_verifier(task);
- goto out_err;
+ goto out_garbage;

Quoted 5 lines

out_msg_denied:
error = -EACCES;

Signature · 1 line
2.41.0

--
Chuck Lever

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]

--
Chuck Lever

--
Chuck Lever