From 786cce009978a7f7ffd7cdff45a3339c373077d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 9 Nov 2019 12:34:30 +0100 Subject: [PATCH] bpf: add trace logging Very helpful when trying to figure out what exactly is going on. --- src/core/bpf-devices.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/bpf-devices.c b/src/core/bpf-devices.c index 49c8456597..c94b9353a3 100644 --- a/src/core/bpf-devices.c +++ b/src/core/bpf-devices.c @@ -44,6 +44,8 @@ static int bpf_prog_whitelist_device(BPFProgram *prog, int type, int major, int assert(prog); assert(acc); + log_trace("%s: %c %d:%d %s", __func__, type, major, minor, acc); + access = bpf_access_type(acc); if (access <= 0) return -EINVAL; @@ -71,6 +73,8 @@ static int bpf_prog_whitelist_major(BPFProgram *prog, int type, int major, const assert(prog); assert(acc); + log_trace("%s: %c %d:* %s", __func__, type, major, acc); + access = bpf_access_type(acc); if (access <= 0) return -EINVAL; @@ -97,6 +101,8 @@ static int bpf_prog_whitelist_class(BPFProgram *prog, int type, const char *acc) assert(prog); assert(acc); + log_trace("%s: %c *:* %s", __func__, type, acc); + access = bpf_access_type(acc); if (access <= 0) return -EINVAL; @@ -323,6 +329,8 @@ int bpf_devices_whitelist_device(BPFProgram *prog, const char *path, const char assert(acc); assert(strlen(acc) <= 3); + log_trace("%s: %s %s", __func__, node, acc); + /* Some special handling for /dev/block/%u:%u, /dev/char/%u:%u, /run/systemd/inaccessible/chr and * /run/systemd/inaccessible/blk paths. Instead of stat()ing these we parse out the major/minor directly. This * means clients can use these path without the device node actually around */