Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755552AbYGMShm (ORCPT ); Sun, 13 Jul 2008 14:37:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753619AbYGMShg (ORCPT ); Sun, 13 Jul 2008 14:37:36 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:46379 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753427AbYGMShf (ORCPT ); Sun, 13 Jul 2008 14:37:35 -0400 Date: Sun, 13 Jul 2008 11:36:02 -0700 (PDT) From: Linus Torvalds To: Oleg Nesterov cc: Denys Vlasenko , T?r?k Edwin , Ingo Molnar , Roland McGrath , Thomas Gleixner , Andrew Morton , Linux Kernel Mailing List , Elias Oltmanns , Arjan van de Ven Subject: Re: [PATCH] x86_64: fix delayed signals In-Reply-To: <20080713104617.GA79@tv-sign.ru> Message-ID: References: <20080710215039.2A143154218@magilla.localdomain> <48791393.1020107@gmail.com> <200807122257.59047.vda.linux@googlemail.com> <20080713104617.GA79@tv-sign.ru> User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1402 Lines: 34 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/