Failure in test_local_storage at bpf-next

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux