Files
android_kernel_xiaomi_sm8450/include/uapi/linux
Yonghong Song 5e7b30205c bpf: Change uapi for bpf iterator map elements
Commit a5cbe05a66 ("bpf: Implement bpf iterator for
map elements") added bpf iterator support for
map elements. The map element bpf iterator requires
info to identify a particular map. In the above
commit, the attr->link_create.target_fd is used
to carry map_fd and an enum bpf_iter_link_info
is added to uapi to specify the target_fd actually
representing a map_fd:
    enum bpf_iter_link_info {
	BPF_ITER_LINK_UNSPEC = 0,
	BPF_ITER_LINK_MAP_FD = 1,

	MAX_BPF_ITER_LINK_INFO,
    };

This is an extensible approach as we can grow
enumerator for pid, cgroup_id, etc. and we can
unionize target_fd for pid, cgroup_id, etc.
But in the future, there are chances that
more complex customization may happen, e.g.,
for tasks, it could be filtered based on
both cgroup_id and user_id.

This patch changed the uapi to have fields
	__aligned_u64	iter_info;
	__u32		iter_info_len;
for additional iter_info for link_create.
The iter_info is defined as
	union bpf_iter_link_info {
		struct {
			__u32   map_fd;
		} map;
	};

So future extension for additional customization
will be easier. The bpf_iter_link_info will be
passed to target callback to validate and generic
bpf_iter framework does not need to deal it any
more.

Note that map_fd = 0 will be considered invalid
and -EBADF will be returned to user space.

Fixes: a5cbe05a66 ("bpf: Implement bpf iterator for map elements")
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200805055056.1457463-1-yhs@fb.com
2020-08-06 16:39:14 -07:00
..
2020-05-28 11:22:14 +02:00
2019-12-18 18:07:31 +01:00
2019-03-07 18:32:01 -08:00
2019-10-09 22:31:14 -04:00
2019-09-25 17:51:39 -07:00
2019-08-02 14:44:02 +10:00
2020-04-27 16:29:41 +05:30
2020-07-19 19:20:22 -07:00
2020-07-10 13:54:00 -07:00
2020-06-24 21:34:11 +02:00
2020-05-14 16:44:25 +02:00
2019-03-27 13:30:07 -07:00
2020-05-28 22:09:47 -04:00
2018-06-18 15:11:53 +10:00
2019-08-12 19:33:50 -07:00
2020-07-12 10:22:01 +02:00
2019-12-11 15:31:52 +01:00
2020-07-19 19:20:22 -07:00
2020-07-24 17:12:41 -07:00
2018-09-05 22:27:11 -07:00
2020-07-13 15:32:56 -07:00
2020-04-20 12:43:24 -07:00
2020-07-24 17:12:41 -07:00
2020-07-19 19:20:22 -07:00
2019-09-08 15:37:04 +02:00
2018-07-07 17:41:38 +02:00
2018-08-03 10:03:57 -07:00
2020-05-21 08:20:35 -06:00
2017-11-28 16:54:00 +01:00
2020-03-29 22:30:57 -07:00
2020-07-09 12:38:41 -07:00
2018-01-14 23:06:30 -05:00
2018-01-16 16:47:29 +01:00
2020-01-18 09:19:18 -05:00
2019-10-02 20:32:27 -06:00
2019-01-22 10:21:45 +01:00
2019-07-30 20:34:34 +02:00
2020-05-21 17:04:07 -07:00
2018-03-20 03:17:41 +02:00
2020-03-29 22:30:57 -07:00
2017-11-16 10:49:00 +09:00
2019-12-18 18:07:31 +01:00
2018-09-03 13:29:38 +02:00
2019-12-09 09:59:07 +01:00
2020-03-29 23:29:08 +02:00
2018-02-06 18:32:44 -08:00
2019-09-18 20:17:50 +02:00
2019-08-01 21:49:46 +02:00
2020-07-13 15:32:56 -07:00
2020-06-24 07:51:01 +02:00