public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: GNU C Library <libc-alpha@sourceware.org>, jma14 <jma14@rice.edu>,
	 "Carlos O'Donell" <carlos@redhat.com>,
	John Mellor-Crummey <johnmc@rice.edu>
Subject: [PATCH] elf: Replace tst-audit24bmod2.so with tst-audit24bmod2
Date: Sun, 6 Feb 2022 11:17:31 -0800	[thread overview]
Message-ID: <CAMe9rOq4Y0r6jY6fSa70K0_yJM_LdSAJUh6LSZExJxf4AwRMAQ@mail.gmail.com> (raw)
In-Reply-To: <20220201144636.2129852-4-adhemerval.zanella@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 6852 bytes --]

On Tue, Feb 1, 2022 at 6:49 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> The audit symbind callback is not called for binaries built with
> -Wl,-z,now or when LD_BIND_NOW=1 is used, nor the PLT tracking callbacks
> (plt_enter and plt_exit) since this would change the expected
> program semantics (where no PLT is expected) and would have performance
> implications (such as for BZ#15533).
>
> LAV_CURRENT is also bumped to indicate the audit ABI change (where
> la_symbind flags are set by the loader to indicate no possible PLT
> trace).
>
> To handle powerpc64 ELFv1 function descriptor, _dl_audit_symbind
> requires to know whether bind-now is used so the symbol value is
> updated to function text segment instead of the OPD (for lazy binding
> this is done by PPC64_LOAD_FUNCPTR on _dl_runtime_resolve).
>
> Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
> powerpc64-linux-gnu.
> ---
>  NEWS                           |   4 +
>  bits/link_lavcurrent.h         |   2 +-
>  elf/Makefile                   |  89 ++++++++++++++++++++++-
>  elf/dl-audit.c                 |  58 +++++++++------
>  elf/do-rel.h                   |  57 +++++++++++----
>  elf/sotruss-lib.c              |   7 ++
>  elf/tst-audit24a.c             |  36 +++++++++
>  elf/tst-audit24amod1.c         |  31 ++++++++
>  elf/tst-audit24amod2.c         |  25 +++++++
>  elf/tst-audit24b.c             |  37 ++++++++++
>  elf/tst-audit24bmod1.c         |  31 ++++++++
>  elf/tst-audit24bmod2.c         |  23 ++++++
>  elf/tst-audit24c.c             |   2 +
>  elf/tst-audit24d.c             |  36 +++++++++
>  elf/tst-audit24dmod1.c         |  33 +++++++++
>  elf/tst-audit24dmod2.c         |  28 +++++++
>  elf/tst-audit24dmod3.c         |  31 ++++++++
>  elf/tst-audit24dmod4.c         |  25 +++++++
>  elf/tst-audit25a.c             | 129 +++++++++++++++++++++++++++++++++
>  elf/tst-audit25b.c             | 128 ++++++++++++++++++++++++++++++++
>  elf/tst-audit25mod1.c          |  30 ++++++++
>  elf/tst-audit25mod2.c          |  30 ++++++++
>  elf/tst-audit25mod3.c          |  22 ++++++
>  elf/tst-audit25mod4.c          |  22 ++++++
>  elf/tst-auditmod24.h           |  29 ++++++++
>  elf/tst-auditmod24a.c          | 114 +++++++++++++++++++++++++++++
>  elf/tst-auditmod24b.c          | 104 ++++++++++++++++++++++++++
>  elf/tst-auditmod24c.c          |   3 +
>  elf/tst-auditmod24d.c          | 120 ++++++++++++++++++++++++++++++
>  elf/tst-auditmod25.c           |  79 ++++++++++++++++++++
>  sysdeps/generic/dl-lookupcfg.h |   3 +
>  sysdeps/generic/ldsodefs.h     |   5 +-
>  sysdeps/hppa/dl-lookupcfg.h    |   3 +
>  sysdeps/ia64/dl-lookupcfg.h    |   3 +
>  sysdeps/powerpc/dl-lookupcfg.h |  39 ++++++++++
>  35 files changed, 1379 insertions(+), 39 deletions(-)
>  create mode 100644 elf/tst-audit24a.c
>  create mode 100644 elf/tst-audit24amod1.c
>  create mode 100644 elf/tst-audit24amod2.c
>  create mode 100644 elf/tst-audit24b.c
>  create mode 100644 elf/tst-audit24bmod1.c
>  create mode 100644 elf/tst-audit24bmod2.c
>  create mode 100644 elf/tst-audit24c.c
>  create mode 100644 elf/tst-audit24d.c
>  create mode 100644 elf/tst-audit24dmod1.c
>  create mode 100644 elf/tst-audit24dmod2.c
>  create mode 100644 elf/tst-audit24dmod3.c
>  create mode 100644 elf/tst-audit24dmod4.c
>  create mode 100644 elf/tst-audit25a.c
>  create mode 100644 elf/tst-audit25b.c
>  create mode 100644 elf/tst-audit25mod1.c
>  create mode 100644 elf/tst-audit25mod2.c
>  create mode 100644 elf/tst-audit25mod3.c
>  create mode 100644 elf/tst-audit25mod4.c
>  create mode 100644 elf/tst-auditmod24.h
>  create mode 100644 elf/tst-auditmod24a.c
>  create mode 100644 elf/tst-auditmod24b.c
>  create mode 100644 elf/tst-auditmod24c.c
>  create mode 100644 elf/tst-auditmod24d.c
>  create mode 100644 elf/tst-auditmod25.c
>  create mode 100644 sysdeps/powerpc/dl-lookupcfg.h
>
> diff --git a/NEWS b/NEWS
> index 61acf41e66..34151fb3f3 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -168,6 +168,10 @@ Deprecated and removed features, and other changes affecting compatibility:
>    removal of the LD_TRACE_PRELINKING, and LD_USE_LOAD_BIAS, environment
>    variables and their functionality in the dynamic loader.
>
> +* The audit module interface version LAV_CURRENT is increased to enable
> +  proper bind-now support.  The loader now advertises via the la_symbind
> +  flags that PLT trace is not possible.
> +
>  Changes to build and runtime requirements:
>
>    [Add changes to build and runtime requirements here]
> diff --git a/bits/link_lavcurrent.h b/bits/link_lavcurrent.h
> index 7bfa4b9f4e..a852d41302 100644
> --- a/bits/link_lavcurrent.h
> +++ b/bits/link_lavcurrent.h
> @@ -22,4 +22,4 @@
>  #endif
>
>  /* Version numbers for la_version handshake interface.  */
> -#define LAV_CURRENT    1
> +#define LAV_CURRENT    2
> diff --git a/elf/Makefile b/elf/Makefile
> index 72ba6a1e66..e380b26d8a 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -380,6 +380,12 @@ tests += \
>    tst-audit21 \
>    tst-audit22 \
>    tst-audit23 \
> +  tst-audit24a \
> +  tst-audit24b \
> +  tst-audit24c \
> +  tst-audit24d \
> +  tst-audit25a \
> +  tst-audit25b \
>    tst-auditmany \
>    tst-auxobj \
>    tst-auxobj-dlopen \
> @@ -677,6 +683,18 @@ modules-names = \
>    tst-audit18mod \
>    tst-audit19bmod \
>    tst-audit23mod \
> +  tst-audit24amod1 \
> +  tst-audit24amod2 \
> +  tst-audit24bmod1 \
> +  tst-audit24bmod2 \
> +  tst-audit24dmod1 \
> +  tst-audit24dmod2 \
> +  tst-audit24dmod3 \
> +  tst-audit24dmod4 \
> +  tst-audit25mod1 \
> +  tst-audit25mod2 \
> +  tst-audit25mod3 \
> +  tst-audit25mod4 \
>    tst-auditlogmod-1 \
>    tst-auditlogmod-2 \
>    tst-auditlogmod-3 \
> @@ -702,6 +720,11 @@ modules-names = \
>    tst-auditmod21b \
>    tst-auditmod22 \
>    tst-auditmod23 \
> +  tst-auditmod24a \
> +  tst-auditmod24b \
> +  tst-auditmod24c \
> +  tst-auditmod24d \
> +  tst-auditmod25 \
>    tst-auxvalmod \
>    tst-big-note-lib \
>    tst-deep1mod1 \
> @@ -919,7 +942,8 @@ extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
>
>  # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
>  # rules.
> -modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod
> +modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod \
> +                        tst-audit24bmod1 tst-audit24bmod2.so

             ^^^^ Not needed.

I got

make[2]: Entering directory '/export/gnu/import/git/gitlab/x86-glibc/elf'
Makefile:2201: warning: overriding recipe for target
'/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/elf/tst-audit24bmod2.so'
../Makerules:765: warning: ignoring old recipe for target
'/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/elf/tst-audit24bmod2.so'

I am testing the enclosed patch and will push it if tests pass.

H.J.

[-- Attachment #2: 0001-elf-Replace-tst-audit24bmod2.so-with-tst-audit24bmod.patch --]
[-- Type: application/x-patch, Size: 1191 bytes --]

  parent reply	other threads:[~2022-02-06 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 14:46 [PATCH v13 0/4] Multiple rtld-audit fixes Adhemerval Zanella
2022-02-01 14:46 ` [PATCH v13 1/4] elf: Add la_activity during application exit Adhemerval Zanella
2022-02-01 15:55   ` Carlos O'Donell
2022-02-01 14:46 ` [PATCH v13 2/4] elf: Fix initial-exec TLS access on audit modules (BZ #28096) Adhemerval Zanella
2022-02-01 15:57   ` Carlos O'Donell
2022-02-01 14:46 ` [PATCH v13 3/4] elf: Issue la_symbind for bind-now (BZ #23734) Adhemerval Zanella
2022-02-01 15:58   ` Carlos O'Donell
2022-02-02 13:57   ` Szabolcs Nagy
2022-02-06 19:17   ` H.J. Lu [this message]
2022-02-07 11:03     ` [PATCH] elf: Replace tst-audit24bmod2.so with tst-audit24bmod2 Adhemerval Zanella
2022-02-22 14:56       ` H.J. Lu
2022-02-01 14:46 ` [PATCH v13 4/4] elf: Fix runtime linker auditing on aarch64 (BZ #26643) Adhemerval Zanella
2022-02-01 16:00   ` Carlos O'Donell

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=CAMe9rOq4Y0r6jY6fSa70K0_yJM_LdSAJUh6LSZExJxf4AwRMAQ@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=jma14@rice.edu \
    --cc=johnmc@rice.edu \
    --cc=libc-alpha@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).