Thread (43 messages) 43 messages, 2 authors, 2021-07-29

Re: [PATCH 01/14] bpf/tests: Add BPF_JMP32 test cases

From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Date: 2021-07-29 21:30:55
Also in: netdev

On Thu, Jul 29, 2021 at 12:31 AM Yonghong Song [off-list ref] wrote:
quoted
+     /* BPF_JMP32 | BPF_JGT | BPF_X */
+     {
+             "JMP32_JGT_X",
+             .u.insns_int = {
+                     BPF_ALU32_IMM(BPF_MOV, R0, 0xfffffffe),
+                     BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
+                     BPF_JMP32_REG(BPF_JGT, R0, R1, 1),
Maybe change the offset from 1 to 2? Otherwise, this may jump to
   BPF_JMP32_REG(BPF_JGT, R0, R1, 1)
which will just do the same comparison and jump to BTT_EXIT_INSN()
which will also have R0 = 0xfffffffe at the end.
You are right. All BPF_X versions should have the first jump offset
incremented by one to account for the extra MOV that is not present in
the BPF_K version of the test. I'll correct it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help