Skip to content

Commit

Permalink
fix: probe environment set to FALCO_BPF_PROBE also at load time
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Fontana <lo@linux.com>
  • Loading branch information
fntlnz committed Feb 18, 2020
1 parent e46641d commit bc52db6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmake/modules/sysdig-repo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ ExternalProject_Add(
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND "")
TEST_COMMAND ""
PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/patch/libscap.patch)
22 changes: 22 additions & 0 deletions cmake/modules/sysdig-repo/patch/libscap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/userspace/libscap/scap.c b/userspace/libscap/scap.c
index 59b04e0a..bdc311cb 100644
--- a/userspace/libscap/scap.c
+++ b/userspace/libscap/scap.c
@@ -52,7 +52,7 @@ limitations under the License.
//#define NDEBUG
#include <assert.h>

-static const char *SYSDIG_BPF_PROBE_ENV = "SYSDIG_BPF_PROBE";
+static const char *SYSDIG_BPF_PROBE_ENV = "FALCO_BPF_PROBE";

//
// Probe version string size
@@ -171,7 +171,7 @@ scap_t* scap_open_live_int(char *error, int32_t *rc,
return NULL;
}

- snprintf(buf, sizeof(buf), "%s/.sysdig/%s-bpf.o", home, PROBE_NAME);
+ snprintf(buf, sizeof(buf), "%s/.falco/%s-bpf.o", home, PROBE_NAME);
bpf_probe = buf;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
# Leave blank for the default probe location, or set to the path
# of a precompiled probe.
# env:
# - name: BPF_PROBE
# - name: FALCO_BPF_PROBE
# value: ""
args: [ "/usr/bin/falco", "--cri", "/host/run/containerd/containerd.sock", "-K", "/var/run/secrets/kubernetes.io/serviceaccount/token", "-k", "https://$(KUBERNETES_SERVICE_HOST)", "-pk"]
volumeMounts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
# Leave blank for the default probe location, or set to the path
# of a precompiled probe.
# env:
# - name: BPF_PROBE
# - name: FALCO_BPF_PROBE
# value: ""
args: [ "/usr/bin/falco", "--cri", "/host/run/containerd/containerd.sock", "-K", "/var/run/secrets/kubernetes.io/serviceaccount/token", "-k", "https://$(KUBERNETES_SERVICE_HOST)", "-pk"]
volumeMounts:
Expand Down
4 changes: 2 additions & 2 deletions scripts/falco-probe-loader
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ load_bpf_probe() {
echo "**********************************************************"
fi

echo "* BPF probe located, it's now possible to start sysdig"
echo "* BPF probe located, it's now possible to start falco"

ln -sf "${HOME}/.falco/${BPF_PROBE_FILENAME}" "${HOME}/.falco/${BPF_PROBE_NAME}.o"
exit $?
Expand Down Expand Up @@ -402,7 +402,7 @@ if ! hash curl > /dev/null 2>&1; then
exit 1
fi

if [ -v BPF_PROBE ] || [ "${1}" = "bpf" ]; then
if [ -v FALCO_BPF_PROBE ] || [ "${1}" = "bpf" ]; then
load_bpf_probe
else
load_kernel_probe
Expand Down

0 comments on commit bc52db6

Please sign in to comment.