From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17566 invoked by alias); 24 Sep 2003 20:15:47 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 17550 invoked from network); 24 Sep 2003 20:15:47 -0000 Received: from unknown (HELO e3.ny.us.ibm.com) (32.97.182.103) by sources.redhat.com with SMTP; 24 Sep 2003 20:15:47 -0000 Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com [9.56.224.150]) by e3.ny.us.ibm.com (8.12.10/8.12.2) with ESMTP id h8OKFj7A332362 for ; Wed, 24 Sep 2003 16:15:45 -0400 Received: from us.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay02.pok.ibm.com (8.12.9/NCO/VER6.6) with ESMTP id h8OKFiaL186580 for ; Wed, 24 Sep 2003 16:15:45 -0400 Message-ID: <3F71E53D.F128E61D@us.ibm.com> Date: Wed, 24 Sep 2003 20:15:00 -0000 From: Steven Munroe Reply-To: sjmunroe@vnet.ibm.com Organization: IBM Linux Developement X-Accept-Language: en MIME-Version: 1.0 To: libc-hacker Subject: Re:[PATCH] Set __libc_stack_end earlier on all arches,... Content-Type: multipart/mixed; boundary="------------DB2F4E123C0E5E0649C1038E" X-SW-Source: 2003-09/txt/msg00085.txt.bz2 This is a multi-part message in MIME format. --------------DB2F4E123C0E5E0649C1038E Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 1256 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 * 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 --------------DB2F4E123C0E5E0649C1038E Content-Type: text/plain; charset=us-ascii; name="ppc-dl-sysdep-20030923.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ppc-dl-sysdep-20030923.patch" Content-length: 832 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 --------------DB2F4E123C0E5E0649C1038E--