From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2840 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.comp.lib.glibc.alpha,gmane.linux.lib.musl.general Subject: Re: O_EXEC and O_SEARCH Date: Sat, 23 Feb 2013 00:05:42 -0500 Message-ID: <20130223050542.GX20323@brightrain.aerifal.cx> References: <20130222004540.GA8836@brightrain.aerifal.cx> <20130223031708.GU20323@brightrain.aerifal.cx> <20130223043336.GV20323@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 1361595952 1956 80.91.229.3 (23 Feb 2013 05:05:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2013 05:05:52 +0000 (UTC) Cc: libc-alpha , musl@lists.openwall.com To: KOSAKI Motohiro Original-X-From: libc-alpha-return-37221-glibc-alpha=m.gmane.org@sourceware.org Sat Feb 23 06:06:15 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 1U97JN-00007u-JE for glibc-alpha@plane.gmane.org; Sat, 23 Feb 2013 06:06:13 +0100 Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sourceware.org; s=default; x=1362200753; h=Comment: DomainKey-Signature:Received:Received:Date:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:User-Agent:From:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=aJqcnVinuJTTSsSpynrn 6ccsve4=; b=YHXMfxTLYgbSAjvbVJFG8DrK/xGlsUown3OBtBU+ib2DPmWUUgZA pcG9+eqKqYuBZhLuVz2OJ9J6rWDqyIxiapjhjTlkWmXG9HUPk9r/oEPGcqHNL7SF I1KyMBgImi7M2DIeY3WTycrz+TpUe26qg+3ojhcSLV+zOURZ7rZ7GbI= 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:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:From:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KZzY9P8Kks+T2f+lVqQjbdlQ5aGH61gz2DGc5bKeEpbDYN99LBAmxJi61IbeXs jRqfOSoEEbFLAf5nwesHtEFlCsV4ywyPGFzUylC9QdkkPTChPOLS4RqtYYLcYQnt zjnCkMQDjOxY/NEzWJOX0UzCXEfFsD2GxpP+1CsLFUtTg=; Original-Received: (qmail 1355 invoked by alias); 23 Feb 2013 05:05:49 -0000 Original-Received: (qmail 1344 invoked by uid 22791); 23 Feb 2013 05:05:48 -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 In-Reply-To: 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:29557 gmane.linux.lib.musl.general:2840 Archived-At: On Sat, Feb 23, 2013 at 12:01:39AM -0500, KOSAKI Motohiro wrote: > > 1. Try to open with O_RDONLY. If it succeeds, we're done. This is > > REALLY nice because it means O_SEARCH and O_EXEC "just work" even on > > ancient or broken kernels as long as the target file is readable. > > Hmm.. > This algorithm seems slightly strange to me. Why do you want to try O_RDONLY at > first? > O_RDONLY require read permission and O_SEARCH, if i understand correctly, > doesn't. > I think you should try O_PATH at first. If the file is readable, O_RDONLY will succeed and provides the necessary semantics for O_EXEC and O_SEARCH. The only time O_EXEC or O_SEARCH needs special support is when the file is not readable; these modes were specifically designed for supporting that case. Rich