Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Nov 2023 21:42:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 275393] RTLD_DEEPBIND semantics not quite right
Message-ID:  <bug-275393-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275393

            Bug ID: 275393
           Summary: RTLD_DEEPBIND semantics not quite right
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: kevans@freebsd.org

Created attachment 246617
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D246617&action=
=3Dedit
Minimal reproducer

Consider the attached example, with a build.sh to build it:

libutil provides get_value, set_value -- it's built into both libutil.so and
libutil2.so, two separate libraries with purposefully conflicting symbols

libfoo provides print_value (which calls get_value) and links against libut=
il2

app links against libutil and dlopens $ORIGIN/libfoo.so with RTLD_DEEPBIND =
and
calls set_value(5) to get a different value for get_value()

On Linux, this prints:

% ./app
application value 5
library value: 10

On FreeBSD:

$ ./app=20=20
application value 5
library value: 5

So under glibc, symbol_lookup from the dlopened image prefers symbols from =
the
same chain of objects that were loaded at that dlopen time, not just the sa=
me
image.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275393-227>