![]() |
|
Message-ID: <20250217143829.GA1827@brightrain.aerifal.cx> Date: Mon, 17 Feb 2025 09:44:58 -0500 From: Rich Felker <dalias@...c.org> To: Alejandro Colomar <alx@...nel.org> Cc: libc-help@...rceware.org, linux-man@...r.kernel.org, Karlson2k <k2k@...od.ru>, Tobias Stoeckmann <tobias@...eckmann.org>, Serge Hallyn <serge@...lyn.com>, Iker Pedrosa <ipedrosa@...hat.com>, musl@...ts.openwall.com Subject: Re: Re: [shadow-maint/shadow] Add cheap defense mechanisms (PR #1171) 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@...ts.sr.ht> from CC because my mail software rejects / in an address... gotta fix that. Apologies.
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.