From patchwork Wed Feb 5 22:53:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jody Bruchon X-Patchwork-Id: 317290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id A3F502C009E for ; Thu, 6 Feb 2014 09:53:45 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B9A9C93D8B; Wed, 5 Feb 2014 22:53:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F-XXMJWPbwlj; Wed, 5 Feb 2014 22:53:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 3CCBE93D87; Wed, 5 Feb 2014 22:53:44 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A489E1BF967 for ; Wed, 5 Feb 2014 22:53:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9DE7C2D890 for ; Wed, 5 Feb 2014 22:53:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 80ewba9FF4fp for ; Wed, 5 Feb 2014 22:53:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mout.perfora.net (mout.perfora.net [74.208.4.195]) by silver.osuosl.org (Postfix) with ESMTPS id 9B25A32151 for ; Wed, 5 Feb 2014 22:53:41 +0000 (UTC) Received: from [192.168.0.2] (96-36-104-194.static.hckr.nc.charter.com [96.36.104.194]) by mrelay.perfora.net (node=mrus3) with ESMTP (Nemesis) id 0MO6v6-1W7u5e1Kia-005f6g; Wed, 05 Feb 2014 17:53:40 -0500 Message-ID: <52F2C0EE.4080005@jodybruchon.com> Date: Wed, 05 Feb 2014 17:53:34 -0500 From: Jody Bruchon User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: uclibc@uclibc.org Subject: [PATCH] ldso: 64-bit clean stat (was "ldso: "can't load library" due to not using (f)stat64 calls") X-Provags-ID: V02:K0:kexLYiLXEVD2aTGVUNtjervF1sBi7hMgaEHSwmQmSgX dAK7REB9GnVVTJ9jr8Lowra62D3lfn9KjCo7NV+5MHqXNy+KBI 4W1U59I9ZT9nFc1nwPiz1Mb5DR4wUgC/7WZjmU2mQU0SnBHCQE mP51mQbpIUbFKt5NX1549nPxaoavLlnQpI9IaBhUDEGGUmYrj8 /McMKepCAw8RBmW1kDK6J0loei2Af6LAd+vjFnzadTF/j/M08W +82ysbrKO66oSVOpYu3/l5NXrmcXMt0+AiNOxhweEayhEei8Oe Tu342pALhE4ZVuPnfiYElDE3ZUfXFJhEt8Czp9Pog9ZMbl5RXf SLTKUEieUWprqreyqRl0= 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 This quick-and-dirty patch fixes the problem detailed in my previous bug reports relating to not using stat64 family calls in the uClibc dynamic loader. I have confirmed that this patch enables a uClibc/i386 system to properly load libraries and dynamic executables that are referenced by 64-bit inode numbers, avoiding the -EOVERFLOW failure I originally reported. I have not tested this on any platforms other than i386. I hope this will assist someone with more uClibc expertise to craft a proper patch. -Jody Bruchon fn, struct stat *, stat, int, flags) @@ -98,7 +99,7 @@ struct stat *, buf) #endif -#if defined __NR_fstat64 && !defined __NR_fstat +#if defined __NR_fstat64 # define __NR__dl_fstat __NR_fstat64 #elif defined __NR_fstat # define __NR__dl_fstat __NR_fstat --- a/ldso/include/dl-syscall.h 2013-10-07 10:46:11.000000000 -0400 +++ b/ldso/include/dl-syscall.h 2014-02-05 17:31:46.014902106 -0500 @@ -28,7 +28,8 @@ #if defined(__sparc_v9__) && (__WORDSIZE == 64) #define kernel_stat64 stat #else -#define kernel_stat stat +/* #define kernel_stat stat */ +#define kernel_stat64 stat #endif #include #include @@ -82,7 +83,7 @@ static __always_inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot) -#if defined __NR_fstatat64 && !defined __NR_stat +#if defined __NR_fstatat64 # define __NR__dl_fstatat64 __NR_fstatat64 static __always_inline _syscall4(int, _dl_fstatat64, int, fd, const char *,