lkml.org 
[lkml]   [2008]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2008-07-13 20:39    [W:0.816 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site