[PATCH bpf v2 0/2] bpf: Fix incorrect immediate spill

2023-11-01 Thread 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 --- Changes in v2: - Add fix and cc tags. - Link to v1

[PATCH bpf v2 1/2] bpf: Fix check_stack_write_fixed_off() to correctly spill imm

2023-11-01 Thread Hao Sun
In check_stack_write_fixed_off(), imm value is cast to u32 before being spilled to the stack. Therefore, the sign information is lost, and the range information is incorrect when load from the stack again. For the following prog: 0: r2 = r10 1: *(u64*)(r2 -40) = -44 2: r0 = *(u64*)(r2 - 40) 3: if

[PATCH bpf v2 2/2] selftests/bpf: Add test for immediate spilled to stack

2023-11-01 Thread Hao Sun
Add a test to check if the verifier correctly reason about the sign of an immediate spilled to stack by BPF_ST instruction. Signed-off-by: Hao Sun --- tools/testing/selftests/bpf/verifier/bpf_st_mem.c | 32 +++ 1 file changed, 32 insertions(+) diff --git a/tools/testing/self

Re: [PATCH bpf v2 1/2] bpf: Fix check_stack_write_fixed_off() to correctly spill imm

2023-11-01 Thread Shung-Hsi Yu
On Wed, Nov 01, 2023 at 08:33:22AM +0100, Hao Sun wrote: > In check_stack_write_fixed_off(), imm value is cast to u32 before being > spilled to the stack. Therefore, the sign information is lost, and the > range information is incorrect when load from the stack again. > > For the following prog: >

Re: [RFC] drm/tests: annotate intentional stack trace in drm_test_rect_calc_hscale()

2023-11-01 Thread Dan Carpenter
Let me add Richard to the CC list. See lore for more details. https://lore.kernel.org/all/CA+G9fYuA643RHHpPnz9Ww7rr3zV5a0y=7_uFcybBSL=qp_s...@mail.gmail.com/ On Tue, Oct 31, 2023 at 09:57:48PM +0530, Naresh Kamboju wrote: > On Mon, 30 Oct 2023 at 14:33, Dan Carpenter wrote: > > > > We have start

Re: [PATCH bpf v2 1/2] bpf: Fix check_stack_write_fixed_off() to correctly spill imm

2023-11-01 Thread Eduard Zingerman
On Wed, 2023-11-01 at 08:33 +0100, Hao Sun wrote: > In check_stack_write_fixed_off(), imm value is cast to u32 before being > spilled to the stack. Therefore, the sign information is lost, and the > range information is incorrect when load from the stack again. > > For the following prog: > 0: r2

Re: [PATCH bpf v2 2/2] selftests/bpf: Add test for immediate spilled to stack

2023-11-01 Thread Eduard Zingerman
On Wed, 2023-11-01 at 08:33 +0100, Hao Sun wrote: > Add a test to check if the verifier correctly reason about the sign > of an immediate spilled to stack by BPF_ST instruction. > > Signed-off-by: Hao Sun > --- > tools/testing/selftests/bpf/verifier/bpf_st_mem.c | 32 > +++ >

Re: [PATCH bpf v2 2/2] selftests/bpf: Add test for immediate spilled to stack

2023-11-01 Thread Hao Sun
On Wed, Nov 1, 2023 at 12:05 PM Eduard Zingerman wrote: > > On Wed, 2023-11-01 at 08:33 +0100, Hao Sun wrote: > > Add a test to check if the verifier correctly reason about the sign > > of an immediate spilled to stack by BPF_ST instruction. > > > > Signed-off-by: Hao Sun > > --- > > tools/testi

[PATCH bpf v3 0/2] bpf: Fix incorrect immediate spill

2023-11-01 Thread Hao Sun
the test case - Link to v2: https://lore.kernel.org/r/20231101-fix-check-stack-write-v2-0-cb7c17b86...@gmail.com Changes in v2: - Add fix and cc tags. - Link to v1: https://lore.kernel.org/r/20231026-fix-check-stack-write-v1-0-6b325ef3c...@gmail.com --- Hao Sun (2): bpf: Fix

[PATCH bpf v3 2/2] selftests/bpf: Add test for immediate spilled to stack

2023-11-01 Thread Hao Sun
Add a test to check if the verifier correctly reason about the sign of an immediate spilled to stack by BPF_ST instruction. Signed-off-by: Hao Sun --- tools/testing/selftests/bpf/verifier/bpf_st_mem.c | 32 +++ 1 file changed, 32 insertions(+) diff --git a/tools/testing/self

[PATCH bpf v3 1/2] bpf: Fix check_stack_write_fixed_off() to correctly spill imm

2023-11-01 Thread Hao Sun
In check_stack_write_fixed_off(), imm value is cast to u32 before being spilled to the stack. Therefore, the sign information is lost, and the range information is incorrect when load from the stack again. For the following prog: 0: r2 = r10 1: *(u64*)(r2 -40) = -44 2: r0 = *(u64*)(r2 - 40) 3: if

Re: [PATCH v2] selftests/net: synchronize udpgso_bench rx and tx

2023-11-01 Thread Lucas Karpinski
On Tue, Oct 31, 2023 at 05:11:59PM -0400, Willem de Bruijn wrote: > > The patch subject mentions UDP GSO, but the patch fixes the udpgro > scripts. > > There are separate udpgso testcases. So you probably want to s/gso/gro. > The patch synchronizes the connection between the two binaries; udpgso_

[GIT PULL] KUnit next update for Linux 6.7-rc1

2023-11-01 Thread Shuah Khan
Hi Linus, Please pull the following KUnit next update for Linux 6.7-rc1. This kunit update for Linux 6.7-rc1 consists of: -- string-stream testing enhancements -- several fixes memory leaks -- fix to reset status during parameter handling diff is attached. thanks, -- Shuah --

[RFCv2 bpf-next 0/7] Add bpf_xdp_get_xfrm_state() kfunc

2023-11-01 Thread Daniel Xu
This patchset adds two kfunc helpers, bpf_xdp_get_xfrm_state() and bpf_xdp_xfrm_state_release() that wrap xfrm_state_lookup() and xfrm_state_put(). The intent is to support software RSS (via XDP) for the ongoing/upcoming ipsec pcpu work [0]. Recent experiments performed on (hopefully) reproducible

[RFCv2 bpf-next 3/7] bpf: selftests: test_tunnel: Use ping -6 over ping6

2023-11-01 Thread Daniel Xu
The ping6 binary went away over 7 years ago [0]. [0]: https://github.com/iputils/iputils/commit/ebad35fee3de851b809c7b72ccc654a72b6af61d Co-developed-by: Antony Antony Signed-off-by: Antony Antony Signed-off-by: Daniel Xu --- tools/testing/selftests/bpf/test_tunnel.sh | 18 +-

[RFCv2 bpf-next 4/7] bpf: selftests: test_tunnel: Mount bpffs if necessary

2023-11-01 Thread Daniel Xu
Previously, if bpffs was not already mounted, then the test suite would fail during object file pinning steps. Fix by mounting bpffs if necessary. Co-developed-by: Antony Antony Signed-off-by: Antony Antony Signed-off-by: Daniel Xu --- tools/testing/selftests/bpf/test_tunnel.sh | 13 ++

[RFCv2 bpf-next 5/7] bpf: selftests: test_tunnel: Use vmlinux.h declarations

2023-11-01 Thread Daniel Xu
vmlinux.h declarations are more ergnomic, especially when working with kfuncs. The uapi headers are often incomplete for kfunc definitions. Co-developed-by: Antony Antony Signed-off-by: Antony Antony Signed-off-by: Daniel Xu --- .../selftests/bpf/progs/bpf_tracing_net.h | 1 + .../selftes

[RFCv2 bpf-next 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-01 Thread Daniel Xu
Switching to vmlinux.h definitions seems to make the verifier very unhappy with bitfield accesses. The error is: ; md.u.md2.dir = direction; 33: (69) r1 = *(u16 *)(r2 +11) misaligned stack access off (0x0; 0x0)+-64+11 size 2 It looks like disabling CO-RE relocations seem to make the e

[RFCv2 bpf-next 7/7] bpf: xfrm: Add selftest for bpf_xdp_get_xfrm_state()

2023-11-01 Thread Daniel Xu
This commit extends test_tunnel selftest to test the new XDP xfrm state lookup kfunc. Co-developed-by: Antony Antony Signed-off-by: Antony Antony Signed-off-by: Daniel Xu --- .../selftests/bpf/progs/test_tunnel_kern.c| 49 +++ tools/testing/selftests/bpf/test_tunnel.sh|

Re: [GIT PULL] KUnit next update for Linux 6.7-rc1

2023-11-01 Thread pr-tracker-bot
The pull request you sent on Wed, 1 Nov 2023 12:37:36 -0600: > git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest > tags/linux_kselftest-kunit-6.7-rc1 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/5eda8f25377f3d6de697eaa1d9801b9781d09dbc Thank you!

Re: [GIT PULL] Kselftest next update for Linux 6.7-rc1

2023-11-01 Thread pr-tracker-bot
The pull request you sent on Wed, 1 Nov 2023 13:11:31 -0600: > git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest > tags/linux_kselftest-next-6.7-rc1 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/7dc0e9c7dda66bd91eeada00d90033e3eb647fc3 Thank you!

Re: [PATCH bpf v3 0/2] bpf: Fix incorrect immediate spill

2023-11-01 Thread patchwork-bot+netdevbpf
Hello: This series was applied to bpf/bpf.git (master) by Alexei Starovoitov : On Wed, 01 Nov 2023 13:33:50 +0100 you wrote: > 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

Re: [PATCH bpf-next v3 1/2] selftests/bpf: Convert CHECK macros to ASSERT_* macros in bpf_iter

2023-11-01 Thread patchwork-bot+netdevbpf
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov : On Sat, 28 Oct 2023 10:54:13 +0530 you wrote: > As it was pointed out by Yonghong Song [1], in the bpf selftests the use > of the ASSERT_* series of macros is preferred over the CHECK macro. > This patch replaces