]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Forbid trampoline attach for functions with variable arguments
authorJiri Olsa <jolsa@kernel.org>
Wed, 5 May 2021 13:25:29 +0000 (15:25 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 6 May 2021 23:28:28 +0000 (01:28 +0200)
commitdf3b4a757b83ef7a4b3811b78fea4fd3aa24eb19
treeb8425935d3c9aebeba11671ea58badf599998bd0
parent333ec9616b7d97d90dbeafae14b4038f6155970a
bpf: Forbid trampoline attach for functions with variable arguments

We can't currently allow to attach functions with variable arguments.
The problem is that we should save all the registers for arguments,
which is probably doable, but if caller uses more than 6 arguments,
we need stack data, which will be wrong, because of the extra stack
frame we do in bpf trampoline, so we could crash.

Also currently there's malformed trampoline code generated for such
functions at the moment as described in:

  https://lore.kernel.org/bpf/20210429212834.82621-1-jolsa@kernel.org/

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210505132529.401047-1-jolsa@kernel.org
kernel/bpf/btf.c