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

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

 



Hi Rich,

On Mon, Feb 17, 2025 at 09:44:58AM -0500, Rich Felker wrote:
> It's in the latest POSIX and we have supported it for a long time as
> POSIX-future (since 2012/release 0.9.7).

Thanks!  That agrees with my own research.

> > > 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.

Makes sense.  Thanks!

> 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.

Hmmm, thanks for the idea!  This code is old, so we didn't actually
write it; we only added 'e' recently to it.  If we need to write new
code, I'll take into consideration doing that as a two-step process,
maybe adding a wrapper around that process.


Have a lovely day!
Alex

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

No problem.  Thanks!

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[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