public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: Fix incorrect immediate spill
@ 2023-10-26 15:13 Hao Sun
  2023-10-26 15:13 ` [PATCH bpf-next 1/2] bpf: Fix check_stack_write_fixed_off() to correctly spill imm Hao Sun
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hao Sun @ 2023-10-26 15:13 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, John Fastabend,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Mykola Lysenko,
	Shuah Khan, Eduard Zingerman
  Cc: bpf, linux-kernel, linux-kselftest, Hao Sun

Immediate is incorrectly cast to u32 before being spilled, losing sign
information. The range information is incorrect after load again. Fix
immediate spill by remove the cast. The second patch add a test case
for this.

Signed-off-by: Hao Sun <sunhao.th@gmail.com>
---
Hao Sun (2):
      bpf: Fix check_stack_write_fixed_off() to correctly spill imm
      selftests/bpf: Add test for immediate spilled to stack

 kernel/bpf/verifier.c                             |  2 +-
 tools/testing/selftests/bpf/verifier/bpf_st_mem.c | 32 +++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
---
base-commit: 399f6185a1c02f39bcadb8749bc2d9d48685816f
change-id: 20231026-fix-check-stack-write-c40996694dfa

Best regards,
-- 
Hao Sun <sunhao.th@gmail.com>


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

end of thread, other threads:[~2023-10-27  8:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-26 15:13 [PATCH bpf-next 0/2] bpf: Fix incorrect immediate spill Hao Sun
2023-10-26 15:13 ` [PATCH bpf-next 1/2] bpf: Fix check_stack_write_fixed_off() to correctly spill imm Hao Sun
2023-10-27  7:14   ` Shung-Hsi Yu
2023-10-27  7:44     ` Shung-Hsi Yu
2023-10-27  7:51       ` Hao Sun
2023-10-27  8:01         ` Shung-Hsi Yu
2023-10-26 15:13 ` [PATCH bpf-next 2/2] selftests/bpf: Add test for immediate spilled to stack Hao Sun
2023-10-26 21:33 ` [PATCH bpf-next 0/2] bpf: Fix incorrect immediate spill Eduard Zingerman

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