]> 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)
commitaacb41c2eeaa9f9750eda94fb1caeeeb70e9d640
treeb8425935d3c9aebeba11671ea58badf599998bd0
parent010393c04ac37dc612a7bbd27fb17b9ae7d4e81c
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