All of lore.kernel.org
 help / color / mirror / Atom feed
* Failure in test_local_storage at bpf-next
@ 2020-10-07  0:27 KP Singh
  2020-10-07  1:23 ` Andrii Nakryiko
  0 siblings, 1 reply; 8+ messages in thread
From: KP Singh @ 2020-10-07  0:27 UTC (permalink / raw)
  To: bpf; +Cc: Andrii Nakryiko, Daniel Borkmann, Alexei Starovoitov

I noticed that test_local_storage is broken due to a BTF error at
bpf-next [67ed375530e2 ("samples: bpf: Driver interrupt statistics in
xdpsock")]

./test_progs -t test_local_storage
libbpf: prog 'socket_post_create': relo #0: parsing [28] struct socket + 0:0.1 2
libbpf: prog 'socket_post_create': relo #0: failed to relocate: -22
libbpf: failed to perform CO-RE relocations: -22
libbpf: failed to load object 'local_storage'
libbpf: failed to load BPF skeleton 'local_storage': -22
test_test_local_storage:FAIL:skel_load lsm skeleton failed

by changing it to use vmlinux.h with:

diff --git a/tools/testing/selftests/bpf/progs/local_storage.c b/tools/testing/>
index 0758ba229ae0..95fad5aca6af 100644
--- a/tools/testing/selftests/bpf/progs/local_storage.c
+++ b/tools/testing/selftests/bpf/progs/local_storage.c
@@ -4,9 +4,8 @@
  * Copyright 2020 Google LLC.
  */

+#include "vmlinux.h"
 #include <errno.h>
-#include <linux/bpf.h>
-#include <stdbool.h>
 #include <bpf/bpf_helpers.h>
 #include <bpf/bpf_tracing.h>

@@ -36,23 +35,6 @@ struct {
        __type(value, struct dummy_storage);
 } sk_storage_map SEC(".maps");

-/* TODO Use vmlinux.h once BTF pruning for embedded types is fixed.
- */
-struct sock {} __attribute__((preserve_access_index));
-struct sockaddr {} __attribute__((preserve_access_index));
-struct socket {
-       struct sock *sk;
-} __attribute__((preserve_access_index));
-
-struct inode {} __attribute__((preserve_access_index));
-struct dentry {
-       struct inode *d_inode;
-} __attribute__((preserve_access_index));
-struct file {
-       struct inode *f_inode;
-} __attribute__((preserve_access_index));
-
-
 SEC("lsm/inode_unlink")
 int BPF_PROG(unlink_hook, struct inode *dir, struct dentry *victim)
 {

I get a very similar error:

root@kpsingh:~# ./test_progs -t test_local_storage
libbpf: prog 'socket_post_create': relo #0: parsing [83] struct socket + 0:4.1 2
libbpf: prog 'socket_post_create': relo #0: failed to relocate: -22
libbpf: failed to perform CO-RE relocations: -22
libbpf: failed to load object 'local_storage'
libbpf: failed to load BPF skeleton 'local_storage': -22
test_test_local_storage:FAIL:skel_load lsm skeleton failed
#106 test_local_storage:FAIL
Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED

clang --version
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
6c7d713cf5d9bb188f1e73452a256386f0288bf7)
Target: x86_64-unknown-linux-gnu
Thread model: posix

pahole --version
v1.18

This error goes away if I comment out the lsm/socket_post_create or
the lsm/socket_bind which makes me think that something in
bpf_core_apply_relo does not like two programs in the same object
having the same BTF type in its signature (but this just a guess, I
did not investigate more).  I was wondering if anyone has any ideas
what could be going on here.

PS: While working on task local storage, I noted that some of the
checks in this test were buggy and will send a patch to fix them as
well.

- KP

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-07 22:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07  0:27 Failure in test_local_storage at bpf-next KP Singh
2020-10-07  1:23 ` Andrii Nakryiko
2020-10-07  4:31   ` Yonghong Song
2020-10-07  4:44     ` Andrii Nakryiko
2020-10-07  5:18     ` Alexei Starovoitov
2020-10-07  5:33       ` Yonghong Song
2020-10-07 22:04         ` KP Singh
2020-10-07 22:07           ` KP Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.