Files
linux-stable-mirror/include/linux
Yiming Qian d22cc92bc4 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:43:32 +02:00
..
2026-03-04 07:19:39 -05:00
2026-03-04 07:20:22 -05:00
2026-07-04 13:43:31 +02:00
2026-03-04 07:19:26 -05:00
2026-05-23 13:04:35 +02:00
2026-07-04 13:43:31 +02:00
2026-06-19 13:42:17 +02:00
2026-07-04 13:43:31 +02:00
2026-07-04 13:43:31 +02:00
2026-04-11 14:24:32 +02:00
2026-05-23 13:04:49 +02:00
2026-07-04 13:43:31 +02:00