Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: David Howells <dhowells@redhat.com>, netdev@vger.kernel.org
Cc: Marc Dionne <marc.dionne@auristor.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Simon Horman <horms@kernel.org>,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jeffrey Altman <jaltman@auristor.com>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	keyrings@vger.kernel.org, stable@kernel.org
Subject: Re: [PATCH net 4/4] rxrpc: Fix CHALLENGE packet overqueuing and simplify RESPONSE generation
Date: Fri, 10 Jul 2026 11:39:07 +0200	[thread overview]
Message-ID: <6d6388c9-cdeb-4b91-b393-125f4a5b7e0c@redhat.com> (raw)
In-Reply-To: <20260702144919.172295-5-dhowells@redhat.com>

On 7/2/26 4:49 PM, David Howells wrote:
> Currently, when a CHALLENGE packet comes in, it's queued in an OOB queue on
> the AF_RXRPC socket that generated one of the calls on that connection for
> the application (which might be in userspace) to service.  The application
> then picks up the CHALLENGE and requests a RESPONSE packet be generated,
> allowing the app to include app-specific data in it if appropriate.  There
> is, however, no actual limit on the capacity of the CHALLENGE queue, and
> this could be abused remotely - and also getting the OOB mechanism right
> has proven tricky.
> 
> Further, by analogy with other AFS codebases, it's not actually necessary
> to generate the application data in response to the CHALLENGE.  The reason
> I did this was to set the encryption on the app-data to be the same as that
> specified in the CHALLENGE as the server must be able to handle that.
> However, it's sufficient to use the encoding type set in the token that is
> going to be sent to the server; presumably the kerberos server knows that
> the fileserver can handle that type - otherwise why tell the client to use
> it?
> 
> With this in mind, make the following changes to the rxrpc server:
> 
>  (1) Remove the OOB queuing stuff and retire the related CMSG values and
>      sockopt.
> 
>  (2) Revert to making the connection event processor work item parse the
>      CHALLENGE and generate the RESPONSE directly.
> 
>  (3) Add another (optional) parameter that is passed in when an rxrpc
>      client call is created and ends up attached to the connection bundle
>      and is a user-type key containing the application data.
> 
>  (4) RESPONSE generation looks at the bundle and if the app-data is there,
>      it will include it (if the security class is YFS-RxGK; RxKAD ignores
>      it).
> 
>  (5) The AFS filesystem driver will create an app-data key when it probes a
>      fileserver and will attach it to the afs_server struct.  This is then
>      picked up when a call is made to that server and passed to rxrpc.
> 
>  (6) Direct userspace users of AF_RXRPC can partake by creating a user-type
>      key containing the app-data they want to use and passing its serial ID
>      in a CMSG of type RXRPC_RESPONSE_APPDATA in the initial sendmsg() of a
>      call.
> 
> To support this, I've made a change outside of afs and rxrc:
> 
>  (7) Add a refcount to the user-type key payload.  The problem is that the
>      RESPONSE packet generator needs to look at the length of the app-data,
>      allocate a buffer for the packet and then copy the app-data in - but
>      the RCU read lock cannot be held across the allocation and the key
>      might get updated.  To get around this, a ref is taken on the payload
>      before the allocation and then put afterwards.
> 
>  (8) Since the DNS resolver makes use of the user-defined type's code, but
>      allocates the payload itself, make it initialise the refcount.
> 
> Fixes: 5800b1cf3fd8 ("rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE")
> Link: https://sashiko.dev/#/patchset/20260624163819.3017002-1-dhowells%40redhat.com
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: Jeffrey Altman <jaltman@auristor.com>
> cc: Eric Dumazet <edumazet@google.com>
> cc: "David S. Miller" <davem@davemloft.net>
> cc: Jakub Kicinski <kuba@kernel.org>
> cc: Paolo Abeni <pabeni@redhat.com>
> cc: Simon Horman <horms@kernel.org>
> cc: Jarkko Sakkinen <jarkko@kernel.org>
> cc: linux-afs@lists.infradead.org
> cc: keyrings@vger.kernel.org
> cc: stable@kernel.org
> ---
>  fs/afs/cm_security.c         | 151 ++++++--------
>  fs/afs/fs_probe.c            |   5 +
>  fs/afs/internal.h            |  37 ++--
>  fs/afs/main.c                |   1 -
>  fs/afs/rxrpc.c               |  39 ++--
>  fs/afs/server.c              |   2 +-
>  include/keys/user-type.h     |   2 +
>  include/net/af_rxrpc.h       |  20 +-
>  include/trace/events/afs.h   |   1 +
>  include/trace/events/rxrpc.h |   2 -
>  include/uapi/linux/rxrpc.h   |   6 +-
>  net/dns_resolver/dns_key.c   |   1 +
>  net/rxrpc/Makefile           |   1 -
>  net/rxrpc/af_rxrpc.c         |  49 +----
>  net/rxrpc/ar-internal.h      |  22 +-
>  net/rxrpc/call_object.c      |   4 +-
>  net/rxrpc/conn_client.c      |   2 +
>  net/rxrpc/conn_event.c       |  68 +-----
>  net/rxrpc/key.c              |  36 ++++
>  net/rxrpc/oob.c              | 387 -----------------------------------
>  net/rxrpc/recvmsg.c          |  84 +-------
>  net/rxrpc/rxgk.c             | 128 +++---------
>  net/rxrpc/rxkad.c            |  27 ---
>  net/rxrpc/sendmsg.c          |  15 ++
>  net/rxrpc/server_key.c       |  40 ----
>  security/keys/user_defined.c |  23 ++-
>  26 files changed, 238 insertions(+), 915 deletions(-)
>  delete mode 100644 net/rxrpc/oob.c

This is quite big and difficult to review, could you please someout
break it in smaller chunk?

/P


      parent reply	other threads:[~2026-07-10  9:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 14:49 [PATCH net 0/4] rxrpc: Fix CHALLENGE packet handling David Howells
2026-07-02 14:49 ` [PATCH net 1/4] afs: Fix NULL deref in afs_deliver_cb_init_call_back_state3() David Howells
2026-07-02 17:31   ` Jeffrey E Altman
2026-07-02 14:49 ` [PATCH net 2/4] rxrpc: Fix sendmsg to not return an error if last packet queued David Howells
2026-07-02 14:49 ` [PATCH net 3/4] afs: Fix UAF when sending a message David Howells
2026-07-03 11:12   ` Marc Dionne
2026-07-02 14:49 ` [PATCH net 4/4] rxrpc: Fix CHALLENGE packet overqueuing and simplify RESPONSE generation David Howells
2026-07-09 10:37   ` Simon Horman
2026-07-10  9:39   ` Paolo Abeni [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=6d6388c9-cdeb-4b91-b393-125f4a5b7e0c@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jaltman@auristor.com \
    --cc=jarkko@kernel.org \
    --cc=keyrings@vger.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=stable@kernel.org \
    /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