public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] hppa: Fix setting of __libc_stack_end
@ 2017-02-21  1:32 John David Anglin
  2017-03-15 20:44 ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: John David Anglin @ 2017-02-21  1:32 UTC (permalink / raw)
  To: GNU C Library
  Cc: Helge Deller, Carlos O'Donell, Mike Frysinger, Aurelien Jarno

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

The binutils package was recently changed to fix -z relro support on hppa.  See ld/21000 for details:
https://sourceware.org/bugzilla/show_bug.cgi?id=21000

This exposed a problem with the _dl_start_user function in the RTLD_START define.  We need to
set __libc_stack_end before it is made read only.  For this, we need to define DL_STACK_END.
The offset of 0x160 gives the same stack end as the code in _dl_start_user.

A build log with the attached patch is here:
https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=hppa&ver=2.24-9&stamp=1487639205&raw=0

I don't have write permission, so somebody should commit this for me. Thanks.

Dave
--
John David Anglin	dave.anglin@bell.net



[-- Attachment #2: dl-machine.h.d.txt --]
[-- Type: text/plain, Size: 1312 bytes --]

2017-02-20  John David Anglin  <danglin@gcc.gnu.org>

	* sysdeps/hppa/dl-machine.h (DL_STACK_END): Define.
	(RTLD_START): Don't record stack end address in _dl_start_user.

diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index 339c7bb771..787b95f502 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -302,6 +302,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 #define ARCH_LA_PLTENTER hppa_gnu_pltenter
 #define ARCH_LA_PLTEXIT hppa_gnu_pltexit
 
+/* Adjust DL_STACK_END to get value we want in __libc_stack_end.  */
+#define DL_STACK_END(cookie) \
+  ((void *) (((long) (cookie)) + 0x160))
+
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
@@ -401,11 +405,6 @@ asm (									\
 	/* Save the entry point in %r3. */				\
 "	copy	%ret0,%r3\n"						\
 									\
-	/* Remember the lowest stack address. */			\
-"	addil	LT'__libc_stack_end,%r19\n"				\
-"	ldw	RT'__libc_stack_end(%r1),%r20\n"			\
-"	stw	%sp,0(%r20)\n"						\
-									\
 	/* See if we were called as a command with the executable file	\
 	   name as an extra leading argument. */			\
 "	addil	LT'_dl_skip_args,%r19\n"				\

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

* Re: [PATCH] hppa: Fix setting of __libc_stack_end
  2017-02-21  1:32 [PATCH] hppa: Fix setting of __libc_stack_end John David Anglin
@ 2017-03-15 20:44 ` Mike Frysinger
  2017-03-15 21:00   ` John David Anglin
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2017-03-15 20:44 UTC (permalink / raw)
  To: John David Anglin
  Cc: GNU C Library, Helge Deller, Carlos O'Donell, Aurelien Jarno

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

On 20 Feb 2017 20:31, John David Anglin wrote:
> The binutils package was recently changed to fix -z relro support on hppa.  See ld/21000 for details:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21000
> 
> This exposed a problem with the _dl_start_user function in the RTLD_START define.  We need to
> set __libc_stack_end before it is made read only.  For this, we need to define DL_STACK_END.
> The offset of 0x160 gives the same stack end as the code in _dl_start_user.
> 
> A build log with the attached patch is here:
> https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=hppa&ver=2.24-9&stamp=1487639205&raw=0
> 
> I don't have write permission, so somebody should commit this for me. Thanks.

pushed now.  should i cherry pick back to 2.25 too ?
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] hppa: Fix setting of __libc_stack_end
  2017-03-15 20:44 ` Mike Frysinger
@ 2017-03-15 21:00   ` John David Anglin
  0 siblings, 0 replies; 3+ messages in thread
From: John David Anglin @ 2017-03-15 21:00 UTC (permalink / raw)
  To: GNU C Library, Helge Deller, Carlos O'Donell, Aurelien Jarno

On 2017-03-15 4:44 PM, Mike Frysinger wrote:
> pushed now. should i cherry pick back to 2.25 too ? 
Thanks Mike.  That would be good.  Debian is currently at 2.24-9 and 
this change
needs to be added for next build/rebuild else build will fail.

Dave

-- 
John David Anglin  dave.anglin@bell.net

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

end of thread, other threads:[~2017-03-15 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21  1:32 [PATCH] hppa: Fix setting of __libc_stack_end John David Anglin
2017-03-15 20:44 ` Mike Frysinger
2017-03-15 21:00   ` John David Anglin

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