]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 24 Nov 2022 13:24:17 +0000 (14:24 +0100)
commit137e27e8d47071b0304b778ea3870a7e883d39bb
treef249c230fb752e1bc65c936109d6a1afa73433d8
parent4ef59bf447c2ae80650b43f7f49efee9b7a045e6
bpf: Ensure correct locking around vulnerable function find_vpid()

BugLink: https://bugs.launchpad.net/bugs/1996825
[ Upstream commit 83c10cc362d91c0d8d25e60779ee52fdbbf3894d ]

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: 41bdc4b40ed6f ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
kernel/bpf/syscall.c