This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re:[PATCH] Set __libc_stack_end earlier on all arches,...


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]