]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 15 Jul 2021 17:23:50 +0000 (19:23 +0200)
commit0bedf2dec2f7bb9c1209f6139ab0335133504c7c
treed7e759dfba8ce9960c30c17110c28d47e4ad5922
parentb7c45d15803c6612910667949ea3593245fe6e54
bpf: Forbid trampoline attach for functions with variable arguments

BugLink: https://bugs.launchpad.net/bugs/1934012
[ Upstream commit 31379397dcc364a59ce764fabb131b645c43e340 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
kernel/bpf/btf.c