libbpf: Use SOCK_CLOEXEC when opening the netlink socket
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Wed, 17 Mar 2021 11:58:58 +0000 (17:28 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:32:01 +0000 (14:32 +0200)
commitb4c574e4b47113090e57cfbdb7bd46f10094fed8
tree6da7b5f6a43d5326ee3d79fbaf1fc4b0cc9e5511
parent86e525bc04f24d503cc6178d19f61b51727e6e91
libbpf: Use SOCK_CLOEXEC when opening the netlink socket

[ Upstream commit 58bfd95b554f1a23d01228672f86bb489bdbf4ba ]

Otherwise, there exists a small window between the opening and closing
of the socket fd where it may leak into processes launched by some other
thread.

Fixes: 949abbe88436 ("libbpf: add function to setup XDP")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210317115857.6536-1-memxor@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/netlink.c