From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
To: Fangrui Song <maskray@google.com>
Cc: llvm-dev@lists.llvm.org, GCC Development <gcc@gcc.gnu.org>,
GNU C Library <libc-alpha@sourceware.org>,
GNU gABI gnu-gabi <gnu-gabi@sourceware.org>,
Binutils <binutils@sourceware.org>
Subject: Re: [llvm-dev] RFC: Add GNU_PROPERTY_1_NEEDED
Date: Fri, 18 Jun 2021 18:09:42 -0700 [thread overview]
Message-ID: <CAMe9rOqfafrbi6eetgW=P0N_69rt3JLvhoCzQYAQoWE+S+ThOA@mail.gmail.com> (raw)
In-Reply-To: <20210618213450.qdasgofw6hklzxip@google.com>
On Fri, Jun 18, 2021 at 2:34 PM Fangrui Song <maskray@google.com> wrote:
>
> On 2021-06-18, H.J. Lu via llvm-dev wrote:
> >Add GNU_PROPERTY_1_NEEDED:
> >
> > #define GNU_PROPERTY_1_NEEDED GNU_PROPERTY_UINT32_OR_LO
> >
> >to indicate the needed properties by the object file.
> >
>
> I am fine with this logical OR style usage. But see below, do we need it
> for ld.so runtime check?
I implemented run-time check on users/hjl/single-global/master branch:
https://gitlab.com/x86-glibc/glibc/-/commits/users/hjl/single-global/master
with tests:
[hjl@gnu-cfl-2 build-x86_64-linux]$ elf/tst-protected1a
copy relocation against non-copyable protected symbol=protected1 in
file=/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-protected1moda.so
[hjl@gnu-cfl-2 build-x86_64-linux]$ elf/tst-protected2a
`protected1' in main and moda doesn't have the same address
non-canonical reference to canonical protected function
symbol=protected1 in
file=/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-protected2moda.so
[hjl@gnu-cfl-2 build-x86_64-linux]$
I prefer these over random run-time failures.
> (As I mentioned previously, I do not know how an AND-style property can
> be used/deployed if old object files without the .note.gnu.property is
> considered to have a value of 0.)
>
> >Add GNU_PROPERTY_1_NEEDED_SINGLE_GLOBAL_DEFINITION:
> >
> > #define GNU_PROPERTY_1_NEEDED_SINGLE_GLOBAL_DEFINITION (1U << 0)
> >
> >to indicate that the object file requires canonical function pointers and
> >cannot be used with copy relocation.
>
> In https://sourceware.org/pipermail/gnu-gabi/2021q2/000481.html you gave
> a rationale
>
> "The issue is that libfoo.so used in link-time can be different from
> libfoo.so at run-time. The symbol, foobar, in libfoo.so at link-time
> has the default visibility. But foobar in libfoo.so at run-time can be
> protected. ld.so should detect such cases which can lead to run-time
> failures."
>
> First, I think such dynamic symbol visibility change is uncommon.
I can imagine that some libraries want to switch to protected symbols.
> Second, if ld.so finds that a symbol lookup for (st_value==0
> st_shndx==SHN_UNDEF) will bind to a STV_PROTECTED definition in a shared
> object, can the diagnostic be moved there?
> The compatibility property is per-symbol and the symbol lookup is a
> perfect place for a diagnostic, like a symbol versioning error.
>
>
> I guess GCC folks may get noticed if you start a thread adding
> -fsingle-global-definition, otherwise many people who have opinions may
> just ignore threads about GNU PROPERTY addition.
Binutils changes are at
https://gitlab.com/x86-binutils/binutils-gdb/-/tree/users/hjl/property/master
GCC changes are next.
> >
> >The PDF file is at
> >
> >https://gitlab.com/x86-psABIs/Linux-ABI/-/wikis/uploads/9eca2f2defe62b0c5015bf2e3e8a9f05/Linux-gABI-1_needed-2021-06-18.pdf
--
H.J.
prev parent reply other threads:[~2021-06-19 1:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 17:06 RFC: Add GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX H.J. Lu via Libc-alpha
2021-01-21 15:02 ` H.J. Lu via Libc-alpha
2021-01-21 21:42 ` Fangrui Song
2021-04-17 12:48 ` H.J. Lu via Libc-alpha
2021-04-17 18:25 ` Fangrui Song
2021-04-17 19:05 ` H.J. Lu via Libc-alpha
2021-06-17 18:59 ` H.J. Lu via Libc-alpha
2021-06-17 19:38 ` [llvm-dev] " Fangrui Song via Libc-alpha
2021-06-17 19:45 ` H.J. Lu via Libc-alpha
2021-06-17 20:25 ` Fāng-ruì Sòng via Libc-alpha
2021-06-17 23:01 ` H.J. Lu via Libc-alpha
2021-06-18 0:06 ` Fāng-ruì Sòng via Libc-alpha
2021-06-18 0:24 ` H.J. Lu via Libc-alpha
2021-06-18 0:49 ` Fāng-ruì Sòng via Libc-alpha
2021-06-18 2:40 ` H.J. Lu via Libc-alpha
2021-06-21 14:35 ` Michael Matz
2021-06-22 14:30 ` H.J. Lu via Libc-alpha
2021-06-22 14:54 ` Michael Matz
2021-06-18 2:45 ` H.J. Lu via Libc-alpha
2021-06-18 15:38 ` RFC: Add GNU_PROPERTY_1_NEEDED H.J. Lu via Libc-alpha
2021-06-18 21:34 ` [llvm-dev] " Fangrui Song via Libc-alpha
2021-06-19 1:09 ` H.J. Lu via Libc-alpha [this message]
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMe9rOqfafrbi6eetgW=P0N_69rt3JLvhoCzQYAQoWE+S+ThOA@mail.gmail.com' \
--to=libc-alpha@sourceware.org \
--cc=binutils@sourceware.org \
--cc=gcc@gcc.gnu.org \
--cc=gnu-gabi@sourceware.org \
--cc=hjl.tools@gmail.com \
--cc=llvm-dev@lists.llvm.org \
--cc=maskray@google.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.
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).