]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Ensure correct locking around vulnerable function find_vpid()
authorLee Jones <lee@kernel.org>
Mon, 12 Sep 2022 13:38:55 +0000 (14:38 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 16 Sep 2022 16:00:52 +0000 (18:00 +0200)
commit332fd4bbf456c9d664875ea8a2678475a412b85b
tree98b9cf773986ab7052dd7874ddb663d07dc2dd25
parenta47623e1c850e311c7c0906ea7fe9aea5e2abab8
bpf: Ensure correct locking around vulnerable function find_vpid()

The documentation for find_vpid() clearly states:

  "Must be called with the tasklist_lock or rcu_read_lock() held."

Presently we do neither for find_vpid() instance in bpf_task_fd_query().
Add proper rcu_read_lock/unlock() to fix the issue.

Fixes: 1bb265f68ca97 ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY")
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220912133855.1218900-1-lee@kernel.org
kernel/bpf/syscall.c