Skip to content

Commit 14d8435

Browse files
liu-song-6Alexei Starovoitov
authored andcommitted
selftests/bpf: Fix verifier_bpf_fastcall test
Commit [1] moves percpu data on x86 from address 0x000... to address 0xfff... Before [1]: 159020: 0000000000030700 0 OBJECT GLOBAL DEFAULT 23 pcpu_hot After [1]: 152602: ffffffff83a3e034 4 OBJECT GLOBAL DEFAULT 35 pcpu_hot As a result, verifier_bpf_fastcall tests should now expect a negative value for pcpu_hot, IOW, the disassemble should show "r=" instead of "w=". Fix this in the test. Note that, a later change created a new variable "cpu_number" for bpf_get_smp_processor_id() [2]. The inlining logic is updated properly as part of this change, so there is no need to fix anything on the kernel side. [1] commit 9d7de2a ("x86/percpu/64: Use relative percpu offsets") [2] commit 01c7bc5 ("x86/smp: Move cpu number to percpu hot section") Reported-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20250328193124.808784-1-song@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 0038780 commit 14d8435

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/progs/verifier_bpf_fastcall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SEC("raw_tp")
1212
__arch_x86_64
1313
__log_level(4) __msg("stack depth 8")
1414
__xlated("4: r5 = 5")
15-
__xlated("5: w0 = ")
15+
__xlated("5: r0 = ")
1616
__xlated("6: r0 = &(void __percpu *)(r0)")
1717
__xlated("7: r0 = *(u32 *)(r0 +0)")
1818
__xlated("8: exit")
@@ -704,7 +704,7 @@ SEC("raw_tp")
704704
__arch_x86_64
705705
__log_level(4) __msg("stack depth 32+0")
706706
__xlated("2: r1 = 1")
707-
__xlated("3: w0 =")
707+
__xlated("3: r0 =")
708708
__xlated("4: r0 = &(void __percpu *)(r0)")
709709
__xlated("5: r0 = *(u32 *)(r0 +0)")
710710
/* bpf_loop params setup */
@@ -753,7 +753,7 @@ __arch_x86_64
753753
__log_level(4) __msg("stack depth 40+0")
754754
/* call bpf_get_smp_processor_id */
755755
__xlated("2: r1 = 42")
756-
__xlated("3: w0 =")
756+
__xlated("3: r0 =")
757757
__xlated("4: r0 = &(void __percpu *)(r0)")
758758
__xlated("5: r0 = *(u32 *)(r0 +0)")
759759
/* call bpf_get_prandom_u32 */

0 commit comments

Comments
 (0)