]> git.itanic.dy.fi Git - linux-stable/commit
bpf: Do not use ax register in interpreter on div/mod
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 27 Aug 2021 13:55:31 +0000 (10:55 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Sep 2021 07:58:00 +0000 (09:58 +0200)
commitc348d806ed1d3075af52345344243824d72c4945
tree9046375af505fdb243412550f9ca86d1ea11006c
parentce7d8be2eaa4cab3032e256d154d1c33843d2367
bpf: Do not use ax register in interpreter on div/mod

Partially undo old commit 144cd91c4c2b ("bpf: move tmp variable into ax
register in interpreter"). The reason we need this here is because ax
register will be used for holding temporary state for div/mod instruction
which otherwise interpreter would corrupt. This will cause a small +8 byte
stack increase for interpreter, but with the gain that we can use it from
verifier rewrites as scratch register.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
[cascardo: This partial revert is needed in order to support using AX for
the following two commits, as there is no JMP32 on 4.19.y]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/core.c