Skip to content

Commit 07bae05

Browse files
committed
ebpf: fix endianess issue on s390x
load the full 32 bits word and take the lower 16 bits, instead of reading just 16 bits. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent a7252b7 commit 07bae05

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/libcrun/ebpf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ bpf_program_init_dev (struct bpf_program *program, libcrun_error_t *err arg_unus
158158
/* taken from systemd. */
159159
struct bpf_insn pre_insn[] = {
160160
/* type -> R2. */
161-
BPF_LDX_MEM (BPF_H, BPF_REG_2, BPF_REG_1, 0),
161+
BPF_LDX_MEM (BPF_W, BPF_REG_2, BPF_REG_1, 0),
162+
BPF_ALU32_IMM(BPF_AND, BPF_REG_2, 0xFFFF),
162163

163164
/* access -> R3. */
164165
BPF_LDX_MEM (BPF_W, BPF_REG_3, BPF_REG_1, 0),

0 commit comments

Comments
 (0)