selftests/bpf: Fix progs/test_deny_namespace.c issues.
The following build error can be seen:
progs/test_deny_namespace.c:22:19: error: call to undeclared function 'BIT_LL'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
__u64 cap_mask = BIT_LL(CAP_SYS_ADMIN);
The struct kernel_cap_struct no longer exists in the kernel as well.
Adjust bpf prog to fix both issues.
Fixes: f122a08b19
("capability: just use a 'u64' instead of a 'u32[2]' array")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Родитель
32513d40d9
Коммит
e8c8361cfd
|
@ -5,12 +5,10 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
|
|
||||||
struct kernel_cap_struct {
|
typedef struct { unsigned long long val; } kernel_cap_t;
|
||||||
__u64 val;
|
|
||||||
} __attribute__((preserve_access_index));
|
|
||||||
|
|
||||||
struct cred {
|
struct cred {
|
||||||
struct kernel_cap_struct cap_effective;
|
kernel_cap_t cap_effective;
|
||||||
} __attribute__((preserve_access_index));
|
} __attribute__((preserve_access_index));
|
||||||
|
|
||||||
char _license[] SEC("license") = "GPL";
|
char _license[] SEC("license") = "GPL";
|
||||||
|
@ -18,8 +16,8 @@ char _license[] SEC("license") = "GPL";
|
||||||
SEC("lsm.s/userns_create")
|
SEC("lsm.s/userns_create")
|
||||||
int BPF_PROG(test_userns_create, const struct cred *cred, int ret)
|
int BPF_PROG(test_userns_create, const struct cred *cred, int ret)
|
||||||
{
|
{
|
||||||
struct kernel_cap_struct caps = cred->cap_effective;
|
kernel_cap_t caps = cred->cap_effective;
|
||||||
__u64 cap_mask = BIT_LL(CAP_SYS_ADMIN);
|
__u64 cap_mask = 1ULL << CAP_SYS_ADMIN;
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче