[PATCH 5.15.y v2 0/5] Backport bounds checks for bpf

From: Edward Liaw
Date: Wed Apr 17 2024 - 21:07:35 EST


These backports fix CVE-2021-4204, CVE-2022-23222 for 5.15.y.

This includes a conflict resolution with 45ce4b4f9009 ("bpf: Fix crash
due to out of bounds access into reg2btf_ids.") which was cherry-picked
previously.
Link: https://lore.kernel.org/all/20220428235751.103203-11-haoluo@xxxxxxxxxx/

They were tested on 5.15.94 to pass LTP test bpf_prog06 with no
regressions from the bpf selftests.

v2:
Made a mistake of not including the out of bounds reg2btf_ids fix

Daniel Borkmann (4):
bpf: Generalize check_ctx_reg for reuse with other types
bpf: Generally fix helper register offset check
bpf: Fix out of bounds access for ringbuf helpers
bpf: Fix ringbuf memory type confusion when passing to helpers

Kumar Kartikeya Dwivedi (1):
bpf: Extend kfunc with PTR_TO_CTX, PTR_TO_MEM argument support

include/linux/bpf.h | 9 +++-
include/linux/bpf_verifier.h | 4 +-
kernel/bpf/btf.c | 93 ++++++++++++++++++++++++++++--------
kernel/bpf/verifier.c | 66 +++++++++++++++++--------
4 files changed, 129 insertions(+), 43 deletions(-)

--
2.44.0.769.g3c40516874-goog