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)
commit31379397dcc364a59ce764fabb131b645c43e340
treeb8425935d3c9aebeba11671ea58badf599998bd0
parent3b80d106e110d39d3f678954d3b55078669cf07e
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