Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 23 Feb 2013 00:05:42 -0500
From: Rich Felker <>
To: KOSAKI Motohiro <>
Cc: libc-alpha <>,
Subject: Re: O_EXEC and O_SEARCH

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.


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.