BPF List
 help / color / mirror / Atom feed
* [PATCH v3 bpf-next 0/2] bpf: Fix OOB read and add tests for load-acquire/store-release
@ 2025-03-22  4:52 Kohei Enju
  2025-03-22  4:52 ` [PATCH v3 bpf-next 1/2] bpf: Fix out-of-bounds read in check_atomic_load/store() Kohei Enju
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kohei Enju @ 2025-03-22  4:52 UTC (permalink / raw)
  To: bpf, linux-kernel
  Cc: Alexei Starovoitov, Daniel Borkmann, John Fastabend,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Peilin Ye, Ilya Leoshkevich, Kuniyuki Iwashima, kohei.enju,
	Kohei Enju, syzbot+a5964227adc0f904549c

This patch series addresses an out-of-bounds read issue in 
check_atomic_load/store() reported by syzkaller when an invalid register 
number (MAX_BPF_REG or greater) is used.

The first patch fixes the actual bug by changing the order of validity 
checks, ensuring register validity is checked before atomic_ptr_type_ok() 
is called.
It also updates some tests that were assuming the previous order of checks.

The second patch adds new tests specifically for the invalid register 
number case to prevent regression in the future.

Changes:
  v3:
    - Change invalid register from R11 to R15 in new tests
  v2: https://lore.kernel.org/all/20250321110010.95217-4-enjuk@amazon.com/
    - Just swap atomic_ptr_type_ok() and check_load_mem()/check_store_reg()
    - Update some tests that were assuming the previous order of checks
    - Add new tests specifically for the invalid register number
  v1: https://lore.kernel.org/bpf/20250314195619.23772-2-enjuk@amazon.com/

Reported-by: syzbot+a5964227adc0f904549c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a5964227adc0f904549c

Kohei Enju (2):
  bpf: Fix out-of-bounds read in check_atomic_load/store()
  selftests/bpf: Add selftests for load-acquire/store-release when
    register number is invalid

 kernel/bpf/verifier.c                         | 16 +++++++++--
 .../bpf/progs/verifier_load_acquire.c         | 26 +++++++++++++++--
 .../bpf/progs/verifier_store_release.c        | 28 +++++++++++++++++--
 3 files changed, 63 insertions(+), 7 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-22 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-22  4:52 [PATCH v3 bpf-next 0/2] bpf: Fix OOB read and add tests for load-acquire/store-release Kohei Enju
2025-03-22  4:52 ` [PATCH v3 bpf-next 1/2] bpf: Fix out-of-bounds read in check_atomic_load/store() Kohei Enju
2025-03-22  4:52 ` [PATCH v3 bpf-next 2/2] selftests/bpf: Add selftests for load-acquire/store-release when register number is invalid Kohei Enju
2025-03-22 13:30 ` [PATCH v3 bpf-next 0/2] bpf: Fix OOB read and add tests for load-acquire/store-release patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox