Skip to content

Commit

Permalink
samples/bpf: Fix test_map_in_map on s390
Browse files Browse the repository at this point in the history
s390 uses socketcall multiplexer instead of individual socket syscalls.
Therefore, "kprobe/" SYSCALL(sys_connect) does not trigger and
test_map_in_map fails. Fix by using "kprobe/__sys_connect" instead.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200915115519.3769807-1-iii@linux.ibm.com
  • Loading branch information
iii-i authored and borkmann committed Sep 18, 2020
1 parent fec47bb commit f55f4c3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions samples/bpf/test_map_in_map_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,18 @@ static __always_inline int do_inline_hash_lookup(void *inner_map, u32 port)
return result ? *result : -ENOENT;
}

SEC("kprobe/" SYSCALL(sys_connect))
SEC("kprobe/__sys_connect")
int trace_sys_connect(struct pt_regs *ctx)
{
struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx);
struct sockaddr_in6 *in6;
u16 test_case, port, dst6[8];
int addrlen, ret, inline_ret, ret_key = 0;
u32 port_key;
void *outer_map, *inner_map;
bool inline_hash = false;

in6 = (struct sockaddr_in6 *)PT_REGS_PARM2_CORE(real_regs);
addrlen = (int)PT_REGS_PARM3_CORE(real_regs);
in6 = (struct sockaddr_in6 *)PT_REGS_PARM2_CORE(ctx);
addrlen = (int)PT_REGS_PARM3_CORE(ctx);

if (addrlen != sizeof(*in6))
return 0;
Expand Down

0 comments on commit f55f4c3

Please sign in to comment.