[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0807131121430.2959@woody.linux-foundation.org>
Date: Sun, 13 Jul 2008 11:36:02 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...sign.ru>
cc: Denys Vlasenko <vda.linux@...glemail.com>,
T?r?k Edwin <edwintorok@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Roland McGrath <roland@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Elias Oltmanns <eo@...ensachen.de>,
Arjan van de Ven <arjan@...radead.org>
Subject: Re: [PATCH] x86_64: fix delayed signals
On Sun, 13 Jul 2008, Oleg Nesterov wrote:
>
> SETFL_MASK doesn't have O_RDWR, and in any case setfl() changes ->f_flags,
> not ->f_mode.
I think you can still read a write-only file descriptor on some systems:
doing a mmap( PROT_WRITE ) on it can sometimes do it.
The reason - PROT_WRITE often implies PROT_READ (because on many CPU's you
have to do unaligned writes with a read-modify-write cycle - on some like
old alphas you have to do even normal byte and word writes that way).
So if the OS checks just the asked-for protections against the file
descriptor protections, you'll essentially get read access for free when
you do the mmap.
At least current versions of Linux won't ever allow a file mapping of a
non-readable fd, but I won't guarantee we always did that, nor that other
OS's always do it.
Anyway, I misunderstood Edwins idea to actually throw away the writes if
the file isn't linked anywhere and is only open for writing. I guess we
could optimize that, but it's such an unrealistic specialc case that it
really isn't worth it except for some benchmark-gaming kind of thing
(which I don't like doing anyway).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists