Date: Sat, 23 Feb 2013 00:21:01 -0500 From: KOSAKI Motohiro <kosaki.motohiro@...il.com> To: Rich Felker <dalias@...ifal.cx> Cc: libc-alpha <libc-alpha@...rceware.org>, musl@...ts.openwall.com Subject: Re: O_EXEC and O_SEARCH On Sat, Feb 23, 2013 at 12:05 AM, Rich Felker <dalias@...ifal.cx> 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.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.