unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <codonell@redhat.com>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH 1/4] elf: Introduce the rtld-stubbed-symbols makefile variable
Date: Fri, 14 Feb 2020 17:36:29 -0500	[thread overview]
Message-ID: <1d569ea5-e1ad-79c3-87f4-6c321fa2336c@redhat.com> (raw)
In-Reply-To: <3e85b3e4993068ae16d283c548c17823106f132a.1581182210.git.fweimer@redhat.com>

On 2/8/20 2:00 PM, Florian Weimer wrote:
> This generalizes a mechanism used for stack-protector support, so
> that it can be applied to other symbols if required.
> 
> Tested on i686-linux-gnu without the stack protector, and on
> x86_64-linux-gnu with stack-protector-strong.

OK for master.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  elf/Makefile | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/elf/Makefile b/elf/Makefile
> index 632a4d8b0f..60c8082d06 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -482,21 +482,25 @@ $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
>  # are compiled with special flags, and puts these modules into rtld-libc.a
>  # for us.  Then we do the real link using rtld-libc.a instead of libc_pic.a.
>  
> -# If the compiler can do SSP, build the mapfile with dummy __stack_chk_fail
> -# and __stack_chk_fail_local symbols defined, to prevent the real things
> -# being dragged into rtld even though rtld is never built with stack-
> -# protection.
> +# These symbols need to be stubbed out during symbol discovery because
> +# their implementation is provided differently in rtld, and the symbol
> +# discovery mechanism is not compatible with the libc implementation
> +# when compiled for libc.
> +rtld-stubbed-symbols =
> +
> +# The GCC arguments that implement $(rtld-stubbed-symbols).
> +rtld-stubbed-symbols-args = \
> +  $(patsubst %,-Wl$(comma)--defsym=%=0, $(rtld-stubbed-symbols))
>  
>  ifeq ($(have-ssp),yes)
> -dummy-stack-chk-fail := -Wl,--defsym='__stack_chk_fail=0' \
> -			-Wl,--defsym='__stack_chk_fail_local=0'
> -else
> -dummy-stack-chk-fail :=
> +# rtld is not built with the stack protector, so these references will
> +# go away in the rebuilds.
> +rtld-stubbed-symbols += __stack_chk_fail __stack_chk_fail_local
>  endif
>  
>  $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
>  	@-rm -f $@T
> -	$(reloc-link) -o $@.o $(dummy-stack-chk-fail) \
> +	$(reloc-link) -o $@.o $(rtld-stubbed-symbols-args) \
>  		'-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
>  	rm -f $@.o
>  	mv -f $@T $@
> 


-- 
Cheers,
Carlos.


  reply	other threads:[~2020-02-14 22:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-08 19:00 [PATCH 0/4] Avoid malloc symbol interposition in the dynamic loader [BZ #25486] Florian Weimer
2020-02-08 19:00 ` [PATCH 1/4] elf: Introduce the rtld-stubbed-symbols makefile variable Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell [this message]
2020-02-08 19:01 ` [PATCH 2/4] elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.c Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-08 19:01 ` [PATCH 3/4] Remove weak declaration of free from <inline-hashtab.h> Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-08 19:01 ` [PATCH 4/4] ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-24 11:53   ` Florian Weimer
2020-02-14 22:36 ` [PATCH 0/4] Avoid malloc symbol interposition in the dynamic loader " Carlos O'Donell
2020-02-17 12:25 ` Lucas A. M. Magalhaes

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=1d569ea5-e1ad-79c3-87f4-6c321fa2336c@redhat.com \
    --to=codonell@redhat.com \
    --cc=fweimer@redhat.com \
    --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).