Files
Yiming Qian 9bb86d8184 net: skmsg: preserve sg.copy across SG transforms
commit 406e8a651a upstream.

The sk_msg sg.copy bitmap is part of the scatterlist entry ownership
state. A set bit tells sk_msg_compute_data_pointers() not to expose the
entry through writable BPF ctx->data. This protects entries backed by
pages that are not private to the sk_msg, such as splice-backed file
page-cache pages.

Several sk_msg transform paths move, copy, split, or compact
msg->sg.data[] entries without moving the matching sg.copy bit. This can
make an externally backed entry arrive at a new slot with a clear copy
bit. A later SK_MSG verdict can then expose sg_virt(sge) as writable
ctx->data and BPF stores can modify the original page cache.

Keep sg.copy synchronized with sg.data[] whenever entries are
transferred, shifted, split, or copied into a new sk_msg. Clear the bit
when an entry is replaced by a newly allocated private page or freed.
This covers the BPF pull/push/pop helpers, sk_msg_shift_left/right(),
sk_msg_xfer(), and tls_split_open_record(), including the partial tail
entry created during TLS open-record splitting.

Fixes: d3b18ad31f ("tls: add bpf support to sk_msg handling")
Cc: stable@vger.kernel.org
Reported-by: Yiming Qian <yimingqian591@gmail.com>
Reported-by: Keenan Dong <keenanat2000@gmail.com>
Signed-off-by: Yiming Qian <yimingqian591@gmail.com>
Link: https://patch.msgid.link/20260610062137.49075-1-yimingqian591@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-04 13:41:31 +02:00
..
2026-03-04 07:19:30 -05:00
2026-03-25 11:03:01 +01:00
2025-09-11 17:19:15 +02:00
2026-01-11 15:19:01 +01:00
2025-07-06 10:58:04 +02:00
2026-01-11 15:18:35 +01:00
2025-06-04 14:40:25 +02:00
2026-06-01 17:39:24 +02:00
2025-08-15 12:04:54 +02:00
2026-06-19 13:37:20 +02:00
2026-01-11 15:18:48 +01:00
2026-01-11 15:19:13 +01:00