All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket
@ 2021-03-17 11:58 Kumar Kartikeya Dwivedi
  2021-03-17 13:04 ` Toke Høiland-Jørgensen
  2021-03-18  0:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2021-03-17 11:58 UTC (permalink / raw)
  To: ast
  Cc: toke, Kumar Kartikeya Dwivedi, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, bpf, linux-kernel

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>
---
Changelog:

v1 -> v2
Tag the bpf-next tree (Toke)
Add a Fixes: tag (Toke)
---
 tools/lib/bpf/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c
index 4dd73de00..d2cb28e9e 100644
--- a/tools/lib/bpf/netlink.c
+++ b/tools/lib/bpf/netlink.c
@@ -40,7 +40,7 @@ static int libbpf_netlink_open(__u32 *nl_pid)
 	memset(&sa, 0, sizeof(sa));
 	sa.nl_family = AF_NETLINK;
 
-	sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+	sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
 	if (sock < 0)
 		return -errno;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket
  2021-03-17 11:58 [PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket Kumar Kartikeya Dwivedi
@ 2021-03-17 13:04 ` Toke Høiland-Jørgensen
  2021-03-18  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-03-17 13:04 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi, ast
  Cc: Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, netdev, bpf,
	linux-kernel

Kumar Kartikeya Dwivedi <memxor@gmail.com> writes:

> 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>

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket
  2021-03-17 11:58 [PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket Kumar Kartikeya Dwivedi
  2021-03-17 13:04 ` Toke Høiland-Jørgensen
@ 2021-03-18  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-18  0:00 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi
  Cc: ast, toke, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh, netdev, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Wed, 17 Mar 2021 17:28:58 +0530 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket
    https://git.kernel.org/bpf/bpf/c/58bfd95b554f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-18  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 11:58 [PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket Kumar Kartikeya Dwivedi
2021-03-17 13:04 ` Toke Høiland-Jørgensen
2021-03-18  0:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.