summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-10-17 23:09:49 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-10-18 00:36:44 +0000
commitab08863c58b1a96ff8378e373cb3d277cbe65b68 (patch)
treea70945b05f860777b2ee78ebc2810f79cf0531d9 /kernel
parent1db084f42884c5af881fedf3df4777fe2095b20b (diff)
downloadlinux-ab08863c58b1a96ff8378e373cb3d277cbe65b68.tar.gz
linux-ab08863c58b1a96ff8378e373cb3d277cbe65b68.zip
bpf: Use memmove() to store bytes in an xdp_buff
bpf_dynptr_write() to the dynptr of an xdp_buff ends in bpf_xdp_store_bytes(). The source can be a slice of the same xdp_buff which overlaps the destination, and the helper itself takes such a slice as well. memcpy() then reads bytes which it has overwritten already. On x86 with FSRM p = bpf_dynptr_slice_rdwr(&ptr, 0, NULL, 64); bpf_dynptr_write(&ptr, 8, p, 64, 0); repeats the first 8 bytes of the packet instead of moving 64. A write that crosses from the linear part into a fragment is copied piece by piece, where the first piece can overwrite what the second one has yet to read. That is not dealt with here. Fixes: 2012c867c800 ("bpf: verifier: Accept dynptr mem as mem in helpers") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261017230950.802052-16-alexei.starovoitov@gmail.com
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions