From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2831 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.comp.lib.glibc.alpha,gmane.linux.lib.musl.general Subject: O_EXEC and O_SEARCH Date: Thu, 21 Feb 2013 19:45:40 -0500 Message-ID: <20130222004540.GA8836@brightrain.aerifal.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1361493951 19606 80.91.229.3 (22 Feb 2013 00:45:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Feb 2013 00:45:51 +0000 (UTC) Cc: musl@lists.openwall.com To: libc-alpha@sourceware.org Original-X-From: libc-alpha-return-37195-glibc-alpha=m.gmane.org@sourceware.org Fri Feb 22 01:46:13 2013 Return-path: Envelope-to: glibc-alpha@plane.gmane.org Original-Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U8gmB-0001HF-K1 for glibc-alpha@plane.gmane.org; Fri, 22 Feb 2013 01:46:11 +0100 Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sourceware.org; s=default; x=1362098751; h=Comment: DomainKey-Signature:Received:Received:Date:To:Cc:Subject: Message-ID:MIME-Version:Content-Type:Content-Disposition: User-Agent:From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Subscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=t5Z/1xbQwZ7P3KPMvD5xvN2ZZ84=; b=ahtMcCL09D4ll4o AlfWrtiKrwoETLzyuWERczbLIAe6mobPoui0MWj5QKLXJngM270nNZXPxKOVTSp3 FZ2sSPB9BNAMv/rTJVwLRw7zmMiHHY/1VZ4rVibFeNtjIiIaEQU3R4vNHPc1vA9W CNS/mEBKexPj0RqCN+5tcfR0FgS4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=sourceware.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Date:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:From:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=svW8MByEI7dZx6U9LZRKskl4ivpN/5rfLnFfXmHSoX9CyP/0X2MZycBBhZAxlH McrCE1ZMkep38l79JNdiDcmgqDgoalOvvpfCM89AO4uRJChRfwJTv9UXbZZ0cUzu CFdTvZgk9LYzLi2XY7UKU6mb0/dnZnusUTpT2FMQLJt0U=; Original-Received: (qmail 2444 invoked by alias); 22 Feb 2013 00:45:48 -0000 Original-Received: (qmail 2436 invoked by uid 22791); 22 Feb 2013 00:45:47 -0000 X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_00,KHOP_DYNAMIC2,RDNS_DYNAMIC,TVD_RCVD_IP X-Spam-Check-By: sourceware.org Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: libc-alpha-owner@sourceware.org Xref: news.gmane.org gmane.comp.lib.glibc.alpha:29531 gmane.linux.lib.musl.general:2831 Archived-At: Hi, I'd like to have a conversation with the glibc team about O_EXEC and O_SEARCH in the interest of hopefully developing a unified plan for supporting them on Linux. Presumably the reason glibc still does not have them is that Linux O_PATH does not exactly match their semantics in some cases, and O_PATH is sufficiently broken on many kernel versions to make offering it problematic. In particular, current coreutils break badly on most kernel versions around 2.6.39-3.6 or so if O_SEARCH and O_EXEC are defined as O_PATH. Right now, we're offering O_EXEC and O_SEARCH in musl libc, defining them as O_PATH. As long as recent Linux is used, this gives nearly correct semantics, except that combined with O_NOFOLLOW they do not fail when the final component is a symbolic link. I believe it's possible to work around this issue on sufficiently modern kernels where fstat works on O_PATH file descriptors, but adding the workaround whenever O_PATH|O_NOFOLLOW is in the flags would change the semantics when O_PATH is used by the caller rather than O_EXEC or O_SEARCH, since the value is equal. I'm not sure this is desirable. What should the long-term plan for supporting O_SEARCH and O_EXEC on Linux be? Should we assume Linux is aiming for O_PATH to eventually provide compatible semantics, and thus just define O_SEARCH and O_EXEC as O_PATH? Or is there a need to define a different value (perhaps 3, the unused access mode) for O_SEARCH and O_EXEC and have open/fcntl remap it and handle workarounds for Linux semantics that don't match the POSIX semantics? Rich