Re: [musl] Re: [shadow-maint/shadow] Add cheap defense mechanisms (PR #1171)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 17, 2025 at 10:42:06AM +0100, Alejandro Colomar wrote:
> Hi,
> 
> On Sun, Feb 16, 2025 at 06:15:18PM -0800, Karlson2k wrote:
> > Karlson2k left a comment (shadow-maint/shadow#1171)
> > 
> > Doesn't use of glibc extensions break functioning with non-glibc, like musl?
> 
> Hmmm, I didn't know musl doesn't support this.  It would be interesting
> to get them to support it.  I've CCd several interested parties in this
> email.

It's in the latest POSIX and we have supported it for a long time as
POSIX-future (since 2012/release 0.9.7).

> > Isn't it safe to use constructs like 
> > ``` C
> > shadow = fopen (SGROUP_FILE, "re");
> > if (NULL == shadow )
> >   shadow = fopen (SGROUP_FILE, "r");
> > ```
> > ?

Unfortunately this doesn't work because it's UB to pass any modes but
the standards-specified ones.

In any case use of fopen is just gratuitously bad for software that
targets POSIX. The right way to do things is a two-step open+fdopen.
This avoids needing to depend on new features to open and lets you use
all the modern open flags, openat if needed, etc.

Rich


P.S. Had to omit shadow-utils <~hallyn/shadow@xxxxxxxxxxx> from CC
because my mail software rejects / in an address... gotta fix that.
Apologies.




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux