lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 26 Mar 2014 14:44:40 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Rainer Weikusat <rweikusat@...ileactivedefense.com>
Cc:	David Miller <davem@...emloft.net>, David.Laight@...LAB.COM,
	netdev@...r.kernel.org
Subject: Re: [PATCH] net: unix: non blocking recvmsg() should not return
 -EINTR

On Wed, 2014-03-26 at 21:21 +0000, Rainer Weikusat wrote:

> BTW, here's the program with the O_NONBLOCK read call which blocks until
> the end of electricity, at least on 3.2.9:
> 
> ---------
> #include <fcntl.h>
> #include <string.h>
> #include <sys/socket.h>
> #include <sys/un.h>
> 
> int main(void)
> {
>     struct sockaddr_un sun;
>     int fd;
> 
>     fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>     sun.sun_family = AF_UNIX;
>     strncpy(sun.sun_path, "/tmp/bla", sizeof(sun.sun_path));
>     bind(fd, (struct sockaddr *)&sun, sizeof(sun));
> 
>     if (fork() == 0) read(fd, &fd, sizeof(fd));
> 
>     sleep(1);
> 
>     fcntl(fd, F_SETFL, O_NONBLOCK);
>     read(fd, &fd, sizeof(fd));
> 
>     return 0;
> }

Sure, O_NONBLOCK is translated into MSG_NOWAIT one time per socket
syscall. 

Once we block, we don't automatically unblock if another thread change
the file flag.

grep -n MSG_DONTWAIT net/socket.c



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ