From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4506 invoked by alias); 8 Mar 2005 16:04:10 -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 4472 invoked from network); 8 Mar 2005 16:04:10 -0000 Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 8 Mar 2005 16:04:10 -0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id j28G46qB023738; Tue, 8 Mar 2005 17:04:06 +0100 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id j28G46YN023723; Tue, 8 Mar 2005 17:04:06 +0100 Date: Tue, 08 Mar 2005 16:04:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Roland McGrath Cc: Glibc hackers Subject: [PATCH] Fix tst-getpid{1,2} on ia64 Message-ID: <20050308160405.GS4777@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2005-03/txt/msg00026.txt.bz2 Hi! When glibc is built with gcc-4_0-branch on IA-64, tst-getpid{1,2} fails. The problem is that while older GCCs always aligned buffer as big as char st[256 * 1024]; to 16 bytes, GCC 4 only aligns this to 8 bytes. Now, either we require direct clone/__clone2 users to make sure the stack passed to it is sufficiently aligned (as done e.g. in the patch below, 64 is just a guess for all arches out there, I think e.g. IA-64 needs just 16 bytes alingment), or we make sure that glibc's __clone2 and clone align things themselves, or we make sure the kernel aligns it. 2005-03-08 Jakub Jelinek * tst-getpid1.c: Include stdint.h. (do_test): Align stack passed to clone{2,} to 64 bytes. --- libc/nptl/tst-getpid1.c.jj 2004-12-15 12:16:06.000000000 +0100 +++ libc/nptl/tst-getpid1.c 2005-03-08 16:54:43.947924210 +0100 @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -44,11 +45,13 @@ do_test (void) extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, size_t __child_stack_size, int __flags, void *__arg, ...); - char st[256 * 1024]; - pid_t p = __clone2 (f, st, sizeof (st), TEST_CLONE_FLAGS, 0); + char st[256 * 1024 + 64]; + char *stp = (char *) ((uintptr_t) (st + 64) & -64); + pid_t p = __clone2 (f, stp, sizeof (st) - 64, TEST_CLONE_FLAGS, 0); #else - char st[128 * 1024]; - pid_t p = clone (f, st + sizeof (st), TEST_CLONE_FLAGS, 0); + char st[128 * 1024 + 64]; + char *stp = (char *) ((uintptr_t) (st + 64) & -64); + pid_t p = clone (f, stp + sizeof (st) - 64, TEST_CLONE_FLAGS, 0); #endif if (p == -1) { Jakub