From 128cb60f5801e6175ad9090308fae4d909441214 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Fri, 24 Apr 2020 11:25:19 +0200 Subject: [PATCH] ebpf: fix big endian issue for s390x Load the full 32 bits word and take the lower 16 bits, instead of reading just 16 bits. Same fix as https://github.com/containers/crun/commit/07bae05e613df2086966a3f1d763729a8677f6a9 Signed-off-by: Alice Frosi --- libcontainer/cgroups/ebpf/devicefilter/devicefilter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcontainer/cgroups/ebpf/devicefilter/devicefilter.go b/libcontainer/cgroups/ebpf/devicefilter/devicefilter.go index 847ce8ef1..5a1cdd91f 100644 --- a/libcontainer/cgroups/ebpf/devicefilter/devicefilter.go +++ b/libcontainer/cgroups/ebpf/devicefilter/devicefilter.go @@ -49,7 +49,8 @@ func (p *program) init() { */ // R2 <- type (lower 16 bit of u32 access_type at R1[0]) p.insts = append(p.insts, - asm.LoadMem(asm.R2, asm.R1, 0, asm.Half)) + asm.LoadMem(asm.R2, asm.R1, 0, asm.Word), + asm.And.Imm32(asm.R2, 0xFFFF)) // R3 <- access (upper 16 bit of u32 access_type at R1[0]) p.insts = append(p.insts,