From 05f7e38f9d1d6198a80b982a8b38fc15156e9ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Wed, 21 Apr 2021 20:49:31 +0200 Subject: [PATCH] ebpf: added patch to compile ebpf module for arm --- ebpf_prog/README | 12 +++++++++++- ebpf_prog/arm-clang-asm-fix.patch | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 ebpf_prog/arm-clang-asm-fix.patch diff --git a/ebpf_prog/README b/ebpf_prog/README index 08d930c0..119ea487 100644 --- a/ebpf_prog/README +++ b/ebpf_prog/README @@ -16,4 +16,14 @@ cd ../../../daemon --opensnitchd expects to find opensnitch.o in /etc/opensnitchd/ --start opensnitchd with: -opensnitchd -rules-path /etc/opensnitchd/rules -process-monitor-method ebpf \ No newline at end of file +opensnitchd -rules-path /etc/opensnitchd/rules -process-monitor-method ebpf + +The kernel where you intend to run it must have some options activated: + +$ grep BPF /boot/config-$(uname -r) +CONFIG_CGROUP_BPF=y +CONFIG_BPF=y +CONFIG_BPF_SYSCALL=y +CONFIG_BPF_EVENTS=y +CONFIG_KPROBES=y +CONFIG_KPROBE_EVENTS=y diff --git a/ebpf_prog/arm-clang-asm-fix.patch b/ebpf_prog/arm-clang-asm-fix.patch new file mode 100644 index 00000000..d8dd3945 --- /dev/null +++ b/ebpf_prog/arm-clang-asm-fix.patch @@ -0,0 +1,14 @@ +--- ../../arch/arm/include/asm/unified.h 2021-04-20 10:47:54.075834124 +0000 ++++ ../../arch/arm/include/asm/unified-clang-fix.h 2021-04-20 10:47:38.943811970 +0000 +@@ -11,7 +11,10 @@ + #if defined(__ASSEMBLY__) + .syntax unified + #else +-__asm__(".syntax unified"); ++//__asm__(".syntax unified"); ++#ifndef __clang__ ++ __asm__(".syntax unified"); ++#endif + #endif + + #ifdef CONFIG_CPU_V7M