about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-08-03 19:54:08 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-08-03 19:54:08 +0000
commit85fe199795c91510ad495c04aea535705ad9abb5 (patch)
tree2be65f4998065544439cd659c784f128db560604
parent4f75b7a09a57e0d33ee0741c18114ce8ac5d6c3f (diff)
downloadglibc-85fe199795c91510ad495c04aea535705ad9abb5.tar.gz
glibc-85fe199795c91510ad495c04aea535705ad9abb5.tar.xz
glibc-85fe199795c91510ad495c04aea535705ad9abb5.zip
Remove some pre-2.6.0 Linux kernel conditionals.
-rw-r--r--ChangeLog14
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/nptl-init.c12
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.c23
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h18
-rw-r--r--sysdeps/unix/sysv/linux/ldsodefs.h4
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c8
7 files changed, 24 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index 47f1338a25..72d6156049 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-08-03  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_AT_SECURE):
+	Remove.
+	(__ASSUME_CORRECT_SI_PID): Likewise.
+	(__ASSUME_BRK_PAGE_ROUNDED): Likewise.
+	(__ASSUME_TMPFS_NAME): Likewise.
+	* sysdeps/unix/sysv/linux/dl-sysdep.c (frob_brk)
+	[!__ASSUME_BRK_PAGE_ROUNDED]: Remove conditional code.
+	* sysdeps/unix/sysv/linux/ldsodefs.h [__ASSUME_AT_SECURE]
+	(HAVE_AUX_SECURE): Make definition unconditional.
+	* sysdeps/unix/sysv/linux/shm_open.c (where_is_shmfs)
+	[!__ASSUME_TMPFS_NAME]: Remove conditional code.
+
 2012-08-03  Roland McGrath  <roland@hack.frob.com>
 
 	* sysdeps/mach/hurd/sys/param.h (MAXSYMLINKS): Macro removed.
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 6969fd256d..bf9bf926b6 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-03  Joseph Myers  <joseph@codesourcery.com>
+
+	* nptl-init.c (sigcancel_handler) [__ASSUME_CORRECT_SI_PID]: Make
+	code unconditional.
+	(sighandler_setxid) [__ASSUME_CORRECT_SI_PID]: Likewise.
+
 2012-07-28  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	* tst-pthread-getattr.c (MAX_STACK_SIZE): New macro.
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 5216ce1f5a..6a18dbe1b5 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -172,24 +172,18 @@ __nptl_set_robust (struct pthread *self)
 static void
 sigcancel_handler (int sig, siginfo_t *si, void *ctx)
 {
-#ifdef __ASSUME_CORRECT_SI_PID
   /* Determine the process ID.  It might be negative if the thread is
      in the middle of a fork() call.  */
   pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
   if (__builtin_expect (pid < 0, 0))
     pid = -pid;
-#endif
 
   /* Safety check.  It would be possible to call this function for
      other signals and send a signal from another process.  This is not
      correct and might even be a security problem.  Try to catch as
      many incorrect invocations as possible.  */
   if (sig != SIGCANCEL
-#ifdef __ASSUME_CORRECT_SI_PID
-      /* Kernels before 2.5.75 stored the thread ID and not the process
-	 ID in si_pid so we skip this test.  */
       || si->si_pid != pid
-#endif
       || si->si_code != SI_TKILL)
     return;
 
@@ -235,24 +229,18 @@ struct xid_command *__xidcmd attribute_hidden;
 static void
 sighandler_setxid (int sig, siginfo_t *si, void *ctx)
 {
-#ifdef __ASSUME_CORRECT_SI_PID
   /* Determine the process ID.  It might be negative if the thread is
      in the middle of a fork() call.  */
   pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
   if (__builtin_expect (pid < 0, 0))
     pid = -pid;
-#endif
 
   /* Safety check.  It would be possible to call this function for
      other signals and send a signal from another process.  This is not
      correct and might even be a security problem.  Try to catch as
      many incorrect invocations as possible.  */
   if (sig != SIGSETXID
-#ifdef __ASSUME_CORRECT_SI_PID
-      /* Kernels before 2.5.75 stored the thread ID and not the process
-	 ID in si_pid so we skip this test.  */
       || si->si_pid != pid
-#endif
       || si->si_code != SI_TKILL)
     return;
 
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index 42c63d2df4..da3686a360 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Dynamic linker system dependencies for Linux.
-   Copyright (C) 1995,1997,2001,2004,2005,2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,27 +33,6 @@ static inline void
 frob_brk (void)
 {
   __brk (0);			/* Initialize the break.  */
-
-#if ! __ASSUME_BRK_PAGE_ROUNDED
-  /* If the dynamic linker was executed as a program, then the break may
-     start immediately after our data segment.  However, dl-minimal.c has
-     already stolen the remainder of the page for internal allocations.
-     If we don't adjust the break location recorded by the kernel, the
-     normal program startup will inquire, find the value at our &_end,
-     and start allocating its own data there, clobbering dynamic linker
-     data structures allocated there during startup.
-
-     Later Linux kernels have changed this behavior so that the initial
-     break value is rounded up to the page boundary before we start.  */
-
-  extern char *__curbrk attribute_hidden;
-  extern char _end[] attribute_hidden;
-  char *const endpage = (void *) 0 + (((__curbrk - (char *) 0)
-				       + GLRO(dl_pagesize) - 1)
-				      & -GLRO(dl_pagesize));
-  if (__builtin_expect (__curbrk >= _end && __curbrk < endpage, 0))
-    __brk (endpage);
-#endif
 }
 
 # include <elf/dl-sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index b949f168d5..e5b65cca0b 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -115,15 +115,6 @@
 /* The statfs64 syscalls are available in 2.5.74 (but not for alpha).  */
 #define __ASSUME_STATFS64	1
 
-/* Starting with at least 2.5.74 the kernel passes the setuid-like exec
-   flag unconditionally up to the child.  */
-#define __ASSUME_AT_SECURE	1
-
-/* Starting with the 2.5.75 kernel the kernel fills in the correct value
-   in the si_pid field passed as part of the siginfo_t struct to signal
-   handlers.  */
-#define __ASSUME_CORRECT_SI_PID	1
-
 /* The tgkill syscall was instroduced for i386 in 2.5.75.  On x86-64,
    sparc, SH, ppc, and ppc64 it was introduced in 2.6.0-test3. */
 #if defined __i386__ \
@@ -189,10 +180,6 @@
 # define __ASSUME_GETDENTS32_D_TYPE	1
 #endif
 
-/* Starting with version 2.5.3, the initial location returned by `brk'
-   after exec is always rounded up to the next page.  */
-#define __ASSUME_BRK_PAGE_ROUNDED	1
-
 /* Starting with version 2.6.9, the waitid system call is available.
    Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12.  */
 #if (__LINUX_KERNEL_VERSION >= 0x020609 \
@@ -208,11 +195,6 @@
 # define __ASSUME_STAT64_SYSCALL	1
 #endif
 
-/* Early kernel used "shm" as the filesystem name for the filesystem used
-   for shm_open etc.  Later it is "tmpfs".  2.4.20 is a safe bet for the
-   cutover.  */
-#define __ASSUME_TMPFS_NAME	1
-
 /* pselect/ppoll were introduced just after 2.6.16-rc1.  Due to the way
    the kernel versions are advertised we can only rely on 2.6.17 to have
    the code.  On x86_64 and SH this appeared first in 2.6.19-rc1,
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
index 50f3e2b644..cf7ace7a96 100644
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
@@ -41,9 +41,7 @@ extern void _dl_non_dynamic_init (void) internal_function;
 
 /* We can assume that the kernel always provides the AT_SECURE value
    in the auxiliary vector from 2.5.74 or so on.  */
-#if __ASSUME_AT_SECURE
-# define HAVE_AUX_SECURE
-#endif
+#define HAVE_AUX_SECURE
 
 /* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
    up the page size information.  */
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index 763b087466..82332a30e3 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2004,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -86,11 +86,7 @@ where_is_shmfs (void)
   while ((mp = __getmntent_r (fp, &resmem, buf, sizeof buf)) != NULL)
     /* The original name is "shm" but this got changed in early Linux
        2.4.x to "tmpfs".  */
-    if (strcmp (mp->mnt_type, "tmpfs") == 0
-#ifndef __ASSUME_TMPFS_NAME
-	|| strcmp (mp->mnt_type, "shm") == 0
-#endif
-	)
+    if (strcmp (mp->mnt_type, "tmpfs") == 0)
       {
 	/* Found it.  There might be more than one place where the
            filesystem is mounted but one is enough for us.  */