All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyunwoo Kim <imv4bel@gmail.com>
To: Ziyi Guo <n7l8m4@u.northwestern.edu>
Cc: David Howells <dhowells@redhat.com>,
	Marc Dionne <marc.dionne@auristor.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-afs@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, imv4bel@gmail.com
Subject: Re: [PATCH] rxrpc: always copy skb on in-place decrypt to avoid pagecache aliasing
Date: Sun, 3 May 2026 15:23:45 +0900	[thread overview]
Message-ID: <afbp8dod6IK2xTVd@v4bel> (raw)
In-Reply-To: <20260502211340.446927-1-n7l8m4@u.northwestern.edu>

On Sat, May 02, 2026 at 09:13:40PM +0000, Ziyi Guo wrote:
> skb_cloned() does not detect frag-level page sharing introduced by splice()
> with MSG_SPLICE_PAGES.  When such an skb reaches the rxrpc DATA path,
> in-place decryption (rxkad/rxgk) writes plaintext into file
> pagecache pages still aliased to the source file, leading to
> corrupt the page cache of any readable file.
> 
> Drop the skb_cloned() gate so skb_copy() is performed unconditionally
> for DATA packets, severing the alias before decrypt.
> 
> Fixes: d0d5c0cd1e71 ("rxrpc: Use skb_unshare() rather than skb_cow_data()")
> Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
> ---
>  net/rxrpc/call_event.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
> index fdd683261226..39d19a354172 100644
> --- a/net/rxrpc/call_event.c
> +++ b/net/rxrpc/call_event.c
> @@ -333,10 +333,12 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
>  			saw_ack |= sp->hdr.type == RXRPC_PACKET_TYPE_ACK;
>  
>  			if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA &&
> -			    sp->hdr.securityIndex != 0 &&
> -			    skb_cloned(skb)) {
> -				/* Unshare the packet so that it can be
> -				 * modified by in-place decryption.
> +			    sp->hdr.securityIndex != 0) {
> +				/* Always unshare: skb_cloned() does not
> +				 * detect frag-level page sharing introduced
> +				 * by splice() with MSG_SPLICE_PAGES, so
> +				 * in-place decryption could otherwise corrupt
> +				 * the source file's page cache.
>  				 */
>  				struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
>  
> -- 
> 2.34.1
> 

Hi,

A patch for this issue has already been posted earlier:

https://lore.kernel.org/all/afKV2zGR6rrelPC7@v4bel/

Best regards,
Hyunwoo Kim

      reply	other threads:[~2026-05-03  6:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-02 21:13 [PATCH] rxrpc: always copy skb on in-place decrypt to avoid pagecache aliasing Ziyi Guo
2026-05-03  6:23 ` Hyunwoo Kim [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=afbp8dod6IK2xTVd@v4bel \
    --to=imv4bel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --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=n7l8m4@u.northwestern.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.