Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190710224301.GZ1506@brightrain.aerifal.cx>
Date: Wed, 10 Jul 2019 18:43:01 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: open64 and similar

On Wed, Jul 10, 2019 at 06:03:51PM -0400, Andrew Bell wrote:
> musl does the following:
> 
> #define open64 open
> 
> This can cause an infinite loop for the following code:
> 
> class Foo
> {
> public:
>   int open64()
>     {  open(); }
> };
> 
> Perhaps it would be better to supply open64 and have it call open, rather
> than #define it?  There are several other xxx64 functions also defined that
> could cause problems with unfortunate code.

The intent is that we're trying to prevent actual references to the
legacy open64, etc. symbols while supporting code that's wrongly
attempting to use them. At the time this was added, that was still a
problem in lots of software; I don't know if it's since been fixed.

Originally, the intent was that the symbols exist *only* as ABI, for
ABI-compat loading of glibc-linked libs, and not as API that programs
compiled against musl could use. However broken configure scripts
checked for the symbol definition by linking a test program using a
*fake* declaration of the symbol, without including the header, then
wrongly picked up that it was available, and compiled wrong code later
at compiel time due to implicit-function-declaration. So the macro
redirections were added.

I'd like it if we could remove this stuff entirely, except for the
ABI-compat. Maybe it could be done by getting rid of the actual
symbols and just putting magic in the dynamic linker to resolve them
to the non-64 ones.

Anyway, this is not the first time someone's hit a problem from it
with C++, which is caused by GCC's unconditional (and wrong)
definition of _GNU_SOURCE in C++ mode. So we really should try to find
a reasonable fix...

Rich

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.