public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, jma14 <jma14@rice.edu>,
	Carlos O'Donell <carlos@redhat.com>,
	John Mellor-Crummey <johnmc@rice.edu>
Subject: Re: [PATCH v13 3/4] elf: Issue la_symbind for bind-now (BZ #23734)
Date: Wed, 2 Feb 2022 13:57:52 +0000	[thread overview]
Message-ID: <20220202135752.GK1989194@arm.com> (raw)
In-Reply-To: <20220201144636.2129852-4-adhemerval.zanella@linaro.org>

The 02/01/2022 11:46, Adhemerval Zanella via Libc-alpha 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.

with a default bind now toolchain i see

FAIL: elf/tst-audit25a

> +$(objpfx)tst-audit25a.out: $(objpfx)tst-auditmod25.so
> +$(objpfx)tst-audit25a: $(objpfx)tst-audit25mod1.so \
> +		       $(objpfx)tst-audit25mod2.so \
> +		       $(objpfx)tst-audit25mod3.so \
> +		       $(objpfx)tst-audit25mod4.so
> +$(objpfx)tst-audit25mod1.so: $(objpfx)tst-audit25mod3.so
> +LDFLAGS-tst-audit25mod1.so = -Wl,-z,now
> +$(objpfx)tst-audit25mod2.so: $(objpfx)tst-audit25mod4.so
> +LDFLAGS-tst-audit25mod2.so = -Wl,-z,lazy
> +tst-audit25a-ARGS = -- $(host-test-program-cmd)

i guess we need to add -Wl,-z,lazy explicitly to tst-audit25a too

> +    /* tst-audit25a is build with -Wl,-z,lazy and tst-audit25mod1 with
> +       -Wl,-z,now; so only tst_audit25mod3_func1 should be expected to
> +       have LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT.  */
> +    TEST_COMPARE_STRING (result.err.buffer,
> +			 "la_symbind: tst_audit25mod3_func1 1\n"
> +			 "la_symbind: tst_audit25mod1_func1 0\n"
> +			 "la_symbind: tst_audit25mod1_func2 0\n"
> +			 "la_symbind: tst_audit25mod2_func1 0\n"
> +			 "la_symbind: tst_audit25mod4_func1 0\n"
> +			 "la_symbind: tst_audit25mod2_func2 0\n");
> +

tst-audit25a.c:93: error: string comparison failed
  string length: 216 bytes
  left (evaluated from result.err.buffer):
      "la_symbind: tst_audit25mod3_func1 1\nla_symbind: tst_audit25mod1_func1 1\nla_symbind: tst_audit25mod2_func1 1\nla_symbind: tst_audit25mod1_func2 1\nla_symbind: tst_audit25mod2_func2 1\nla_symbind: tst_audit25mod4_func1 0\n"
      6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 33 5F 66 75 6E 63 31 20 31 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 31 5F 66 75 6E 63 31 20 31 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 32 5F 66 75 6E 63 31 20 31 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 31 5F 66 75 6E 63 32 20 31 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 32 5F 66 75 6E 63 32 20 31 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 34 5F 66 75 6E 63 31 20 30 0A
  right (evaluated from "la_symbind: tst_audit25mod3_func1 1\n" "la_symbind: tst_audit25mod1_func1 0\n" "la_symbind: tst_audit25mod1_func2 0\n" "la_symbind: tst_audit25mod2_func1 0\n" "la_symbind: tst_audit25mod4_func1 0\n" "la_symbind: tst_audit25mod2_func2 0\n"):
      "la_symbind: tst_audit25mod3_func1 1\nla_symbind: tst_audit25mod1_func1 0\nla_symbind: tst_audit25mod1_func2 0\nla_symbind: tst_audit25mod2_func1 0\nla_symbind: tst_audit25mod4_func1 0\nla_symbind: tst_audit25mod2_func2 0\n"
      6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 33 5F 66 75 6E 63 31 20 31 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 31 5F 66 75 6E 63 31 20 30 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 31 5F 66 75 6E 63 32 20 30 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 32 5F 66 75 6E 63 31 20 30 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 34 5F 66 75 6E 63 31 20 30 0A 6C 61 5F 73 79 6D 62 69 6E 64 3A 20 74 73 74 5F 61 75 64 69 74 32 35 6D 6F 64 32 5F 66 75 6E 63 32 20 30 0A
error: 1 test failures

and

$ readelf -d elf/tst-audit25a |grep -i flags
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE


  parent reply	other threads:[~2022-02-02 13:58 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 [this message]
2022-02-06 19:17   ` [PATCH] elf: Replace tst-audit24bmod2.so with tst-audit24bmod2 H.J. Lu
2022-02-07 11:03     ` 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=20220202135752.GK1989194@arm.com \
    --to=szabolcs.nagy@arm.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).