Skip to content

Commit

Permalink
ebpf: fix endianess issue on s390x
Browse files Browse the repository at this point in the history
load the full 32 bits word and take the lower 16 bits, instead of
reading just 16 bits.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Feb 19, 2020
1 parent a7252b7 commit 07bae05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libcrun/ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ bpf_program_init_dev (struct bpf_program *program, libcrun_error_t *err arg_unus
/* taken from systemd. */
struct bpf_insn pre_insn[] = {
/* type -> R2. */
BPF_LDX_MEM (BPF_H, BPF_REG_2, BPF_REG_1, 0),
BPF_LDX_MEM (BPF_W, BPF_REG_2, BPF_REG_1, 0),
BPF_ALU32_IMM(BPF_AND, BPF_REG_2, 0xFFFF),

/* access -> R3. */
BPF_LDX_MEM (BPF_W, BPF_REG_3, BPF_REG_1, 0),
Expand Down

0 comments on commit 07bae05

Please sign in to comment.