Files
linux/include/uapi/linux
Kui-Feng Lee fcc2c1fb06 bpf: pass attached BTF to the bpf_struct_ops subsystem
Pass the fd of a btf from the userspace to the bpf() syscall, and then
convert the fd into a btf. The btf is generated from the module that
defines the target BPF struct_ops type.

In order to inform the kernel about the module that defines the target
struct_ops type, the userspace program needs to provide a btf fd for the
respective module's btf. This btf contains essential information on the
types defined within the module, including the target struct_ops type.

A btf fd must be provided to the kernel for struct_ops maps and for the bpf
programs attached to those maps.

In the case of the bpf programs, the attach_btf_obj_fd parameter is passed
as part of the bpf_attr and is converted into a btf. This btf is then
stored in the prog->aux->attach_btf field. Here, it just let the verifier
access attach_btf directly.

In the case of struct_ops maps, a btf fd is passed as value_type_btf_obj_fd
of bpf_attr. The bpf_struct_ops_map_alloc() function converts the fd to a
btf and stores it as st_map->btf. A flag BPF_F_VTYPE_BTF_OBJ_FD is added
for map_flags to indicate that the value of value_type_btf_obj_fd is set.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Link: https://lore.kernel.org/r/20240119225005.668602-9-thinker.li@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
2024-01-23 16:37:44 -08:00
..
2023-05-14 16:05:28 +01:00
2021-01-25 18:44:44 +01:00
2023-05-30 15:20:08 +01:00
2024-01-02 12:41:16 +00:00
2021-11-01 13:36:08 +00:00
2022-08-11 10:31:19 -07:00
2022-06-07 10:20:42 -07:00
2021-11-26 16:48:59 +01:00
2023-12-07 12:44:19 -08:00
2023-01-20 09:33:22 +00:00
2023-03-06 15:49:07 -06:00
2023-09-24 18:17:31 -07:00
2020-07-19 19:20:22 -07:00
2022-04-04 08:55:23 +02:00
2023-03-16 21:20:32 -07:00
2023-09-21 19:22:05 +02:00
2022-08-10 13:49:50 +01:00
2021-02-08 13:01:24 +01:00
2023-10-24 12:02:02 +02:00
2021-11-15 07:53:10 -08:00
2021-06-03 15:31:34 -07:00
2020-04-20 12:43:24 -07:00
2022-09-20 09:13:38 +02:00
2021-03-10 09:34:06 +01:00
2023-12-15 17:01:30 +01:00
2023-06-09 16:25:16 -07:00
2023-12-14 11:49:17 +01:00
2023-04-27 19:15:11 -06:00
2022-09-07 16:46:03 +02:00
2023-11-28 19:05:16 +00:00
2023-10-28 13:31:05 -05:00
2023-12-20 19:26:31 -05:00
2020-03-29 22:30:57 -07:00
2023-11-18 14:56:16 +01:00
2023-10-27 10:35:46 +01:00
2022-11-17 11:04:23 -08:00
2021-01-07 16:17:32 +01:00
2022-09-27 17:29:09 -07:00
2023-06-05 09:36:35 +02:00
2020-03-29 23:29:08 +02:00
2023-12-29 11:58:24 -08:00
2023-03-23 17:25:46 +01:00
2021-06-12 13:16:45 -07:00
2020-07-13 15:32:56 -07:00