Files
android_kernel_xiaomi_sm8450/include/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-08-03 18:19:23 -07:00
2019-11-12 11:43:29 -05:00
2020-06-25 22:25:13 -07:00
2020-06-16 14:19:57 +02:00
2020-07-27 14:55:22 +01:00
2010-11-23 20:14:46 +00:00
2018-05-26 09:16:44 +02:00
2005-04-16 15:20:36 -07:00
2020-05-24 20:48:11 +02:00
2020-07-21 08:24:52 -05:00
2020-07-08 10:48:35 -07:00
2018-11-07 13:44:59 -07:00
2018-11-07 13:44:59 -07:00
2020-07-21 13:26:26 -07:00
2020-05-19 09:40:29 -06:00
2018-06-15 18:10:01 -03:00
2020-04-10 15:36:21 -07:00
2019-06-12 20:27:13 +02:00
2018-03-26 15:09:38 +02:00
2018-08-22 10:52:48 -07:00
2020-05-13 08:44:35 -07:00
2019-10-09 19:33:43 -07:00
2020-03-09 11:12:19 +01:00
2009-12-10 23:52:01 +00:00
2016-10-28 08:48:16 -06:00
2019-12-03 11:20:37 +01:00
2020-06-16 19:25:20 +02:00
2019-02-28 03:28:53 -05:00
2018-01-01 12:40:27 -07:00
2020-05-04 11:19:58 -07:00
2020-01-18 09:19:18 -05:00
2020-06-17 00:07:38 +02:00
2018-12-19 10:42:08 +01:00
2014-10-08 16:01:41 -04:00
2020-03-06 11:06:15 +01:00
2019-02-15 16:54:38 +01:00
2010-02-09 11:13:56 +01:00
2020-05-28 07:59:45 -07:00
2020-07-24 17:12:41 -07:00
2019-06-26 13:19:46 -07:00
2020-04-30 12:54:01 -07:00
2019-10-04 12:31:46 -07:00
2019-10-15 13:34:25 +02:00
2018-11-19 19:03:46 -07:00
2018-06-22 13:43:27 +09:00
2020-07-24 17:12:41 -07:00
2020-05-18 10:30:21 +01:00
2019-06-10 13:00:24 +02:00
2019-12-04 19:44:14 -08:00
2020-06-26 10:01:08 -06:00
2020-06-02 15:15:46 +01:00
2019-12-11 09:12:38 +01:00
2020-07-02 15:51:48 +02:00
2020-05-08 18:18:11 +01:00
2020-05-08 00:12:42 +02:00
2020-05-28 10:31:09 +02:00
2018-04-12 09:41:19 -07:00
2019-03-07 18:32:03 -08:00
2018-06-07 17:34:35 -07:00
2020-03-06 11:56:59 +01:00
2020-04-07 10:43:38 -07:00
2019-12-09 10:55:03 +01:00
2019-08-14 15:30:35 +02:00
2020-07-31 18:08:59 +10:00
2020-03-21 16:00:24 +01:00
2019-11-14 19:06:47 -08:00
2018-10-17 13:56:58 -07:00
2020-07-24 15:41:54 -07:00
2020-05-09 13:57:12 +02:00
2019-02-20 07:22:10 -07:00
2019-02-08 15:02:49 -08:00
2020-07-01 10:49:02 +02:00
2020-07-23 17:34:18 +10:00
2020-04-02 09:35:27 -07:00
2018-10-21 10:46:39 -04:00
2020-05-15 13:51:28 -07:00
2017-11-09 10:23:28 +01:00
2019-07-16 19:23:25 -07:00
2018-10-08 22:53:10 +11:00
2020-05-09 13:57:12 +02:00
2019-06-15 12:25:49 +02:00
2018-07-20 01:11:45 +02:00
2018-05-11 17:28:45 -07:00
2018-09-25 20:17:35 -07:00
2020-07-16 23:19:51 +02:00
2020-05-17 14:10:07 -06:00
2020-05-14 16:44:24 +02:00
2019-02-07 16:38:35 +01:00
2018-01-15 12:07:46 -08:00
2018-10-11 09:16:44 -07:00
2020-05-04 09:16:37 -07:00
2020-05-29 14:52:53 +02:00
2020-07-04 09:35:36 -05:00
2020-01-14 12:20:48 +01:00
2005-04-16 15:20:36 -07:00
2020-07-07 11:58:59 -05:00
2020-04-01 12:06:26 -04:00
2020-04-17 06:05:30 -04:00
2020-06-26 00:27:38 -07:00
2019-11-14 12:20:02 +08:00
2019-05-15 17:35:54 +01:00
2011-01-13 08:03:24 -08:00
2017-08-15 09:02:08 -07:00