mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: open64 and similar
Date: Wed, 10 Jul 2019 18:43:01 -0400	[thread overview]
Message-ID: <20190710224301.GZ1506@brightrain.aerifal.cx> (raw)
In-Reply-To: <CACJ51z1GNcZBcA=-fzBjZWxResrmx5twsyR-C0-dupG9xP0kqw@mail.gmail.com>

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


  reply	other threads:[~2019-07-10 22:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 22:03 Andrew Bell
2019-07-10 22:43 ` Rich Felker [this message]
2019-07-11  1:58   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190710224301.GZ1506@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).