Bpfloader - minimal fs_bpf_loader support

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8090de18b50a717f77d3fddab62a611888aa1521
This commit is contained in:
Maciej Żenczykowski 2022-12-02 13:46:53 +00:00
parent 90a866ed34
commit 9a2093d38c
2 changed files with 6 additions and 2 deletions

View file

@ -30,9 +30,9 @@
#include <sys/wait.h>
#include <unistd.h>
// This is BpfLoader v0.29
// This is BpfLoader v0.30
#define BPFLOADER_VERSION_MAJOR 0u
#define BPFLOADER_VERSION_MINOR 29u
#define BPFLOADER_VERSION_MINOR 30u
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
#include "bpf/BpfUtils.h"
@ -87,6 +87,7 @@ constexpr const char* lookupSelinuxContext(const domain d, const char* const uns
case domain::netd_readonly: return "fs_bpf_netd_readonly";
case domain::netd_shared: return "fs_bpf_netd_shared";
case domain::vendor: return "fs_bpf_vendor";
case domain::loader: return "fs_bpf_loader";
default: return "(unrecognized)";
}
}
@ -118,6 +119,7 @@ constexpr const char* lookupPinSubdir(const domain d, const char* const unspecif
case domain::netd_readonly: return "netd_readonly/";
case domain::netd_shared: return "netd_shared/";
case domain::vendor: return "vendor/";
case domain::loader: return "loader/";
default: return "(unrecognized)";
}
};

View file

@ -45,6 +45,7 @@ enum class domain : int {
netd_readonly, // (T+) fs_bpf_netd_readonly /sys/fs/bpf/netd_readonly
netd_shared, // (T+) fs_bpf_netd_shared /sys/fs/bpf/netd_shared
vendor, // (T+) fs_bpf_vendor /sys/fs/bpf/vendor
loader, // (U+) fs_bpf_loader /sys/fs/bpf/loader
};
// Note: this does not include domain::unrecognized, but does include domain::unspecified
@ -57,6 +58,7 @@ static constexpr domain AllDomains[] = {
domain::netd_readonly,
domain::netd_shared,
domain::vendor,
domain::loader,
};
static constexpr bool unrecognized(domain d) {