Skip to contentSkip to conversation

samples/bpf: Fix test_map_in_map on s390

PATCH RESEND Applied Ilya Leoshkevich 4 participants 4 messages Sep 16, 2020 – Sep 18, 2020 BPF

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 samples/bpf: Fix test_map_in_map on s390

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.

---

Previous discussion:
https://lore.kernel.org/bpf/[email protected]

samples/bpf/test_map_in_map_kern.c | 7 +++----

 1 file changed, 3 insertions(+), 4 deletions(-)
samples/bpf/test_map_in_map_kern.c +3 -4
index 8def45c5b697..b0200c8eac09 100644
@@ -103,10 +103,9 @@ 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;
@@ -114,8 +113,8 @@ int trace_sys_connect(struct pt_regs *ctx)
 	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;
Signature · 1 line
2.25.4
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Ilya Leoshkevich

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.

---

LGTM.

Quoted 6 lines

Previous discussion:
https://lore.kernel.org/bpf/[email protected]

samples/bpf/test_map_in_map_kern.c | 7 +++----

 1 file changed, 3 insertions(+), 4 deletions(-)

[...]

reviewer Acked-by
#2 lore raw
Quoted 7 lines · Andrii Nakryiko
Quoted 5 lines · Ilya Leoshkevich

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.

Quoted 7 lines
Quoted 3 lines

---

LGTM.