Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 13 Apr 2022 14:24:32 +0200
From: Natanael Copa <ncopa@...inelinux.org>
To: "Gary E. Miller" <gem@...lim.com>
Cc: musl@...ts.openwall.com
Subject: Re: *strerror_r() bug in musl

On Tue, 12 Apr 2022 13:43:55 -0700
"Gary E. Miller" <gem@...lim.com> wrote:

> Yo All!

Hi!

> 
> I'm new to the list.  I;ve been trying to report a musl bug on #musl since
> last Friday, but no one seems to live there.
> 
> musl (all versions) has a bug in strerror_r().
> 
> The musl reference manual says of _GNUSOURCE:
> 
>     _GNU_SOURCE (or _ALL_SOURCE)
> 
>     Adds everything above, plus interfaces modeled after GNU libc
>     extensions and interfaces for making use of Linux-specific features.
> 
> I take that to mean that when _GNU_SOURCE is used to compile code with musl
> that the results will behave as GNU libc (glinc).

Well, as other has mentioned. GNU libc has a non-compliant version of
strerror_r.

...
 
> When _GNU_SOURCE is defined with glibc, then strerror_r() returns a char *.

I have met this in multiple places the last decade. The usual way to
fix it is to also check for GNU libc in addition to _GNU_SOURCE.

#if defined (__GLIBC__) && defined (_GNU_SOURCE)
	/* non-standard GLIBC exception */
#else
	/* standard behavior for everything else */
#endif

-nc

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.