From patchwork Wed Mar 26 13:31:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: vincent X-Patchwork-Id: 333922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id C54BB14008D for ; Thu, 27 Mar 2014 00:57:04 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 60CFC8BF78; Wed, 26 Mar 2014 13:57:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A-MqQOIdhqho; Wed, 26 Mar 2014 13:57:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id B4CCC8BF6B; Wed, 26 Mar 2014 13:57:01 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 048641BFA1A for ; Wed, 26 Mar 2014 13:57:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F38418CDCE for ; Wed, 26 Mar 2014 13:56:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CFovg2-s4vEF for ; Wed, 26 Mar 2014 13:56:59 +0000 (UTC) X-Greylist: delayed 00:23:03 by SQLgrey-1.7.6 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by whitealder.osuosl.org (Postfix) with ESMTPS id D76968CD48 for ; Wed, 26 Mar 2014 13:56:58 +0000 (UTC) Received: from pps.filterd (m0046670.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s2QDWA6i005090 for ; Wed, 26 Mar 2014 14:33:52 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1jr67985e3-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 26 Mar 2014 14:33:52 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3983553 for ; Wed, 26 Mar 2014 13:33:52 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas5.st.com [10.75.90.71]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1EF95B4CB for ; Wed, 26 Mar 2014 13:33:52 +0000 (GMT) Received: from reddwarf.lablan (164.129.122.152) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.298.1; Wed, 26 Mar 2014 14:33:51 +0100 Date: Wed, 26 Mar 2014 14:31:11 +0100 From: To: , Filippo Arcidiacono Subject: [PATCH] ldso: fix standalone execution on x86_64 architecture Message-ID: <20140326133056.GA32517@reddwarf.lablan> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.22 (2013-10-16) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.87, 1.0.14, 0.0.0000 definitions=2014-03-26_03:2014-03-26, 2014-03-26, 1970-01-01 signatures=0 X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: uclibc-bounces@uclibc.org If the dynamic linker is built with LDSO_STANDALONE_SUPPORT=y, it can load then run a dynamically linked program when explicitly invoked from the command line. This is used for test and prelink purposes, and also by other tools like PRoot to force the kernel to load the right ELF interpreter. This feature is currently broken on x86_64 since the number of command line arguments (ie. argc) passed from the kernel is an "elf_addr_t" (64 bit on x86_64), whereas it is read as an "unsigned int" (32 bit on x86_64). Ref: https://github.com/cedric-vincent/PRoot/issues/45 Signed-off-by: Cédric VINCENT --- ldso/ldso/ldso.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index becabd3..89a0126 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -526,8 +526,8 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, #ifdef __LDSO_STANDALONE_SUPPORT__ if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) { - unsigned int *aux_dat = (unsigned int *) argv; - int argc = aux_dat[-1]; + unsigned long *aux_dat = (unsigned long *) argv; + long argc = aux_dat[-1]; tpnt->libname = argv[0]; while (argc > 1)