public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Davide Libenzi <davidel@xmailserver.org>,
	Ulrich Drepper <drepper@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: F_DUPFD_CLOEXEC implementation
Date: Mon, 1 Oct 2007 19:49:03 +0100	[thread overview]
Message-ID: <200710011949.03482.vda.linux@googlemail.com> (raw)
In-Reply-To: <20071001181648.GB8181@ftp.linux.org.uk>

On Monday 01 October 2007 19:16, Al Viro wrote:
> 	* it's on a bunch of cyclic lists.  Have its neighbor
> go away while you are doing all that crap => boom
> 	* there's that thing call current position...  It gets buggered.
> 	* overwriting it while another task might be in the middle of
> syscall involving it => boom

Hm, I suspected that it's herecy. Any idea how to do it cleanly?

> 	* non-cooperative tasks reading *in* *parallel* from the same
> opened file are going to have a lot more serious problems than agreeing
> on O_NONBLOCK anyway, so I really don't understand what the hell is that for.

They don't even need to read in parallel, just having shared fd is enough.
Think about pipes, sockets and terminals. A real-world scenario:

* a process started from shell (interactive or shell script)
* it sets O_NONBLOCK and does a read from fd 0...
* it gets killed (kill -9, whatever)
* shell suddenly has it's fd 0 in O_NONBLOCK mode
* shell and all subsequent commands started from it unexpectedly have
  O_NONBLOCKed stdin.
--
vda

  reply	other threads:[~2007-10-01 18:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 17:34 F_DUPFD_CLOEXEC implementation Ulrich Drepper
2007-09-28 18:19 ` Davide Libenzi
2007-09-28 18:23   ` Ulrich Drepper
2007-09-30  0:31 ` Denys Vlasenko
2007-09-30 23:11   ` Davide Libenzi
2007-09-30 23:58     ` Denys Vlasenko
2007-10-01  3:15       ` Davide Libenzi
2007-10-01 10:07         ` Denys Vlasenko
2007-10-01 18:16           ` Al Viro
2007-10-01 18:49             ` Denys Vlasenko [this message]
2007-10-01 19:04               ` Davide Libenzi
2007-10-02  9:28                 ` Denys Vlasenko
2007-10-02 19:52                   ` Davide Libenzi
2007-10-01 18:53             ` Michael Tokarev
2007-10-01  0:59   ` Miquel van Smoorenburg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200710011949.03482.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox