[oi-dev] Opening executable with write flags

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jul 14 21:21:59 UTC 2025


On 7/14/25 11:57, Paul Floyd via oi-dev wrote:
> This just looks like a kernel bug to me (in both Solaris 11.4 and illumos).

It's not a bug, just a different design decision.

> The Solaris 11.4 man page says (and I guess illumos is the same):
> 
> 
> ETXTBSY        The file is a pure procedure (shared text) file that is
>                        being executed and oflagis O_WRONLYor O_RDWR.

That text comes from POSIX and is listed under the "The open() and openat()
functions may fail if:" section - i.e. POSIX allows OS'es to return that
error if they choose, but does not require them to do so.  Solaris has chosen
not to do so for decades now (at least as far back as Solaris 2.0 as best I
can tell, and possibly into the SunOS era before that), and has documented
that in past POSIX conformance submissions, such as:
https://www.opengroup.org/csq/repository/noreferences=1&RID=sun%252FSD1%252F8.html

As https://lwn.net/Articles/866493/ pointed out a few years ago, you can't
even really rely on it on Linux, and it's been mostly pointless since the
advent of shared libraries.

-- 
         -Alan Coopersmith-                 alan.coopersmith at oracle.com
          Oracle Solaris Engineering - https://blogs.oracle.com/solaris



More information about the oi-dev mailing list