public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/14932] dlsym(handle, "foo") and dlsym(RTLD_NEXT, "foo") return different result with versioned "foo"
Date: Tue, 10 Aug 2021 09:59:56 +0000	[thread overview]
Message-ID: <bug-14932-131-fmFtGwiyG6@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14932-131@http.sourceware.org/bugzilla/>

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

Jakub Jelinek <jakub at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com

--- Comment #4 from Jakub Jelinek <jakub at redhat dot com> ---
I think changing this is highly undesirable, as written in
https://marc.info/?l=glibc-alpha&m=98313802001691&w=2
the current dlsym behavior provides ABI stability, no matter what you run the
program against it will always return the same symbol.
While if it returns the default symbol (there doesn't need to be any), it would
change behavior depending on what glibc is used at runtime.
Say, you compile/link your program against glibc 2.5, which provides foobar
symbol say at @@GLIBC_2.5, later glibc 2.37 comes and will have
foobar @GLIBC_2.5 and @@GLIBC_2.37.  Some versioned symbols are solely about
adding features while keeping the ABI the same, say it handles another bitmask
in argument that was previously rejected with -1/setting errno or similar, say
regexec, that perhaps can be handled.  But in other cases the ABI of the
function changes, adds/removes argument or e.g. what some argument points to
changes layout (and not just in glibc, but in any versioned shared library).
You really don't want your old programs to suddenly break because of that.

Basically, dlsym should follow what happens when you link against a shared
library before symbol versioning has been added to it (e.g. very old glibc).

sanitizers need to be fixed so that the sanitizer libraries are also symbol
versioned and when they wrap some glibc symbols, they follow the versioning
there, i.e. if they wrap regexec and regexec is on a particular architecture
regexec@GLIBC_2.2.5 and regexec@@GLIBC_2.3.4, then it wraps both of them
and each of those uses dlvsym to find the corresponding symbol in glibc.

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

  parent reply	other threads:[~2021-08-10  9:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-14932-131@http.sourceware.org/bugzilla/>
2014-02-07  3:05 ` jsm28 at gcc dot gnu.org
2014-06-14  7:38 ` fweimer at redhat dot com
2014-10-27 18:47 ` carlos at redhat dot com
2021-02-09 18:07 ` i at maskray dot me
2021-08-10  9:59 ` jakub at redhat dot com [this message]
2021-08-10 10:07 ` fweimer at redhat dot com
2021-08-10 18:21 ` ppluzhnikov at google dot com
2022-05-20  7:40 ` i at maskray dot me
2022-05-27 19:47 ` i at maskray dot me
2022-05-27 20:09 ` i at maskray dot me

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-14932-131-fmFtGwiyG6@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).