Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 6 Mar 2019 06:08:04 +0100
From: Markus Wichmann <>
Subject: Re: Asterisk 16 function redefines

On Tue, Mar 05, 2019 at 10:05:17PM +0100, Sebastian Kemper wrote:
> What wonders me the most is that the same preprocessor define works fine
> with the same compiler using a different libc. I tried
> gcc 7.4.0 + musl 1.1.20:	NOK
> gcc 7.1.1 + uclibc 1.0.31:	OK
> gcc 8.2.0 + glibc 2.27:		OK

At least for glibc, this is easy. And I suppose, uclibc will do it a
similar way.

<sched.h> has to define the macro CPU_ALLOC(). And it has to be usable
by just including <sched.h>. In musl, CPU_ALLOC() is defined in terms of
calloc(). In order for CPU_ALLOC() to be usable, calloc() must be
declared in <sched.h> as well. However, including <stdlib.h> from
<sched.h> would add a lot more names to the namespace than simply
redeclaring the functions. So that's why there's a calloc() prototype in
musl's <sched.h>.

In glibc, CPU_ALLOC() is defined in terms of __sched_cpualloc(). Which
is probably just a wrapper around the normal allocators, but it gets
<sched.h> out of having to declare the allocator functions. So no
calloc() prototype in glibc's <sched.h>, and thus the above hack works
in glibc. But only by accident.


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.