Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: bugs@stellman-greene.com
Cc: dhowells@redhat.com, marc.dionne@auristor.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org,
	linux-afs@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] rxrpc: Reject unsecured calls to userspace services with a minimum level
Date: Fri, 27 Nov 2026 23:24:00 +0000	[thread overview]
Message-ID: <179582184048.3135.8278153392391816452@kernel.org> (raw)
In-Reply-To: <20261126224137.55862-1-bugs@stellman-greene.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The fix is incomplete.
- [Medium] After this patch, RXRPC_MIN_SECURITY_LEVEL means different
  things depending on rx->sk.sk_kern_sock, and the documentation does…
- [Low] The new reject path in rxrpc_get_incoming_security() returns NULL
  without calling rxrpc_direct_conn_abort() with its own reason.
- [Low] The commit is described as a fix for a security-policy bug (a
  service minimum security level that is not enforced for unsecured…

--

rxrpc: Reject unsecured calls to userspace services with a minimum level

This patch makes rxrpc_get_incoming_security() refuse incoming calls with
security index RXRPC_SECURITY_NONE when a userspace service socket has set
RXRPC_MIN_SECURITY_LEVEL above RXRPC_SECURITY_PLAIN. Kernel sockets are
exempted, because kAFS and rxperf set RXRPC_SECURITY_ENCRYPT on the sockets
they serve on.

> Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>

[Severity: Low]
This isn't a bug, but should this have a Fixes: tag? The changelog
describes the patch as a fix for a security policy bug.

The patch also deliberately changes behaviour for existing userspace
services. Could the changelog say whether it is meant for stable?

> diff --git a/net/rxrpc/security.c b/net/rxrpc/security.c
> index 2bfbf2b2bb37a..52015c73c583c 100644
> --- a/net/rxrpc/security.c
> +++ b/net/rxrpc/security.c
> @@ -138,6 +138,11 @@ const struct rxrpc_security *rxrpc_get_incoming_security(struct rxrpc_sock *rx,
>  
>  	_enter("");
>  
> +	if (sp->hdr.securityIndex == RXRPC_SECURITY_NONE &&
> +	    rx->min_sec_level > RXRPC_SECURITY_PLAIN &&

[Severity: High]
The commit message gives the root cause as:

  rxrpc_get_incoming_security() doesn't check rx->min_sec_level

This check only covers security index NONE, though. Will a userspace
service socket with RXRPC_MIN_SECURITY_LEVEL set to RXRPC_SECURITY_ENCRYPT
still accept rxkad or rxgk calls negotiated at a lower level?

In rxkad_verify_response(), the level comes from the client's RESPONSE
packet. It only gets an upper bound check:

net/rxrpc/rxkad.c:rxkad_verify_response() {
    ...
	level = ntohl(response->encrypted.level);
	if (level > RXRPC_SECURITY_ENCRYPT) {
		...
	}
	conn->security_level = level;
    ...
}

rxgk_verify_response() does the same thing with the token level:

net/rxrpc/rxgk.c:rxgk_verify_response() {
    ...
	conn->security_level = token->rxgk->level;
    ...
}

Neither of these compares the level against rx->min_sec_level. Apart
from the setters and this new check, min_sec_level is only read in the
client call setup paths, rxrpc_kernel_begin_call() and
rxrpc_new_client_call_for_sendmsg().

An authenticated client could answer the CHALLENGE with level
RXRPC_SECURITY_PLAIN or RXRPC_SECURITY_AUTH. Its calls would then reach a
service that requires ENCRYPT. At PLAIN level the data has no integrity
protection either.

That seems to contradict Documentation/networking/rxrpc.rst, which
describes the option as "the minimum security level required for calls
on this socket".

The gap is only mentioned below the --- line, so the note won't end up
in git history. Should the negotiated level also be checked where the
connection gets secured, in rxkad_verify_response() and the rxgk verify
path?

> +	    !rx->sk.sk_kern_sock)

[Severity: Medium]
With this exemption, RXRPC_MIN_SECURITY_LEVEL means different things
depending on sk_kern_sock. Is that split meant to be documented?

For userspace service sockets, the option now also rejects incoming
NONE calls.

For kernel sockets that use rxrpc_sock_set_min_security_level(), it is
still only the level used for outgoing client calls:

net/rxrpc/sendmsg.c:rxrpc_new_client_call_for_sendmsg() {
    ...
	cp.security_level	= rx->min_sec_level;
    ...
}

The in-tree kernel users already depend on this client-only meaning.
afs_open_socket() sets ENCRYPT on the CM service socket, and that socket
must accept unsecured fileserver callbacks:

fs/afs/rxrpc.c:afs_open_socket() {
    ...
	ret = rxrpc_sock_set_min_security_level(socket->sk,
						RXRPC_SECURITY_ENCRYPT);
    ...
}

rxperf does the same.

Documentation/networking/rxrpc.rst uses the same words for the sockopt
and for rxrpc_sock_set_min_security_level(): "the minimum security level
required for calls on this socket". It doesn't cover the new service
side enforcement or the kernel socket exemption.

A userspace program built like kAFS uses one socket to make encrypted
client calls and to accept unsecured callbacks. With this patch, its
incoming calls will be aborted.

It could bind a separate client socket to the same transport address as
a workaround. Existing programs would still break with no indication of
why.

Should Documentation/networking/rxrpc.rst be updated to describe this
behaviour?

> +		return NULL;

[Severity: Low]
The other two NULL returns in rxrpc_get_incoming_security() call
rxrpc_direct_conn_abort() with their own reason, but this one doesn't.
Will this rejection be traced as rxrpc_abort_service_not_offered?

The caller falls through to this code:

net/rxrpc/call_accept.c:rxrpc_new_incoming_call() {
    ...
unsupported_security:
	read_unlock_irq(&local->services_lock);
	return rxrpc_direct_conn_abort(skb, rxrpc_abort_service_not_offered,
				       RX_INVALID_OPERATION, -EKEYREJECTED);
    ...
}

So trace_rxrpc_abort reports "service not offered" even though the
service is bound and listening. The peer gets a generic
RX_INVALID_OPERATION abort.

This fallback in rxrpc_new_incoming_call() also overwrites the abort
codes set by the existing NULL paths in rxrpc_get_incoming_security().
That part is older than this patch.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126224137.55862-1-bugs%40stellman-greene.com

      reply	other threads:[~2026-11-27 23:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 22:41 [PATCH net-next] rxrpc: Reject unsecured calls to userspace services with a minimum level Andrew Stellman
2026-11-27 23:24 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179582184048.3135.8278153392391816452@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bugs@stellman-greene.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox