linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Perf test 42.2 (BPF relocation checker) failure
@ 2021-03-10 15:19 Thomas Richter
  0 siblings, 0 replies; only message in thread
From: Thomas Richter @ 2021-03-10 15:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, wangnan0; +Cc: linux-perf-use., daniel, iii

Hi all


I observe that the perf test 42.4 (BPF relocation checker)
fails for quite some time now on s390 and on x86.
I have not tested other architectures.

I investigated this and Ilya found a commit in the kernel, released with
version 5.10:

commit d859900c4c56 ("bpf, libbpf: support global data/bss/rodata sections")

Bpf code relocation with global variables is now supported.

The test 42.4 returns FAILED, because it assumes in function __test_bpf()
that the function call to prepare_bpf() returns NULL. But with above
kernel commit it returns a valid object pointer.

My question is:
Should we keep this test? It looks like this test is now obsolete, since
the kernel bpf code now accepts global variables.

Should we make the test work? Then we have to change the bpf code.
I am no BPF export but Ilya explained it to me:

The BPF-verifier in the kernel rejects the BPF byte code.
A wrong map pointer is passed to bpf_map_update_elem. Maps should be
loaded by file descriptors (there is a special opcode for that).
In this case they just take a global var address as a map.

libbpf: -- BEGIN DUMP LOG ---
libbpf:
0: (b7) r1 = 0
1: (63) *(u32 *)(r10 -4) = r1
last_idx 1 first_idx 0
regs=2 stack=0 before 0: (b7) r1 = 0
2: (63) *(u32 *)(r10 -8) = r1
3: (bf) r2 = r10
4: (07) r2 += -4
5: (bf) r3 = r10
6: (07) r3 += -8
7: (18) r1 = 0x3800066e000
9: (b7) r4 = 0
10: (85) call bpf_map_update_elem#2
R1 type=map_value expected=map_ptr  <<<-----------BPF verifier error reason
processed 10 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

libbpf: -- END LOG --
libbpf: failed to load program 'bpf_func__ksys_write' --> I changed this to get it to work to that point
libbpf: failed to load object '[bpf_relocation_test]'
bpf: load objects failed: err=-4007: (Kernel verifier blocks program loading)
Failed to add events selected by BPF


So what direction should we proceed? Remove the test or make it work somehow?

Thanks a lot.
-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-10 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 15:19 Perf test 42.2 (BPF relocation checker) failure Thomas Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).