bpf: fix device type filter
On big endian arches, we were taking the wrong half-word, so the check was giving bogus results. https://bugzilla.redhat.com/show_bug.cgi?id=1769148.
This commit is contained in:
@@ -125,8 +125,9 @@ static int bpf_prog_whitelist_class(BPFProgram *prog, int type, const char *acc)
|
||||
int bpf_devices_cgroup_init(BPFProgram **ret, CGroupDevicePolicy policy, bool whitelist) {
|
||||
const struct bpf_insn pre_insn[] = {
|
||||
/* load device type to r2 */
|
||||
BPF_LDX_MEM(BPF_H, BPF_REG_2, BPF_REG_1,
|
||||
BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
|
||||
offsetof(struct bpf_cgroup_dev_ctx, access_type)),
|
||||
BPF_ALU32_IMM(BPF_AND, BPF_REG_2, 0xFFFF),
|
||||
|
||||
/* load access type to r3 */
|
||||
BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
|
||||
|
||||
Reference in New Issue
Block a user