From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22005 invoked by alias); 8 Apr 2010 09:43:07 -0000 Received: (qmail 21989 invoked by uid 22791); 8 Apr 2010 09:43:06 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Apr 2010 09:43:01 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o389gxxH025810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 8 Apr 2010 05:42:59 -0400 Received: from hase.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o389gvFJ011073 for ; Thu, 8 Apr 2010 05:42:58 -0400 From: Andreas Schwab To: libc-hacker@sourceware.org Subject: [PATCH] Don't call uname or getrlimit in libpthread init function X-Yow: Yow! I'm having a quadrophonic sensation of two winos alone in a steel mill! Date: Thu, 08 Apr 2010 09:43:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00001.txt.bz2 The libpthread init function calls uname and getrlimit, which means they are called just by being linked against it, even if the program does not use any of the libpthread functions, thus may use the function names for its own purpose. Andreas. 2010-04-08 Andreas Schwab * sysdeps/unix/sysv/linux/i386/Versions: Export __uname under GLIBC_PRIVATE. * nptl/Versions: Export __getrlimit under GLIBC_PRIVATE. * sysdeps/unix/sysv/linux/i386/smp.h: Call __uname instead of uname. * nptl/nptl-init.c: Call __getrlimit instead of getrlimit. --- nptl/Versions | 1 + nptl/nptl-init.c | 2 +- nptl/sysdeps/unix/sysv/linux/i386/Versions | 6 ++++++ nptl/sysdeps/unix/sysv/linux/i386/smp.h | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 nptl/sysdeps/unix/sysv/linux/i386/Versions diff --git a/nptl/Versions b/nptl/Versions index 1f2de79..13ca357 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -29,6 +29,7 @@ libc { GLIBC_PRIVATE { # Internal libc interface to libpthread __libc_dl_error_tsd; + __getrlimit; } } diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index 851bab2..c663f21 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -396,7 +396,7 @@ __pthread_initialize_minimal_internal (void) /* Determine the default allowed stack size. This is the size used in case the user does not specify one. */ struct rlimit limit; - if (getrlimit (RLIMIT_STACK, &limit) != 0 + if (__getrlimit (RLIMIT_STACK, &limit) != 0 || limit.rlim_cur == RLIM_INFINITY) /* The system limit is not usable. Use an architecture-specific default. */ diff --git a/nptl/sysdeps/unix/sysv/linux/i386/Versions b/nptl/sysdeps/unix/sysv/linux/i386/Versions new file mode 100644 index 0000000..9d53804 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/i386/Versions @@ -0,0 +1,6 @@ +libc { + GLIBC_PRIVATE { + # Internal libc interface to libpthread + __uname; + } +} diff --git a/nptl/sysdeps/unix/sysv/linux/i386/smp.h b/nptl/sysdeps/unix/sysv/linux/i386/smp.h index f68a0c0..bdff665 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/smp.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/smp.h @@ -37,7 +37,7 @@ is_smp_system (void) char *cp; /* Try reading the number using `sysctl' first. */ - if (uname (&u.uts) == 0) + if (__uname (&u.uts) == 0) cp = u.uts.version; else { -- 1.7.0.1 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different."