[Deepin-Kernel-SIG] [linux 6.6-y] [FROMLIST] Sync rxrpc fixes from upstream and maillist#1674
Conversation
Reviewer's GuideSyncs upstream rxrpc/rxkad fixes related to Dirty Frag: enforces 8‑byte alignment before rxkad v2 decryption, tightens crypto error handling, reworks response verification and RX path to only decrypt on unshared SKBs, simplifies connection work retry logic, and updates rxrpc tracing and helpers accordingly. Sequence diagram for rxrpc_verify_response handling cloned or nonlinear SKBssequenceDiagram
participant Conn as rxrpc_connection
participant ProcessEvent as rxrpc_process_event
participant VerifyWrapper as rxrpc_verify_response
participant SecOps as security_verify_response
participant SKB as sk_buff
ProcessEvent->>VerifyWrapper: rxrpc_verify_response(conn, skb)
alt skb_cloned(skb) or skb_is_nonlinear(skb)
VerifyWrapper->>VerifyWrapper: skb_copy(skb, GFP_NOFS)
alt nskb allocated
VerifyWrapper->>VerifyWrapper: rxrpc_new_skb(nskb, rxrpc_skb_new_unshared)
VerifyWrapper->>SecOps: conn->security->verify_response(conn, nskb)
SecOps-->>VerifyWrapper: ret
VerifyWrapper->>VerifyWrapper: rxrpc_free_skb(nskb, rxrpc_skb_put_response_copy)
else nskb allocation failed
VerifyWrapper->>VerifyWrapper: rxrpc_see_skb(skb, rxrpc_skb_see_unshare_nomem)
VerifyWrapper-->>ProcessEvent: ret = -ENOMEM
end
else skb exclusively owned and linear
VerifyWrapper->>SecOps: conn->security->verify_response(conn, skb)
SecOps-->>VerifyWrapper: ret
end
VerifyWrapper-->>ProcessEvent: ret
Sequence diagram for rxrpc_input_call_event handling encrypted data SKBssequenceDiagram
participant Call as rxrpc_call
participant InputEvent as rxrpc_input_call_event
participant InputPkt as rxrpc_input_call_packet
participant SKB as sk_buff
InputEvent->>InputEvent: determine resend flag
alt skb is not NULL
InputEvent->>InputEvent: sp = rxrpc_skb(skb)
alt encrypted data and (skb_cloned or skb_is_nonlinear)
InputEvent->>InputEvent: skb_copy(skb, GFP_ATOMIC) as nskb
alt nskb allocated
InputEvent->>InputEvent: rxrpc_new_skb(nskb, rxrpc_skb_new_unshared)
InputEvent->>InputPkt: rxrpc_input_call_packet(call, nskb)
InputPkt-->>InputEvent: return
InputEvent->>InputEvent: rxrpc_free_skb(nskb, rxrpc_skb_put_input)
else OOM
InputEvent->>InputEvent: rxrpc_see_skb(skb, rxrpc_skb_see_unshare_nomem)
InputEvent-->>Call: drop packet
end
else not encrypted data or already unshared
InputEvent->>InputPkt: rxrpc_input_call_packet(call, skb)
InputPkt-->>InputEvent: return
end
end
InputEvent->>InputEvent: rxrpc_transmit_some_data(call)
Class diagram for updated rxrpc rxkad verification and SKB utilitiesclassDiagram
class rxrpc_connection {
+struct rxrpc_security *security
+struct rxkad_proto rxkad
+u32 security_level
+int state
+struct sk_buff_head rx_queue
+int channels_call_counter[RXRPC_MAXCALLS]
}
class rxrpc_security {
<<interface>>
+int verify_response(struct rxrpc_connection *conn, struct sk_buff *skb)
}
class rxkad_security {
+int rxkad_verify_packet_2(struct rxrpc_call *call, struct sk_buff *skb, struct rxrpc_skb_priv *sp)
+int rxkad_verify_response(struct rxrpc_connection *conn, struct sk_buff *skb)
+int rxkad_decrypt_ticket(struct rxrpc_connection *conn, struct key *server_key, struct sk_buff *skb, void *ticket, u32 ticket_len, struct rxrpc_crypt *session_key, time64_t *expiry)
+int rxkad_decrypt_response(struct rxrpc_connection *conn, struct rxkad_response *response, struct rxrpc_crypt *session_key)
}
class rxrpc_call {
+struct rxrpc_connection *conn
+u32 security_level
+void rxrpc_transmit_some_data(struct rxrpc_call *call)
}
class sk_buff_utils {
+void rxrpc_new_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)
+void rxrpc_see_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)
+void rxrpc_get_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)
+void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)
}
class rxrpc_conn_event_c {
+int rxrpc_verify_response(struct rxrpc_connection *conn, struct sk_buff *skb)
+int rxrpc_process_event(struct rxrpc_connection *conn, struct sk_buff *skb)
+void rxrpc_do_process_connection(struct rxrpc_connection *conn)
}
class rxrpc_call_event_c {
+bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb)
+void rxrpc_input_call_packet(struct rxrpc_call *call, struct sk_buff *skb)
}
class rxrpc_io_thread_c {
+bool rxrpc_input_packet(struct rxrpc_local *local, struct sk_buff *skb)
+int rxrpc_io_thread(void *data)
}
class rxrpc_trace_events_h {
+enum rxrpc_abort_reason rxkad_abort_2_crypto_unaligned
+enum rxrpc_skb_trace rxrpc_skb_see_unshare_nomem
}
rxrpc_security <|.. rxkad_security
rxrpc_connection --> rxrpc_security : security
rxrpc_connection --> rxrpc_conn_event_c : uses
rxrpc_call --> rxrpc_call_event_c : uses
rxrpc_io_thread_c --> rxrpc_connection : locates
rxrpc_conn_event_c --> sk_buff_utils : manages_skb
rxrpc_call_event_c --> sk_buff_utils : manages_skb
rxkad_security --> rxrpc_trace_events_h : uses_traces
rxrpc_conn_event_c --> rxkad_security : verify_response
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new skb unsharing/copying logic for encrypted packets is now implemented in multiple places (rxrpc_verify_response() in conn_event.c and the RXRPC_PACKET_TYPE_DATA path in call_event.c); consider factoring this into a shared helper to keep the in-place decryption preconditions consistent and reduce duplication.
- rxrpc_do_process_connection() now ignores the return value from rxrpc_process_event() and always frees the skb, changing the previous ENOMEM/EAGAIN retry semantics; double-check that no callers still rely on connection-level packet retries and, if not, consider a short comment explaining the intentional drop-on-error behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new skb unsharing/copying logic for encrypted packets is now implemented in multiple places (rxrpc_verify_response() in conn_event.c and the RXRPC_PACKET_TYPE_DATA path in call_event.c); consider factoring this into a shared helper to keep the in-place decryption preconditions consistent and reduce duplication.
- rxrpc_do_process_connection() now ignores the return value from rxrpc_process_event() and always frees the skb, changing the previous ENOMEM/EAGAIN retry semantics; double-check that no callers still rely on connection-level packet retries and, if not, consider a short comment explaining the intentional drop-on-error behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
commit 34f61a07e0cdefaecd3ec03bb5fb22215643678f upstream. Fix rxkad_verify_response() to free the ticket and the server key under all circumstances by initialising the ticket pointer to NULL and then making all paths through the function after the first allocation has been done go through a single common epilogue that just releases everything - where all the releases skip on a NULL pointer. Fixes: 57af281 ("rxrpc: Tidy up abort generation infrastructure") Fixes: ec832bd ("rxrpc: Don't retain the server key in the connection") Closes: https://sashiko.dev/#/patchset/20260408121252.2249051-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: Simon Horman <horms@kernel.org> cc: linux-afs@lists.infradead.org cc: stable@kernel.org Link: https://patch.msgid.link/20260422161438.2593376-2-dhowells@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
commit def304aae2edf321d2671fd6ca766a93c21f877e upstream.
Fix handling of a packet with a misaligned crypto length. Also handle
non-ENOMEM errors from decryption by aborting. Further, remove the
WARN_ON_ONCE() so that it can't be remotely triggered (a trace line can
still be emitted).
Fixes: f93af41b9f5f ("rxrpc: Fix missing error checks for rxkad encryption/decryption failure")
Closes: https://sashiko.dev/#/patchset/20260408121252.2249051-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: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/20260422161438.2593376-3-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
commit 0422e7a4883f25101903f3e8105c0808aa5f4ce9 upstream. If a RESPONSE packet gets a temporary failure during processing, it may end up in a partially decrypted state - and then get requeued for a retry. Fix this by just discarding the packet; we will send another CHALLENGE packet and thereby elicit a further response. Similarly, discard an incoming CHALLENGE packet if we get an error whilst generating a RESPONSE; the server will send another CHALLENGE. Fixes: 17926a7 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both") Closes: https://sashiko.dev/#/patchset/20260422161438.2593376-4-dhowells@redhat.com Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: Jeffrey Altman <jaltman@auristor.com> cc: Simon Horman <horms@kernel.org> cc: linux-afs@lists.infradead.org cc: stable@kernel.org Link: https://patch.msgid.link/20260423200909.3049438-3-dhowells@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
ace0028 to
8271c8c
Compare
|
/fix |
maillist inclusion category: bugfix [ Upstream commit 1f2740150f904bfa60e4bad74d65add3ccb5e7f8 ] If skb_unshare() fails to unshare a packet due to allocation failure in rxrpc_input_packet(), the skb pointer in the parent (rxrpc_io_thread()) will be NULL'd out. This will likely cause the call to trace_rxrpc_rx_done() to oops. Fix this by moving the unsharing down to where rxrpc_input_call_event() calls rxrpc_input_call_packet(). There are a number of places prior to that where we ignore DATA packets for a variety of reasons (such as the call already being complete) for which an unshare is then avoided. And with that, rxrpc_input_packet() doesn't need to take a pointer to the pointer to the packet, so change that to just a pointer. Fixes: 2d1faf7 ("rxrpc: Simplify skbuff accounting in receive path") Closes: https://sashiko.dev/#/patchset/20260408121252.2249051-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: Simon Horman <horms@kernel.org> cc: linux-afs@lists.infradead.org cc: stable@kernel.org Link: https://patch.msgid.link/20260422161438.2593376-4-dhowells@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> [ Relocated the unshare/skb_copy block from rxrpc_input_call_event()'s rx_queue dequeue loop to existing `if (skb) rxrpc_input_call_packet()` site, and substituted rxrpc_skb_put_call_rx with rxrpc_skb_put_input. ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
commit 24481a7f573305706054c59e275371f8d0fe919f upstream. The security operations that verify the RESPONSE packets decrypt bits of it in place - however, the sk_buff may be shared with a packet sniffer, which would lead to the sniffer seeing an apparently corrupt packet (actually decrypted). Fix this by handing a copy of the packet off to the specific security handler if the packet was cloned. Fixes: 17926a7 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both") Closes: https://sashiko.dev/#/patchset/20260408121252.2249051-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: Simon Horman <horms@kernel.org> cc: linux-afs@lists.infradead.org cc: stable@kernel.org Link: https://patch.msgid.link/20260422161438.2593376-5-dhowells@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit ca71ac2de389b01eecdc48bfafbdf073ec232044) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
…ckets
mainline inclusion
from mainline-v7.1-rc1
category: bugfix
commit 55b2984c96c37f909bbfe8851f13152693951382 upstream.
Fix rxrpc_input_call_event() to only unshare DATA packets and not ACK,
ABORT, etc..
And with that, rxrpc_input_packet() doesn't need to take a pointer to the
pointer to the packet, so change that to just a pointer.
Fixes: 1f2740150f90 ("rxrpc: Fix potential UAF after skb_unshare() failure")
Closes: https://sashiko.dev/#/patchset/20260422161438.2593376-4-dhowells@redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/20260423200909.3049438-2-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
8271c8c to
000434f
Compare
…are present maillist inclusion category: bugfix The DATA-packet handler in rxrpc_input_call_event() and the RESPONSE handler in rxrpc_verify_response() copy the skb to a linear one before calling into the security ops only when skb_cloned() is true. An skb that is not cloned but still carries externally-owned paged fragments (e.g. SKBFL_SHARED_FRAG set by splice() into a UDP socket via __ip_append_data, or a chained skb_has_frag_list()) falls through to the in-place decryption path, which binds the frag pages directly into the AEAD/skcipher SGL via skb_to_sgvec(). Extend the gate to also unshare when skb_has_frag_list() or skb_has_shared_frag() is true. This catches the splice-loopback vector and other externally-shared frag sources while preserving the zero-copy fast path for skbs whose frags are kernel-private (e.g. NIC page_pool RX, GRO). The OOM/trace handling already in place is reused. Fixes: d0d5c0c ("rxrpc: Use skb_unshare() rather than skb_cow_data()") Cc: stable@vger.kernel.org Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
000434f to
1817f00
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Avenger-285714 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Syncs upstream RxRPC (rxkad) hardening and fixes related to Dirty-Frag-style shared-SKB handling, tightening crypto error handling and skb lifecycle/trace reporting in the RxRPC receive path.
Changes:
- Harden rxkad packet/response verification (length alignment, crypto-error abort behavior, and consistent error propagation/cleanup).
- Refactor RxRPC receive processing to avoid in-place modification of shared/cloned/frag-list/shared-frag SKBs by copying where needed, and simplify connection workqueue skb handling.
- Update RxRPC skb tracing: remove unused “eaten” events, add events for response-copy frees and unshare-OOM visibility, and adjust connection queue trace enums.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| net/rxrpc/skbuff.c | Removes rxrpc_eaten_skb() accounting hook as part of trace/lifecycle simplification. |
| net/rxrpc/rxkad.c | Adds 8-byte length alignment for level-2 decrypt, improves crypto error handling, and refactors response verification error paths. |
| net/rxrpc/io_thread.c | Simplifies rxrpc_input_packet() interface and removes the earlier unshare step (unsharing/copying handled later). |
| net/rxrpc/conn_event.c | Adds rxrpc_verify_response() wrapper to copy shared SKBs before security verification; simplifies conn rx-queue processing to always free processed SKBs. |
| net/rxrpc/call_event.c | Copies shared/cloned DATA SKBs before call processing to support safe in-place decryption. |
| net/rxrpc/ar-internal.h | Removes prototype for deleted rxrpc_eaten_skb(). |
| include/trace/events/rxrpc.h | Updates trace enums: adds new rxkad abort reason and skb trace reasons; removes unused retry/eaten events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (skb) { | ||
| struct rxrpc_skb_priv *sp = rxrpc_skb(skb); | ||
|
|
||
| if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA && | ||
| sp->hdr.securityIndex != 0 && | ||
| (skb_cloned(skb) || | ||
| skb_has_frag_list(skb) || | ||
| skb_has_shared_frag(skb))) { | ||
| /* Unshare the packet so that it can be modified by | ||
| * in-place decryption. | ||
| */ | ||
| struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); | ||
|
|
||
| if (nskb) { | ||
| rxrpc_new_skb(nskb, rxrpc_skb_new_unshared); | ||
| rxrpc_input_call_packet(call, nskb); | ||
| rxrpc_free_skb(nskb, rxrpc_skb_put_input); | ||
| } else { |
CVE-2026-43284: #1673
Link: #1671
Link: https://dirtyfrag.io/
Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=f4c50a4034e62ab75f1d5cdd191dd5f9c77fdff4
Link: https://lore.kernel.org/all/afKV2zGR6rrelPC7@v4bel/
Link: https://github.com/V4bel/dirtyfrag/blob/master/exp.c
Link: https://seclists.org/oss-sec/2026/q2/434
Link: V4bel/dirtyfrag#14
Link: https://afflicted.sh/blog/posts/copy-fail-2.html
Link: https://almalinux.org/blog/2026-05-07-dirty-frag/
Link: https://www.phoronix.com/news/Dirty-Frag-Linux
Summary by Sourcery
Sync upstream rxrpc security fixes to harden in-place decryption and response verification against malformed or shared SKBs, addressing the dirty frag vulnerability path.
Bug Fixes:
Enhancements: