Skip to content

Commit

Permalink
Merge branch 's390-bpf-fix-gotol-with-large-offsets'
Browse files Browse the repository at this point in the history
Ilya Leoshkevich says:

====================
s390/bpf: Fix gotol with large offsets

Hi,

While looking at a pyperf180 failure on s390x (must be related to [1],
I'm not done with the investigation yet) I noticed that I have
unfortunately messed up the gotol implementation. Patch 1 is the fix,
patch 2 is a small test infrastructure tweak, and patch 3 adds a
test.

[1] llvm/llvm-project#55669

Best regards,
Ilya
====================

Link: https://lore.kernel.org/r/20240102193531.3169422-1-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Alexei Starovoitov committed Jan 4, 2024
2 parents 98e20e5 + 63fac34 commit 61a40c1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/s390/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,
int i, bool extra_pass, u32 stack_depth)
{
struct bpf_insn *insn = &fp->insnsi[i];
s16 branch_oc_off = insn->off;
s32 branch_oc_off = insn->off;
u32 dst_reg = insn->dst_reg;
u32 src_reg = insn->src_reg;
int last, insn_count = 1;
Expand Down
19 changes: 19 additions & 0 deletions tools/testing/selftests/bpf/progs/verifier_gotol.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ l3_%=: \
: __clobber_all);
}

SEC("socket")
__description("gotol, large_imm")
__success __failure_unpriv __retval(40000)
__naked void gotol_large_imm(void)
{
asm volatile (" \
gotol 1f; \
0: \
r0 = 0; \
.rept 40000; \
r0 += 1; \
.endr; \
exit; \
1: gotol 0b; \
" :
:
: __clobber_all);
}

#else

SEC("socket")
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/test_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define str_has_pfx(str, pfx) \
(strncmp(str, pfx, __builtin_constant_p(pfx) ? sizeof(pfx) - 1 : strlen(pfx)) == 0)

#define TEST_LOADER_LOG_BUF_SZ 1048576
#define TEST_LOADER_LOG_BUF_SZ 2097152

#define TEST_TAG_EXPECT_FAILURE "comment:test_expect_failure"
#define TEST_TAG_EXPECT_SUCCESS "comment:test_expect_success"
Expand Down

0 comments on commit 61a40c1

Please sign in to comment.