bpf: Avoid visit same object multiple times
authorYonghong Song <yhs@fb.com>
Tue, 18 Aug 2020 22:23:10 +0000 (15:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:37 +0000 (11:29 +0200)
commit61aacc3594c904947f3e1f7adf77d6b37c597d92
tree8ece33d78c6bacd79237bcf4bcda09036843124c
parent2d9018e5e6e21ecb611175460fabfcad774c3b40
bpf: Avoid visit same object multiple times

[ Upstream commit e60572b8d4c39572be6857d1ec91fdf979f8775f ]

Currently when traversing all tasks, the next tid
is always increased by one. This may result in
visiting the same task multiple times in a
pid namespace.

This patch fixed the issue by seting the next
tid as pid_nr_ns(pid, ns) + 1, similar to
funciton next_tgid().

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Link: https://lore.kernel.org/bpf/20200818222310.2181500-1-yhs@fb.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/task_iter.c