Problems with execsnoop on Ubuntu 17.04 Zesty
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 3
Description
I'm attempting bcc install for first time on Ubuntu 17.04 Zesty.
```
$ sudo apt-get install bpfcc-tools
$ sudo apt-get install linux-headers-$(uname -r)
$ uname -a
Linux unbuntu-vm 4.10.0-28-generic #32-Ubuntu SMP Fri Jun 30 05:32:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ grep _BPF /boot/config-$(uname -r)
CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_BPF_EVENTS=y
CONFIG_TEST_BPF=m
```
I had to make some symlinks:
```
$ sudo ln -s /lib/modules/linux-headers-4.10.0-28-generic/kernel /lib/modules/linux-headers-4.10.0-28-generic/source
$ sudo ln -s /usr/src/linux-headers-4.10.0-28-generic /lib/modules/linux-headers-4.10.0-28-generic/kernel/include
```
..and then I seemed to get the HelloWorld to work:
```
$ cd /usr/share/doc/bpfcc-tools/examples
$ sudo python ./hello_world.py
bamfdaemon-1539 [000] d... 13637.914022: : Hello, World!
gpg-agent-2064 [000] d... 13658.198167: : Hello, World!
gpg-agent-2064 [000] d... 13658.198301: : Hello, World!
bamfdaemon-1539 [000] d... 13721.087705: : Hello, World!
```
But i'm not having any joy with execsnoop:
```
$ sudo /usr/sbin/execsnoop-bpfcc
In file included from /virtual/main.c:3:
In file included from /lib/modules/4.10.0-28-generic/build/include/linux/sched.h:61:
In file included from /lib/modules/4.10.0-28-generic/build/include/linux/cgroup-defs.h:19:
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:22:24: error: use
of undeclared identifier 'MAX_BPF_ATTACH_TYPE'
struct bpf_prog *prog[MAX_BPF_ATTACH_TYPE];
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:23:35: error: use
of undeclared identifier 'MAX_BPF_ATTACH_TYPE'
struct bpf_prog __rcu *effective[MAX_BPF_ATTACH_TYPE];
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:24:25: error: use
of undeclared identifier 'MAX_BPF_ATTACH_TYPE'
bool disallow_override[MAX_BPF_ATTACH_TYPE];
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:31:32: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
struct bpf_prog *prog, enum bpf_attach_type type,
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:36:14: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
enum bpf_attach_type type, bool overridable);
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:40:10: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
enum bpf_attach_type type);
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:43:16: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
enum bpf_attach_type type);
^
In file included from /virtual/main.c:4:
/lib/modules/4.10.0-28-generic/build/include/linux/fs.h:2659:9: warning:
comparison of unsigned enum expression < 0 is always false
[-Wtautological-compare]
if (id < 0 || id >= READING_MAX_ID)
~~ ^ ~
5 warnings and 3 errors generated.
Traceback (most recent call last):
File "/usr/sbin/execsnoop-bpfcc", line 143, in
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 197, in __init__
raise Exception("Failed to compile BPF module %s" % src_file)
Exception: Failed to compile BPF module
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The failing entry point is /usr/sbin/execsnoop-bpfcc, which compiles BPF code against the 4.10.0-28-generic headers; first reproduce the MAX_BPF_ATTACH_TYPE errors on Ubuntu 17.04 and compare them with the working hello_world.py example. Trace how execsnoop constructs and compiles its BPF program, then verify that execsnoop starts successfully on the reported kernel or that the compatibility limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux, python, ubuntu
- Domain
- devtools, observability, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100