<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/bpf/task_iter.c, branch v5.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-05-15T01:37:32Z</updated>
<entry>
<title>bpf: Fix bpf_iter's task iterator logic</title>
<updated>2020-05-15T01:37:32Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-05-14T05:51:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c70f34a8ac66c2cb05593ef5760142e5f862a9b4'/>
<id>urn:sha1:c70f34a8ac66c2cb05593ef5760142e5f862a9b4</id>
<content type='text'>
task_seq_get_next might stop prematurely if get_pid_task() fails to get
task_struct. Failure to do so doesn't mean that there are no more tasks with
higher pids. Procfs's iteration algorithm (see next_tgid in fs/proc/base.c)
does a retry in such case. After this fix, instead of stopping prematurely
after about 300 tasks on my server, bpf_iter program now returns &gt;4000, which
sounds much closer to reality.

Fixes: eaaacd23910f ("bpf: Add task and task/file iterator targets")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200514055137.1564581-1-andriin@fb.com
</content>
</entry>
<entry>
<title>bpf: Enable bpf_iter targets registering ctx argument types</title>
<updated>2020-05-13T19:30:50Z</updated>
<author>
<name>Yonghong Song</name>
<email>yhs@fb.com</email>
</author>
<published>2020-05-13T18:02:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3c32cc1bceba8a1755dc35cd97516f6c67856844'/>
<id>urn:sha1:3c32cc1bceba8a1755dc35cd97516f6c67856844</id>
<content type='text'>
Commit b121b341e598 ("bpf: Add PTR_TO_BTF_ID_OR_NULL
support") adds a field btf_id_or_null_non0_off to
bpf_prog-&gt;aux structure to indicate that the
first ctx argument is PTR_TO_BTF_ID reg_type and
all others are PTR_TO_BTF_ID_OR_NULL.
This approach does not really scale if we have
other different reg types in the future, e.g.,
a pointer to a buffer.

This patch enables bpf_iter targets registering ctx argument
reg types which may be different from the default one.
For example, for pointers to structures, the default reg_type
is PTR_TO_BTF_ID for tracing program. The target can register
a particular pointer type as PTR_TO_BTF_ID_OR_NULL which can
be used by the verifier to enforce accesses.

Signed-off-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200513180221.2949882-1-yhs@fb.com
</content>
</entry>
<entry>
<title>bpf: net: Refactor bpf_iter target registration</title>
<updated>2020-05-13T19:30:50Z</updated>
<author>
<name>Yonghong Song</name>
<email>yhs@fb.com</email>
</author>
<published>2020-05-13T18:02:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=15172a46fa2796c1a1358a36babd31274716ed41'/>
<id>urn:sha1:15172a46fa2796c1a1358a36babd31274716ed41</id>
<content type='text'>
Currently bpf_iter_reg_target takes parameters from target
and allocates memory to save them. This is really not
necessary, esp. in the future we may grow information
passed from targets to bpf_iter manager.

The patch refactors the code so target reg_info
becomes static and bpf_iter manager can just take
a reference to it.

Signed-off-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200513180219.2949605-1-yhs@fb.com
</content>
</entry>
<entry>
<title>bpf: Add task and task/file iterator targets</title>
<updated>2020-05-10T00:05:26Z</updated>
<author>
<name>Yonghong Song</name>
<email>yhs@fb.com</email>
</author>
<published>2020-05-09T17:59:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=eaaacd23910f2d7c4b22d43f591002cc217d294b'/>
<id>urn:sha1:eaaacd23910f2d7c4b22d43f591002cc217d294b</id>
<content type='text'>
Only the tasks belonging to "current" pid namespace
are enumerated.

For task/file target, the bpf program will have access to
  struct task_struct *task
  u32 fd
  struct file *file
where fd/file is an open file for the task.

Signed-off-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200509175911.2476407-1-yhs@fb.com
</content>
</entry>
</feed>
