]> git.ipfire.org Git - thirdparty/systemd.git/commit
bpf: fix restrict_fs on s390x
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 30 Jan 2023 20:21:48 +0000 (21:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 31 Jan 2023 11:23:16 +0000 (12:23 +0100)
commit907046282c27ee2ced5e22abb80ed8df2e157baf
treed435daf155354ea7a9025d5e69279c9d2f13955f
parent181eea677dd364d2b22dc691647792142b271074
bpf: fix restrict_fs on s390x

Linux kernel's bpf-next contains BPF LSM support for s390x. systemd's
test-bpf-lsm currently fails with this kernel.

This is an endianness issue: in the restrict_fs bpf program,
magic_number has type unsigned long (64 bits on s390x), but magic_map
keys are uint32_t (32 bits). Accessing magic_map using 64-bit keys may
work by accident on little-endian systems, but fails hard on big-endian
ones.

Fix by casting magic_number to uint32_t.
src/core/bpf/restrict_fs/restrict-fs.bpf.c