bpf: Support doubleword alignment in bpf_jit_binary_alloc
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 15 Nov 2019 12:37:22 +0000 (13:37 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 Nov 2019 21:25:00 +0000 (22:25 +0100)
commitb7b3fc8dd95bc02bd30680da258e09dda55270db
treef495c80bad776b25b2734b3257f6906de6b9365d
parente47a179997ceee6864fbae620eee09ea9c345a4d
bpf: Support doubleword alignment in bpf_jit_binary_alloc

Currently passing alignment greater than 4 to bpf_jit_binary_alloc does
not work: in such cases it silently aligns only to 4 bytes.

On s390, in order to load a constant from memory in a large (>512k) BPF
program, one must use lgrl instruction, whose memory operand must be
aligned on an 8-byte boundary.

This patch makes it possible to request 8-byte alignment from
bpf_jit_binary_alloc, and also makes it issue a warning when an
unsupported alignment is requested.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191115123722.58462-1-iii@linux.ibm.com
include/linux/filter.h
kernel/bpf/core.c