public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Re:[PATCH] Set __libc_stack_end earlier on all arches,...
@ 2003-09-24 20:15 Steven Munroe
  2003-09-24 20:41 ` [PATCH] " Ulrich Drepper
  2003-09-24 21:38 ` Jakub Jelinek
  0 siblings, 2 replies; 5+ messages in thread
From: Steven Munroe @ 2003-09-24 20:15 UTC (permalink / raw)
  To: libc-hacker

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

Jakub Jelinek Wed, 24 Sep 2003 15:47:04 writes:

> The following patch does that (tested on a bunch of arches).

Actually it does not include PowerPC 32/64. Currently for PowerPC linux
__libc_stack_end is set in libc_start_main, but this is not soon enough to
support execstack and the execstack tests in make check fails (because
__libc_stack_end is not set). The attached patch uses DL_PLATFORM_INIT to
capture the argv pointer and store that into __libc_stack_end during
_dl_sysdep_start before the call to dl_main. This will work for both powerpc32
and powerpc64.

This is soon enough to pass the stack-end into _dl_make_stack_executable but it
still fails in the mprotect with a "Permission Denied". I'll pursue that issue
further.

I would like an explanation of why we are doing this. Generally arbitrarily
marking the stack executable is a bad idea. So I would like a explaination
(pointer to one) of the function we trying to provide and the conditions under
which it will be used.

2003-09-24  Steven Munroe  <sjmunroe@us.ibm.com>

	* sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 
	[DL_PLATFORM_INIT]: Define
	(frob_stack_end): New function.



-- 
Steven Munroe
sjmunroe@us.ibm.com
Linux on PowerPC-64 Development
GLIBC for PowerPC-64 Development

[-- Attachment #2: ppc-dl-sysdep-20030923.patch --]
[-- Type: text/plain, Size: 832 bytes --]

diff -urN libc23-cvstip-20030923/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c libc23/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
--- libc23-cvstip-20030923/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c	2003-03-15 18:40:44.000000000 -0600
+++ libc23/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c	2003-09-24 13:19:34.000000000 -0500
@@ -25,6 +25,16 @@
 extern int __cache_line_size;
 weak_extern (__cache_line_size)
 
+#define DL_PLATFORM_INIT frob_stack_end (start_argptr)
+
+extern void *__libc_stack_end;
+
+static inline void
+frob_stack_end (void *arg)
+{
+  __libc_stack_end = arg;	/* Initialize the break.  */
+}
+
 /* Scan the Aux Vector for the "Data Cache Block Size" entry.  If found
    verify that the static extern __cache_line_size is defined by checking
    for not NULL.  If it is defined then assign the cache block size

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] Set __libc_stack_end earlier on all arches,...
@ 2003-09-24 22:49 Steve Munroe
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Munroe @ 2003-09-24 22:49 UTC (permalink / raw)
  To: davidm; +Cc: Jakub Jelinek, libc-hacker

David Mosberger writes:

> > On Wed, 24 Sep 2003 21:36:22 +0200, Jakub Jelinek <jakub@redhat.com> 
said:
>
>  Jakub> The only special arches here are ia64 and ppc64, as there
>  Jakub> trampolines don't actually need executable stack. Because of
>  Jakub> this I chose not to add .note.GNU-stack/PT_GNU_STACK marking
>  Jakub> for these two arches.  Unfortunately, on both these arches
>  Jakub> kernel defaults to executable stack as I found out today and
>  Jakub> thus there can be programs which rely on this and so for
>  Jakub> binary compatibility need to be assumed as needing executable
>  Jakub> stack too.
>
>Why do you say this?

Also for PPC64 :

000001ff7fffd000-000001ff80000000 rw-p ffffffffffffe000 00:00 0

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

end of thread, other threads:[~2003-09-24 22:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-24 20:15 Re:[PATCH] Set __libc_stack_end earlier on all arches, Steven Munroe
2003-09-24 20:41 ` [PATCH] " Ulrich Drepper
2003-09-24 21:38 ` Jakub Jelinek
2003-09-24 22:13   ` David Mosberger
2003-09-24 22:49 Steve Munroe

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