public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/21050] Prevent tailcall optimizations of libdl functions
Date: Mon, 12 Oct 2020 15:25:49 +0000	[thread overview]
Message-ID: <bug-21050-131-HIRTqJIU79@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-21050-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=21050

--- Comment #3 from Rich Felker <bugdal at aerifal dot cx> ---
The suggestion in comment 2 is a spec violation; it has a static identifier
dlsym in place of the required extern one, and also breaks the identity of
function pointers (different pointer per translation unit). You have to use
function-like macros to do this kind of thing in a conforming way, and the
macro still does not cover the case where the caller undefines the macro or
directly calls the function via its address.

I believe the right solution is to deprecate the old constant value of
RTLD_NEXT and instead define RTLD_NEXT to expand to the address of a static
anchor object inside the translation unit. The dynamic linker can then use that
anchor object, rather than the return address, to identify the DSO from which
it was called. This also fixes a lot of other usage patterns, e.g. where
library A calls dlsym_wrapper(RTLD_NEXT, "foo") and dlsym_wrapper is defined in
library B.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-10-12 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-21050-131@http.sourceware.org/bugzilla/>
2020-10-12  8:44 ` jay.krell at cornell dot edu
2020-10-12 15:25 ` bugdal at aerifal dot cx [this message]
2020-10-12 20:24 ` fw at deneb dot enyo.de

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=bug-21050-131-HIRTqJIU79@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).