From: Zbigniew Jędrzejewski-Szmek Date: Sat, 9 Nov 2019 11:34:30 +0000 (+0100) Subject: bpf: add trace logging X-Git-Tag: v244-rc1~62^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=786cce009978a7f7ffd7cdff45a3339c373077d6;p=thirdparty%2Fsystemd.git bpf: add trace logging Very helpful when trying to figure out what exactly is going on. --- diff --git a/src/core/bpf-devices.c b/src/core/bpf-devices.c index 49c8456597d..c94b9353a3c 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 */