mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: <noring@nocrew.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: Improving read/write/close system call reliability when used with pthreads
Date: Sun, 12 Aug 2007 20:14:47 -0700	[thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKOEHMGBAC.davids@webmaster.com> (raw)
In-Reply-To: <A94120FD-315A-45B7-A8F4-8DC8DC21279E@nocrew.org>


> 2) Do close reader fd, but what results can then applications
> reliably expect? What would be the sane intention of applications
> closing reader fd? Do programmers expect all of the current results?

> Fredrik

Since there's no atomic "unlock and read" function, any code that could ever
close a socket in one thread while another thread is blocked on read might
call close just before another thread blocks in read. Nothing stops another
thread from opening something, getting the same file descriptor, and then
allowing the thread to call "read" on the wrong file descriptor entirely.

Since this can never be made sane in general, I see little point in making
one variation of what can go wrong a bit saner. It is still irresponsible to
code like this.

DS



  parent reply	other threads:[~2007-08-13  3:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-12 13:03 Fredrik Noring
2007-08-12 14:17 ` Paul Jackson
2007-08-12 18:30   ` [PATCH] " Fredrik Noring
2007-08-12 15:13 ` Alan Cox
2007-08-12 16:33   ` Fredrik Noring
2007-08-12 18:55     ` Alan Cox
2007-08-12 19:19       ` Fredrik Noring
2007-08-13  3:14     ` David Schwartz [this message]
2007-08-13  6:50       ` Fredrik Noring

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=MDEHLPKNGKAHNMBLJOLKOEHMGBAC.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noring@nocrew.org \
    /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

all inboxes | Powered by JetHome®