Linux: Create Netlink socket with SOCK_CLOEXEC in __check_pf [BZ #15722]

Message ID 20180618110816.E8B2F401BD607@oldenburg.str.redhat.com
State New
Headers show
Series
  • Linux: Create Netlink socket with SOCK_CLOEXEC in __check_pf [BZ #15722]
Related show

Commit Message

Florian Weimer June 18, 2018, 11:08 a.m.
2018-06-18  Florian Weimer  <fweimer@redhat.com>

	[BZ #15722]
	* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Create Netlink
	socket with SOCK_CLOEXEC.

Comments

Adhemerval Zanella June 18, 2018, 1:23 p.m. | #1
On 18/06/2018 08:08, Florian Weimer wrote:
> 2018-06-18  Florian Weimer  <fweimer@redhat.com>

> 

> 	[BZ #15722]

> 	* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Create Netlink

> 	socket with SOCK_CLOEXEC.

> 

> diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c

> index 36326abe80..04cd104aec 100644

> --- a/sysdeps/unix/sysv/linux/check_pf.c

> +++ b/sysdeps/unix/sysv/linux/check_pf.c

> @@ -313,7 +313,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,

>      }

>    else

>      {

> -      int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);

> +      int fd = __socket (PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);

>  

>        if (__glibc_likely (fd >= 0))

>  	{

> 


LGTM, thanks.

Patch

diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 36326abe80..04cd104aec 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -313,7 +313,7 @@  __check_pf (bool *seen_ipv4, bool *seen_ipv6,
     }
   else
     {
-      int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+      int fd = __socket (PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
 
       if (__glibc_likely (fd >= 0))
 	{