Andrii Nakryiko d384dce281 bpf: Fix global subprog context argument resolution logic
KPROBE program's user-facing context type is defined as typedef
bpf_user_pt_regs_t. This leads to a problem when trying to passing
kprobe/uprobe/usdt context argument into global subprog, as kernel
always strip away mods and typedefs of user-supplied type, but takes
expected type from bpf_ctx_convert as is, which causes mismatch.

Current way to work around this is to define a fake struct with the same
name as expected typedef:

  struct bpf_user_pt_regs_t {};

  __noinline my_global_subprog(struct bpf_user_pt_regs_t *ctx) { ... }

This patch fixes the issue by resolving expected type, if it's not
a struct. It still leaves the above work-around working for backwards
compatibility.

Fixes: 91cc1a99740e ("bpf: Annotate context types")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20230216045954.3002473-2-andrii@kernel.org
2023-02-17 21:20:44 +01:00
..
2023-02-10 17:51:27 -08:00
2022-12-02 11:25:00 +01:00
2022-12-21 14:31:52 -08:00
2023-02-05 11:52:23 -08:00
2023-01-28 00:00:14 -08:00
2022-12-21 07:59:57 -08:00
2023-02-10 17:51:27 -08:00
2022-08-29 19:47:03 -04:00
2022-01-11 13:08:21 -08:00
2022-09-26 10:13:13 -07:00
2022-12-17 14:06:53 -06:00
2022-11-15 00:42:02 -08:00
2022-12-23 12:00:24 -08:00
2022-12-19 12:33:32 -06:00
2022-12-23 12:00:24 -08:00
2022-12-16 03:54:54 -08:00
2022-06-29 13:07:16 +02:00
2022-12-16 03:54:54 -08:00
2022-12-14 12:20:00 -08:00
2022-10-10 12:49:34 -07:00
2022-02-25 09:36:06 +01:00
2022-12-13 19:29:45 -08:00
2022-08-06 16:38:17 -07:00