From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2841 Path: news.gmane.org!not-for-mail From: KOSAKI Motohiro Newsgroups: gmane.linux.lib.musl.general Subject: Re: O_EXEC and O_SEARCH Date: Sat, 23 Feb 2013 00:21:01 -0500 Message-ID: References: <20130222004540.GA8836@brightrain.aerifal.cx> <20130223031708.GU20323@brightrain.aerifal.cx> <20130223043336.GV20323@brightrain.aerifal.cx> <20130223050542.GX20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1361596897 9176 80.91.229.3 (23 Feb 2013 05:21:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2013 05:21:37 +0000 (UTC) Cc: libc-alpha , musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-2843-gllmg-musl=m.gmane.org@lists.openwall.com Sat Feb 23 06:21:59 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U97YY-00046V-Q0 for gllmg-musl@plane.gmane.org; Sat, 23 Feb 2013 06:21:54 +0100 Original-Received: (qmail 25726 invoked by uid 550); 23 Feb 2013 05:21:34 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25718 invoked from network); 23 Feb 2013 05:21:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Pcf+PVl3hLnqH+t05lJJzPNmTpTvWjkVG5V8S05iMcM=; b=Hir2IsXGnjDn9ID2VdyjxGoVbVlZMn0zZOW+NGjrVEeprEB88T7NUHOVuKc3FR44iT glvqIgI5O3Bpi/vixsMHxPK5dIzHL1phtDDhA5RwzfEQBJBlhJY641eCIunfnJkSeSAi t30t8FfDhlDaL+eg8yd/4q/uKF252rG2zhGHnoL1pnpNkqxfWLH9lg0MI+ztT6MqC3yH x53Y+psls7IGRux740NOJnvZWg6DZO6xkim5esOP90vYRObkNvLtaUnaS2Sgs7x1ASXG X6os98yFJZpMWL1oUIa/vnUoJx7FrPq8VKl0tVjuhxSp72fSBdHR+pJICzvuoRHATuyw lUgQ== X-Received: by 10.60.172.18 with SMTP id ay18mr1743413oec.126.1361596881919; Fri, 22 Feb 2013 21:21:21 -0800 (PST) In-Reply-To: <20130223050542.GX20323@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:2841 Archived-At: On Sat, Feb 23, 2013 at 12:05 AM, Rich Felker wrote: > 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. Ah, ok. got it.