]> git.baikalelectronics.ru Git - kernel.git/commit
s390/bpf: Make sure JIT passes do not increase code size
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 14 Nov 2019 15:18:20 +0000 (16:18 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 Nov 2019 21:25:54 +0000 (22:25 +0100)
commitfebdd60dd6d216744d303472b8de17f4f8083bc1
treee9b48ba5045a3f20f17f25feb4ef9ceed227757f
parentc7ad2c55ef30368b89d4786f1a9e471b8cd91299
s390/bpf: Make sure JIT passes do not increase code size

The upcoming s390 branch length extension patches rely on "passes do
not increase code size" property in order to consistently choose between
short and long branches. Currently this property does not hold between
the first and the second passes for register save/restore sequences, as
well as various code fragments that depend on SEEN_* flags.

Generate the code during the first pass conservatively: assume register
save/restore sequences have the maximum possible length, and that all
SEEN_* flags are set.

Also refuse to JIT if this happens anyway (e.g. due to a bug), as this
might lead to verifier bypass once long branches are introduced.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191114151820.53222-1-iii@linux.ibm.com
arch/s390/net/bpf_jit_comp.c