unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Re: Emit a warning when -z relro is unsupported
       [not found]   ` <20200729003850.GO9601@bubble.grove.modra.org>
@ 2020-07-29  7:10     ` Alan Modra via Libc-alpha
  2020-07-29 16:25       ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra via Libc-alpha @ 2020-07-29  7:10 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, binutils

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

I believe the ia64-linux glibc problem is triggered by a fairly simple
glibc build bug.  There is a linker bug too.

I was able to reproduce the problem, with
.IA_64.unwind__libc_freeres_fn being mapped to bfd_abs_section, which
is what happens when a section is discarded by a linker script.

On looking at glibc/shlib.lds I see toward the end:

  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_/home/local/bin/../lib/gcc/ia64-linux/9.3.1/../../../../ia64-linux/bin/ld: warning: -z relro ignored
*) }
}

Uh oh, the script will discard all orphan sections due to *(*)
appearing.  (Yes there are some odd section match patterns before
that from the warning, but the final * gets everything.)

Now .IA_64.unwind__libc_freeres_fn is not an orphan, but it is
SHF_LINK_ORDER and __libc_freeres_fn is its linked-to section, and
that one is an orphan.  ldelf_before_place_orphans handles linked-to
sections, correctly discarding .IA_64.unwind__libc_freeres_fn but
failing to set SEC_EXCLUDE which would avoid the ldwrite.c assertion.

glibc patch attached

-- 
Alan Modra
Australia Development Lab, IBM

[-- Attachment #2: 0006-Don-t-mix-linker-error-messages-into-edited-scripts.patch --]
[-- Type: text/x-diff, Size: 1110 bytes --]

From 3425515f19d47eb2e13180fe031d94a9c13ce39b Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 29 Jul 2020 16:28:57 +0930
Subject: Don't mix linker error messages into edited scripts

	* Makerules (shlib.lds): Discard linker warning output.
	(format.lds): Likewise.

diff --git a/Makerules b/Makerules
index 341db86c7e..ef0fe67d9a 100644
--- a/Makerules
+++ b/Makerules
@@ -557,7 +557,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
 	$(LINK.o) -shared -Wl,-O1 \
 		  -nostdlib -nostartfiles \
 		  $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
-		  -Wl,--verbose 2>&1 | \
+		  -Wl,--verbose 2>/dev/null | \
 	  sed > $@T \
 	      -e '/^=========/,/^=========/!d;/^=========/d' \
 	      $(if $(filter yes,$(have-hash-style)), \
@@ -1073,7 +1073,7 @@ ifneq (unknown,$(output-format))
 else
 	$(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
 		  $(LDFLAGS.so) $(LDFLAGS-lib.so) \
-		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
+		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>/dev/null \
 	| sed -n -f $< > $@.new
 	test -s $@.new
 	rm -f $@.so

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Emit a warning when -z relro is unsupported
  2020-07-29  7:10     ` Emit a warning when -z relro is unsupported Alan Modra via Libc-alpha
@ 2020-07-29 16:25       ` Florian Weimer via Libc-alpha
  2020-07-29 22:47         ` Joseph Myers
  2020-08-04 20:57         ` Carlos O'Donell via Libc-alpha
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Weimer via Libc-alpha @ 2020-07-29 16:25 UTC (permalink / raw)
  To: Alan Modra via Libc-alpha; +Cc: binutils, Joseph Myers, Alan Modra

* Alan Modra via Libc-alpha:

> From 3425515f19d47eb2e13180fe031d94a9c13ce39b Mon Sep 17 00:00:00 2001
> From: Alan Modra <amodra@gmail.com>
> Date: Wed, 29 Jul 2020 16:28:57 +0930
> Subject: Don't mix linker error messages into edited scripts
>
> 	* Makerules (shlib.lds): Discard linker warning output.
> 	(format.lds): Likewise.
>
> diff --git a/Makerules b/Makerules
> index 341db86c7e..ef0fe67d9a 100644
> --- a/Makerules
> +++ b/Makerules
> @@ -557,7 +557,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
>  	$(LINK.o) -shared -Wl,-O1 \
>  		  -nostdlib -nostartfiles \
>  		  $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
> -		  -Wl,--verbose 2>&1 | \
> +		  -Wl,--verbose 2>/dev/null | \
>  	  sed > $@T \
>  	      -e '/^=========/,/^=========/!d;/^=========/d' \
>  	      $(if $(filter yes,$(have-hash-style)), \
> @@ -1073,7 +1073,7 @@ ifneq (unknown,$(output-format))
>  else
>  	$(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
>  		  $(LDFLAGS.so) $(LDFLAGS-lib.so) \
> -		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
> +		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>/dev/null \
>  	| sed -n -f $< > $@.new
>  	test -s $@.new
>  	rm -f $@.so

This change looks reasonable to me.  Thanks for tracking this down.

We are in the glibc 2.32, so Carlos as the release manager needs to
approve this.

Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emit a warning when -z relro is unsupported
  2020-07-29 16:25       ` Florian Weimer via Libc-alpha
@ 2020-07-29 22:47         ` Joseph Myers
  2020-08-04 20:57         ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 5+ messages in thread
From: Joseph Myers @ 2020-07-29 22:47 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Alan Modra via Libc-alpha, binutils, Alan Modra

On Wed, 29 Jul 2020, Florian Weimer via Libc-alpha wrote:

> This change looks reasonable to me.  Thanks for tracking this down.
> 
> We are in the glibc 2.32, so Carlos as the release manager needs to
> approve this.

I confirm this patch gets clean test results for build-many-glibcs.py 
(compilers and glibcs) with GCC 9 branch (where previously ia64 failed).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emit a warning when -z relro is unsupported
  2020-07-29 16:25       ` Florian Weimer via Libc-alpha
  2020-07-29 22:47         ` Joseph Myers
@ 2020-08-04 20:57         ` Carlos O'Donell via Libc-alpha
  2020-08-04 23:54           ` Carlos O'Donell via Libc-alpha
  1 sibling, 1 reply; 5+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2020-08-04 20:57 UTC (permalink / raw)
  To: Florian Weimer, Alan Modra via Libc-alpha
  Cc: binutils, Joseph Myers, Alan Modra

On 7/29/20 12:25 PM, Florian Weimer via Libc-alpha wrote:
> * Alan Modra via Libc-alpha:
> 
>> From 3425515f19d47eb2e13180fe031d94a9c13ce39b Mon Sep 17 00:00:00 2001
>> From: Alan Modra <amodra@gmail.com>
>> Date: Wed, 29 Jul 2020 16:28:57 +0930
>> Subject: Don't mix linker error messages into edited scripts
>>
>> 	* Makerules (shlib.lds): Discard linker warning output.
>> 	(format.lds): Likewise.
>>
>> diff --git a/Makerules b/Makerules
>> index 341db86c7e..ef0fe67d9a 100644
>> --- a/Makerules
>> +++ b/Makerules
>> @@ -557,7 +557,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
>>  	$(LINK.o) -shared -Wl,-O1 \
>>  		  -nostdlib -nostartfiles \
>>  		  $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
>> -		  -Wl,--verbose 2>&1 | \
>> +		  -Wl,--verbose 2>/dev/null | \
>>  	  sed > $@T \
>>  	      -e '/^=========/,/^=========/!d;/^=========/d' \
>>  	      $(if $(filter yes,$(have-hash-style)), \
>> @@ -1073,7 +1073,7 @@ ifneq (unknown,$(output-format))
>>  else
>>  	$(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
>>  		  $(LDFLAGS.so) $(LDFLAGS-lib.so) \
>> -		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
>> +		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>/dev/null \
>>  	| sed -n -f $< > $@.new
>>  	test -s $@.new
>>  	rm -f $@.so
> 
> This change looks reasonable to me.  Thanks for tracking this down.
> 
> We are in the glibc 2.32, so Carlos as the release manager needs to
> approve this.

I'm testing this fix for inclusion today before I cut the branch.

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emit a warning when -z relro is unsupported
  2020-08-04 20:57         ` Carlos O'Donell via Libc-alpha
@ 2020-08-04 23:54           ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2020-08-04 23:54 UTC (permalink / raw)
  To: Florian Weimer, Alan Modra via Libc-alpha
  Cc: binutils, Joseph Myers, Alan Modra

On 8/4/20 4:57 PM, Carlos O'Donell wrote:
> On 7/29/20 12:25 PM, Florian Weimer via Libc-alpha wrote:
>> * Alan Modra via Libc-alpha:
>>
>>> From 3425515f19d47eb2e13180fe031d94a9c13ce39b Mon Sep 17 00:00:00 2001
>>> From: Alan Modra <amodra@gmail.com>
>>> Date: Wed, 29 Jul 2020 16:28:57 +0930
>>> Subject: Don't mix linker error messages into edited scripts
>>>
>>> 	* Makerules (shlib.lds): Discard linker warning output.
>>> 	(format.lds): Likewise.
>>>
>>> diff --git a/Makerules b/Makerules
>>> index 341db86c7e..ef0fe67d9a 100644
>>> --- a/Makerules
>>> +++ b/Makerules
>>> @@ -557,7 +557,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
>>>  	$(LINK.o) -shared -Wl,-O1 \
>>>  		  -nostdlib -nostartfiles \
>>>  		  $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
>>> -		  -Wl,--verbose 2>&1 | \
>>> +		  -Wl,--verbose 2>/dev/null | \
>>>  	  sed > $@T \
>>>  	      -e '/^=========/,/^=========/!d;/^=========/d' \
>>>  	      $(if $(filter yes,$(have-hash-style)), \
>>> @@ -1073,7 +1073,7 @@ ifneq (unknown,$(output-format))
>>>  else
>>>  	$(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
>>>  		  $(LDFLAGS.so) $(LDFLAGS-lib.so) \
>>> -		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
>>> +		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>/dev/null \
>>>  	| sed -n -f $< > $@.new
>>>  	test -s $@.new
>>>  	rm -f $@.so
>>
>> This change looks reasonable to me.  Thanks for tracking this down.
>>
>> We are in the glibc 2.32, so Carlos as the release manager needs to
>> approve this.
> 
> I'm testing this fix for inclusion today before I cut the branch.
 
Fix looks good. I just pushed for glibc 2.32. Thanks Alan!

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

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-04 23:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200619024818.GA21885@bubble.grove.modra.org>
     [not found] ` <alpine.DEB.2.21.2007282255020.6112@digraph.polyomino.org.uk>
     [not found]   ` <20200729003850.GO9601@bubble.grove.modra.org>
2020-07-29  7:10     ` Emit a warning when -z relro is unsupported Alan Modra via Libc-alpha
2020-07-29 16:25       ` Florian Weimer via Libc-alpha
2020-07-29 22:47         ` Joseph Myers
2020-08-04 20:57         ` Carlos O'Donell via Libc-alpha
2020-08-04 23:54           ` Carlos O'Donell via Libc-alpha

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).