[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159595106312.30613.13837748007814593001.stgit@john-Precision-5820-Tower>
Date: Tue, 28 Jul 2020 08:44:23 -0700
From: John Fastabend <john.fastabend@...il.com>
To: john.fastabend@...il.com, kafai@...com, daniel@...earbox.net,
ast@...nel.org
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: [bpf PATCH 3/3] bpf, selftests: Add tests for sock_ops load with r9,
r8.r7 registers
Loads in sock_ops case when using high registers requires extra logic to
ensure the correct temporary value is used. Lets add an asm test to force
the logic is triggered.
The xlated code for the load,
30: (7b) *(u64 *)(r9 +32) = r7
31: (61) r7 = *(u32 *)(r9 +28)
32: (15) if r7 == 0x0 goto pc+2
33: (79) r7 = *(u64 *)(r9 +0)
34: (63) *(u32 *)(r7 +916) = r8
35: (79) r7 = *(u64 *)(r9 +32)
Signed-off-by: John Fastabend <john.fastabend@...il.com>
---
.../testing/selftests/bpf/progs/test_tcpbpf_kern.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
index f8b13682..6420b61 100644
--- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
@@ -75,6 +75,13 @@ int bpf_testcb(struct bpf_sock_ops *skops)
: [skops] "r"(skops)
:);
+ asm volatile (
+ "r9 = %[skops];\n"
+ "r8 = *(u32 *)(r9 +164);\n"
+ "*(u32 *)(r9 +164) = r8;\n"
+ :: [skops] "r"(skops)
+ : "r9", "r8");
+
op = (int) skops->op;
update_event_map(op);
Powered by blists - more mailing lists