add glibc 2.10.1 for arm arch

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1552 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one
2009-09-12 08:46:08 +00:00
parent 06514b6f8f
commit 5059ab35f3
125 changed files with 11377 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
--- glibc-2.3.1/ctype/ctype-info.c.orig 2002-11-07 15:58:39.000000000 +0200
+++ glibc-2.3.1/ctype/ctype-info.c 2002-11-07 16:01:24.000000000 +0200
@@ -48,6 +48,7 @@
#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o)
+#if 0
const unsigned short int *__ctype_b = b (unsigned short int, class, 128);
const __uint32_t *__ctype32_b = b (__uint32_t, class32, 0);
const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128);
@@ -61,5 +62,23 @@
compat_symbol (libc, __ctype32_b, __ctype32_b, GLIBC_2_0);
compat_symbol (libc, __ctype32_tolower, __ctype32_tolower, GLIBC_2_2);
compat_symbol (libc, __ctype32_toupper, __ctype32_toupper, GLIBC_2_2);
+#endif
#endif
+
+/* Temporarily exported until all .a libraries are recompiled. */
+#undef b
+#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o)
+
+extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
+extern const char _nl_C_LC_CTYPE_class32[] attribute_hidden;
+extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
+extern const char _nl_C_LC_CTYPE_tolower[] attribute_hidden;
+
+const unsigned short int *__ctype_b = b (unsigned short int, class, 128);
+const __uint32_t *__ctype32_b = b (__uint32_t, class32, 0);
+const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128);
+const __int32_t *__ctype_toupper = b (__int32_t, toupper, 128);
+const __uint32_t *__ctype32_tolower = b (__uint32_t, tolower, 128);
+const __uint32_t *__ctype32_toupper = b (__uint32_t, toupper, 128);
+
--- glibc-2.3.1/locale/lc-ctype.c.orig 2002-12-30 11:43:39.000000000 +0200
+++ glibc-2.3.1/locale/lc-ctype.c 2002-12-30 11:48:22.000000000 +0200
@@ -75,6 +75,7 @@
We need those relocations so that a versioned definition with a COPY
reloc in an executable will override the libc.so definition. */
+#if 0
compat_symbol (libc, __ctype_b, __ctype_b, GLIBC_2_0);
compat_symbol (libc, __ctype_tolower, __ctype_tolower, GLIBC_2_0);
compat_symbol (libc, __ctype_toupper, __ctype_toupper, GLIBC_2_0);
@@ -89,4 +90,21 @@
__ctype32_toupper = current (uint32_t, TOUPPER32, 0);
__ctype32_tolower = current (uint32_t, TOLOWER32, 0);
#endif
+
+#endif
+
+ /* Temporary. */
+ extern __const unsigned short int *__ctype_b; /* Characteristics. */
+ extern __const __int32_t *__ctype_tolower; /* Case conversions. */
+ extern __const __int32_t *__ctype_toupper; /* Case conversions. */
+ extern const uint32_t *__ctype32_b;
+ extern const uint32_t *__ctype32_toupper;
+ extern const uint32_t *__ctype32_tolower;
+
+ __ctype_b = current (uint16_t, CLASS, 128);
+ __ctype_toupper = current (uint32_t, TOUPPER, 128);
+ __ctype_tolower = current (uint32_t, TOLOWER, 128);
+ __ctype32_b = current (uint32_t, CLASS32, 0);
+ __ctype32_toupper = current (uint32_t, TOUPPER32, 0);
+ __ctype32_tolower = current (uint32_t, TOLOWER32, 0);
}

View File

@@ -0,0 +1,12 @@
diff -u -r1.6 fpu_control.h
--- libc/sysdeps/mips/fpu_control.h 6 Jul 2001 04:56:00 -0000 1.6
+++ libc/sysdeps/mips/fpu_control.h 19 Oct 2002 16:03:35 -0000
@@ -74,7 +74,7 @@
#define _FPU_RC_UP 0x2
#define _FPU_RC_DOWN 0x3
-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
+#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
/* The fdlibm code requires strict IEEE double precision arithmetic,

View File

@@ -0,0 +1,32 @@
--- glibc-20020408/posix/Versions.bak 2002-02-04 12:42:40.000000000 +0100
+++ glibc-20020408/posix/Versions 2002-04-19 01:01:00.000000000 +0200
@@ -3,6 +3,9 @@
# functions with special/multiple interfaces
__bsd_getpgrp; __setpgid; __getpgid;
+ # This will be GLIBC_PRIVATE, just give Sun JDK some time to catch up
+ __libc_wait; __libc_waitpid;
+
# functions with required interface outside normal name space
_exit;
@@ -83,6 +86,9 @@
GLIBC_2.1.2 {
# functions used in other libraries
__vfork;
+
+ # This will be GLIBC_PRIVATE, just give wine some time to catch up
+ __libc_fork;
}
GLIBC_2.2 {
# p*
@@ -109,6 +115,7 @@
GLIBC_PRIVATE {
# functions which have an additional interface since they are
# are cancelable.
- __libc_wait; __libc_waitpid; __libc_pause; __libc_nanosleep; __libc_fork;
+ # __libc_wait; __libc_waitpid;
+ __libc_pause; __libc_nanosleep; # __libc_fork;
__libc_pread; __libc_pread64; __libc_pwrite; __libc_pwrite64;
__waitid; __pselect;
}

View File

@@ -0,0 +1,173 @@
# DP: Description: libgcc-compat symbols for mips
# DP: Author: Guido Guenther
# DP: thanks to Jack Howarth for explanations and help
# DP: Upstream status: Not submitted
# DP: Date: 2002-10-13, updated 2002-10-20
--- libc/sysdeps/mips/Makefile.orig Sun Oct 13 14:45:56 2002
+++ libc/sysdeps/mips/Makefile Sun Oct 13 14:51:20 2002
@@ -6,3 +6,15 @@
ifeq ($(subdir),setjmp)
sysdep_routines += setjmp_aux
endif
+
+ifeq ($(subdir),csu)
+ifeq (yes,$(build-shared))
+# Compatibility
+ifeq (yes,$(have-protected))
+CPPFLAGS-divdi3.c = -DHAVE_DOT_HIDDEN
+CPPFLAGS-libgcc-compat.c = -DHAVE_DOT_HIDDEN
+endif
+sysdep_routines += libgcc-compat
+shared-only-routines += libgcc-compat
+endif
+endif
--- libc/sysdeps/mips/Dist.orig Sun Oct 13 15:07:31 2002
+++ libc/sysdeps/mips/Dist Sun Oct 13 15:07:41 2002
@@ -1,3 +1,5 @@
+divdi3.c
+libgcc-compat.c
setjmp_aux.c
regdef.h
sgidefs.h
--- /dev/null Sat Mar 16 18:32:44 2002
+++ libc/sysdeps/mips/divdi3.c Sun Oct 13 14:44:34 2002
@@ -0,0 +1,43 @@
+/* 64-bit multiplication and division libgcc routines for 32-bit mips
+ Copyright (C) 2002 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define _DIVDI3_C
+#include <sysdeps/wordsize-32/divdi3.c>
+
+INTDEF (__udivdi3);
+INTDEF (__moddi3);
+INTDEF (__umoddi3);
+
+#ifdef HAVE_DOT_HIDDEN
+asm (".hidden __divdi3");
+asm (".hidden __udivdi3");
+asm (".hidden __moddi3");
+asm (".hidden __umoddi3");
+#endif
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6)
+
+symbol_version (INTUSE (__divdi3), __divdi3, GLIBC_2.0);
+symbol_version (INTUSE (__udivdi3), __udivdi3, GLIBC_2.0);
+symbol_version (INTUSE (__moddi3), __moddi3, GLIBC_2.0);
+symbol_version (INTUSE (__umoddi3), __umoddi3, GLIBC_2.0);
+
+#endif
--- /dev/null Sat Mar 16 18:32:44 2002
+++ libc/sysdeps/mips/libgcc-compat.c Sun Oct 20 17:11:59 2002
@@ -0,0 +1,81 @@
+/* pre-.hidden libgcc compatibility
+ Copyright (C) 2002 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+#include <stdint.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6)
+
+extern int32_t __cmpdi2 (int64_t, int64_t);
+int32_t __cmpdi2_internal (int64_t u, int64_t v)
+{
+ return __cmpdi2 (u, v);
+}
+symbol_version (__cmpdi2_internal, __cmpdi2, GLIBC_2.0);
+
+
+extern int32_t __ucmpdi2 (int64_t, int64_t);
+int32_t __ucmpdi2_internal (int64_t u, int64_t v)
+{
+ return __ucmpdi2 (u, v);
+}
+symbol_version (__ucmpdi2_internal, __ucmpdi2, GLIBC_2.0);
+
+
+extern int64_t __fixdfdi (double);
+int64_t __fixdfdi_internal (double d)
+{
+ return __fixdfdi (d);
+}
+symbol_version (__fixdfdi_internal, __fixdfdi, GLIBC_2.0);
+
+
+extern int64_t __fixsfdi (float);
+int64_t __fixsfdi_internal (float d)
+{
+ return __fixsfdi (d);
+}
+symbol_version (__fixsfdi_internal, __fixsfdi, GLIBC_2.0);
+
+
+extern int64_t __fixunsdfdi (double);
+int64_t __fixunsdfdi_internal (double d)
+{
+ return __fixunsdfdi (d);
+}
+symbol_version (__fixunsdfdi_internal, __fixunsdfdi, GLIBC_2.0);
+
+
+extern double __floatdidf (int64_t);
+double __floatdidf_internal (int64_t u)
+{
+ return __floatdidf (u);
+}
+symbol_version (__floatdidf_internal, __floatdidf, GLIBC_2.0);
+
+
+floatdisf (int64_t);
+float __floatdisf_internal (int64_t u)
+{
+ return __floatdisf (u);
+}
+symbol_version (__floatdisf_internal, __floatdisf, GLIBC_2.0);
+
+#endif
--- /dev/null Sat Mar 16 18:32:44 2002
+++ libc/sysdeps/mips/Versions Sun Oct 20 17:12:00 2002
@@ -0,0 +1,8 @@
+libc {
+ GLIBC_2.0 {
+ # Functions from libgcc.
+ __cmpdi2; __ucmpdi2;
+ __divdi3; __moddi3; __udivdi3; __umoddi3;
+ __fixdfdi; __fixsfdi; __fixunsdfdi; __floatdidf; __floatdisf;
+ }
+}

View File

@@ -0,0 +1,15 @@
# DP: add clock_{get,set}time@@GLIBC_2.0
# DP: although it should actually be @@GLIBC_2.2
--- libc/sysdeps/unix/sysv/linux/mips/Versions.orig Tue Sep 24 15:56:55 2002
+++ libc/sysdeps/unix/sysv/linux/mips/Versions Tue Sep 24 15:49:27 2002
@@ -34,3 +34,9 @@
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
}
+librt {
+ GLIBC_2.0 {
+ # c*
+ clock_gettime; clock_settime;
+ }
+}

View File

@@ -0,0 +1,22 @@
--- glibc-2.3.1/elf/Versions.orig 2002-11-07 17:04:54.000000000 +0200
+++ glibc-2.3.1/elf/Versions 2002-11-07 17:06:56.000000000 +0200
@@ -32,6 +32,10 @@
_r_debug;
}
GLIBC_2.1 {
+ # This will be GLIBC_PRIVATE, just to give folks some time
+ # to fix their stuff
+ __libc_stack_end;
+
# functions used in other libraries
_dl_mcount;
}
@@ -41,7 +45,7 @@
}
GLIBC_PRIVATE {
# Those are in the dynamic linker, but used by libc.so.
- __libc_enable_secure; __libc_stack_end;
+ __libc_enable_secure; # __libc_stack_end;
_dl_argv; _dl_catch_error; _dl_check_map_versions;
_dl_debug_printf; _dl_debug_state; _dl_dst_count;
_dl_dst_substitute; _dl_init; _dl_lookup_symbol; _dl_lookup_symbol_skip;

View File

@@ -0,0 +1,81 @@
#! /bin/sh -e
# DP: Description: atomicity.h placeholder for HPPA
# DP: Author: Carlos O'Donell <carlos@baldric.uwo.ca>
# DP: Upstream status: Not submitted upstream
# DP: Status Details: --
# DP: Date: November 16, 2002
if [ $# -ne 2 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
-unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# append the patch here and adjust the -p? flag in the patch calls.
diff -urN glibc-2.3.1.orig/sysdeps/hppa/atomicity.h glibc-2.3.1/sysdeps/hppa/atomicity.h
--- glibc-2.3.1.orig/sysdeps/hppa/atomicity.h 1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.3.1/sysdeps/hppa/atomicity.h 2002-11-07 08:35:55.000000000 -0500
@@ -0,0 +1,55 @@
+/* Low-level functions for atomic operations. HP-PARISC version.
+ Copyright (C) 1997,2001 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#include <inttypes.h>
+
+#warning stub atomicity functions are not atomic
+#warning CAO This will get implemented soon
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ int result = *mem;
+ *mem += val;
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ *mem += val;
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ if (*p != oldval)
+ return 0;
+
+ *p = newval;
+ return 1;
+}
+
+#endif /* atomicity.h */

View File

@@ -0,0 +1,10 @@
--- glibc-2.3.2/linuxthreads/sysdeps/alpha/elf/pt-initfini.c.old 2003-11-01 17:55:51.000000000 -0500
+++ glibc-2.3.2/linuxthreads/sysdeps/alpha/elf/pt-initfini.c 2003-11-01 20:17:04.000000000 -0500
@@ -75,7 +75,6 @@
subq $30, 16, $30 \n\
stq $26, 0($30) \n\
stq $29, 8($30) \n\
- .prologue 1 \n\
.align 3 \n\
/*@_fini_PROLOG_ENDS*/ \n\
\n\

View File

@@ -0,0 +1,13 @@
--- glibc-2.3.2/sysdeps/unix/sysv/linux/alpha/syscalls.list.old 2003-11-01 19:21:19.000000000 -0500
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/alpha/syscalls.list 2003-11-01 19:21:25.000000000 -0500
@@ -22,8 +22,8 @@
llseek EXTRA lseek C:3 __libc_lseek __lseek lseek __libc_lseek64 __llseek llseek __lseek64 lseek64
lseek llseek -
posix_fadvise64 - fadvise64 Vi:iiii posix_fadvise64 posix_fadvise
-pread - pread64 C:4 __libc_pread __libc_pread64 __pread pread __pread64 pread64
-pwrite - pwrite64 C:4 __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
+pread - pread C:4 __libc_pread __libc_pread64 __pread pread __pread64 pread64
+pwrite - pwrite C:4 __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
fstatfs - fstatfs i:ip __fstatfs fstatfs __fstatfs64 fstatfs64
statfs - statfs i:sp __statfs statfs statfs64
getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64

View File

@@ -0,0 +1,24 @@
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/sysdep.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- libc/sysdeps/unix/sysv/linux/alpha/sysdep.h 2003/06/20 16:24:36 1.16
+++ libc/sysdeps/unix/sysv/linux/alpha/sysdep.h 2004/03/23 23:31:47 1.17
@@ -65,6 +65,16 @@
# define __NR_semtimedop 423
#endif
+/* This is a kludge to make syscalls.list find these under the names
+ pread and pwrite, since some kernel headers define those names
+ and some define the *64 names for the same system calls. */
+#if !defined __NR_pread && defined __NR_pread64
+# define __NR_pread __NR_pread64
+#endif
+#if !defined __NR_pwrite && defined __NR_pwrite64
+# define __NR_pwrite __NR_pwrite64
+#endif
+
/*
* In order to get the hidden arguments for rt_sigaction set up
* properly, we need to call the assembly version. This shouldn't

View File

@@ -0,0 +1,11 @@
--- sysdeps/unix/sysv/linux/configure.orig 2003-06-28 01:51:12.000000000 +0000
+++ sysdeps/unix/sysv/linux/configure 2003-06-28 01:51:23.000000000 +0000
@@ -224,7 +224,7 @@
/usr | /usr/)
# 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
case $machine in
- sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
+ sparc/sparc64 | powerpc/powerpc64 | s390/s390-64 | \
mips/mips64/n64/* )
libc_cv_slibdir="/lib64"
if test "$libdir" = '${exec_prefix}/lib'; then

View File

@@ -0,0 +1,11 @@
--- sysdeps/unix/sysv/linux/arm/ioperm.c.orig Tue Apr 27 00:30:01 2004
+++ sysdeps/unix/sysv/linux/arm/ioperm.c Tue Apr 27 00:29:57 2004
@@ -41,6 +41,8 @@
#include <string.h>
#include <unistd.h>
+#include <linux/input.h>
+
#include <sys/types.h>
#include <sys/mman.h>

View File

@@ -0,0 +1,11 @@
--- glibc-2.3.2-200304020432/scripts/output-format.sed.armformat 2003-07-19 09:47:39.000000000 -0400
+++ glibc-2.3.2-200304020432/scripts/output-format.sed 2003-07-19 09:48:00.000000000 -0400
@@ -5,7 +5,7 @@
}
t o
: o
-s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
+s/^.*OUTPUT_FORMAT(\([^,]*\), .*, \1).*$/OUTPUT_FORMAT(\1)/
t q
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\2,\3/
t s

View File

@@ -0,0 +1,44 @@
Index: assert/assert.h
===================================================================
RCS file: /cvs/glibc/libc/assert/assert.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- assert/assert.h 15 Aug 2003 17:54:31 -0000 1.25
+++ assert/assert.h 4 Oct 2004 07:45:23 -0000 1.26
@@ -84,33 +84,16 @@
__END_DECLS
-/* For the macro definition we use gcc's __builtin_expect if possible
- to generate good code for the non-error case. gcc 3.0 is a good
- enough estimate for when the feature became available. */
-# if __GNUC_PREREQ (3, 0)
-# define assert(expr) \
- (__ASSERT_VOID_CAST (__builtin_expect (!!(expr), 1) ? 0 : \
- (__assert_fail (__STRING(expr), __FILE__, __LINE__, \
- __ASSERT_FUNCTION), 0)))
-# else
-# define assert(expr) \
+# define assert(expr) \
(__ASSERT_VOID_CAST ((expr) ? 0 : \
(__assert_fail (__STRING(expr), __FILE__, __LINE__, \
__ASSERT_FUNCTION), 0)))
-# endif
# ifdef __USE_GNU
-# if __GNUC_PREREQ (3, 0)
-# define assert_perror(errnum) \
- (__ASSERT_VOID_CAST (__builtin_expect (!(errnum), 1) ? 0 : \
- (__assert_perror_fail ((errnum), __FILE__, __LINE__, \
- __ASSERT_FUNCTION), 0)))
-# else
-# define assert_perror(errnum) \
+# define assert_perror(errnum) \
(__ASSERT_VOID_CAST (!(errnum) ? 0 : \
(__assert_perror_fail ((errnum), __FILE__, __LINE__, \
__ASSERT_FUNCTION), 0)))
-# endif
# endif
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'

View File

@@ -0,0 +1,67 @@
--- glibc-2.3.2-200309061641/sysdeps/unix/sysv/linux/speed.c.orig Sat Sep 6 05:52:52 2003
+++ glibc-2.3.2-200309061641/sysdeps/unix/sysv/linux/speed.c Wed Sep 10 21:50:15 2003
@@ -66,8 +66,9 @@
__set_errno (EINVAL);
return -1;
}
-
+#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
termios_p->c_ospeed = speed;
+#endif
termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
termios_p->c_cflag |= speed;
@@ -91,8 +92,9 @@
__set_errno (EINVAL);
return -1;
}
-
+#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
termios_p->c_ispeed = speed;
+#endif
if (speed == 0)
termios_p->c_iflag |= IBAUD0;
else
diff -ur -x objdir glibc-2.3.2/sysdeps/unix/sysv/linux/tcgetattr.c glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcgetattr.c
--- glibc-2.3.2/sysdeps/unix/sysv/linux/tcgetattr.c 2003-09-10 12:41:08.000000000 -0400
+++ glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcgetattr.c 2003-09-10 11:56:37.000000000 -0400
@@ -45,16 +45,20 @@
termios_p->c_cflag = k_termios.c_cflag;
termios_p->c_lflag = k_termios.c_lflag;
termios_p->c_line = k_termios.c_line;
+#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
#ifdef _HAVE_C_ISPEED
termios_p->c_ispeed = k_termios.c_ispeed;
#else
termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
#endif
+#endif
+#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
#ifdef _HAVE_C_OSPEED
termios_p->c_ospeed = k_termios.c_ospeed;
#else
termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
#endif
+#endif
if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
|| (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
diff -ur -x objdir glibc-2.3.2/sysdeps/unix/sysv/linux/tcsetattr.c glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcsetattr.c
--- glibc-2.3.2/sysdeps/unix/sysv/linux/tcsetattr.c 2003-09-10 12:41:08.000000000 -0400
+++ glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcsetattr.c 2003-09-10 11:56:42.000000000 -0400
@@ -71,12 +71,16 @@
k_termios.c_cflag = termios_p->c_cflag;
k_termios.c_lflag = termios_p->c_lflag;
k_termios.c_line = termios_p->c_line;
+#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
#ifdef _HAVE_C_ISPEED
k_termios.c_ispeed = termios_p->c_ispeed;
#endif
+#endif
+#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
#ifdef _HAVE_C_OSPEED
k_termios.c_ospeed = termios_p->c_ospeed;
#endif
+#endif
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
__KERNEL_NCCS * sizeof (cc_t));

View File

@@ -0,0 +1,28 @@
diff -ruN glibc-2.3.2.orig/include/features.h glibc-2.3.2/include/features.h
--- glibc-2.3.2.orig/include/features.h 2003-06-14 00:28:23.000000000 +0100
+++ glibc-2.3.2/include/features.h 2003-06-14 00:58:57.000000000 +0100
@@ -285,7 +285,8 @@
#if defined __GNUC__ \
|| (defined __PGI && defined __i386__ ) \
|| (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
- || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
+ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) \
+ && !(defined(__DECC) || defined(__DECCXX))
# define __GLIBC_HAVE_LONG_LONG 1
#endif
diff -ruN glibc-2.3.2.orig/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h glibc-2.3.2/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
--- glibc-2.3.2.orig/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h 2003-06-14 00:28:24.000000000 +0100
+++ glibc-2.3.2/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h 2003-06-14 00:57:16.000000000 +0100
@@ -64,9 +64,11 @@
{
struct _pthread_fastlock __c_lock; /* Protect against concurrent access */
_pthread_descr __c_waiting; /* Threads waiting on this condition */
+#if !(defined(__DECC) || defined(__DECCXX)) /* hide this from DEC CC/CXX */
char __padding[48 - sizeof (struct _pthread_fastlock)
- sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)];
__pthread_cond_align_t __align;
+#endif /* __DECC */
} pthread_cond_t;

View File

@@ -0,0 +1,44 @@
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-reloc.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- libc/elf/dl-reloc.c 2003/01/30 17:36:11 1.82
+++ libc/elf/dl-reloc.c 2003/03/01 22:31:52 1.83
@@ -44,23 +44,31 @@
static void __attribute_noinline__
allocate_static_tls (struct link_map *map)
{
- size_t offset = roundup (GL(dl_tls_static_used), map->l_tls_align);
- if (offset + map->l_tls_blocksize
+ size_t offset, used, check;
+
# if TLS_TCB_AT_TP
- + TLS_TCB_SIZE
+ offset = roundup (GL(dl_tls_static_used) + map->l_tls_blocksize,
+ map->l_tls_align);
+ used = offset;
+ check = offset + TLS_TCB_SIZE;
# elif TLS_DTV_AT_TP
+ offset = roundup (GL(dl_tls_static_used), map->l_tls_align);
+ used = offset + map->l_tls_blocksize;
+ check = used;
/* dl_tls_static_used includes the TCB at the beginning. */
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- > GL(dl_tls_static_size))
+
+ if (check > GL(dl_tls_static_size))
{
const char *errstring = N_("\
shared object cannot be dlopen()ed: static TLS memory too small");
INTUSE(_dl_signal_error) (0, (map)->l_name, NULL, errstring);
}
+
map->l_tls_offset = offset;
- GL(dl_tls_static_used) = offset + map->l_tls_blocksize;
+ GL(dl_tls_static_used) = used;
}
#endif

View File

@@ -0,0 +1,59 @@
Index: sysdeps/unix/sysv/linux/dl-execstack.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/dl-execstack.c,v
retrieving revision 1.3
diff -u -p -r1.3 dl-execstack.c
--- sysdeps/unix/sysv/linux/dl-execstack.c 25 Sep 2003 23:04:12 -0000 1.3
+++ sysdeps/unix/sysv/linux/dl-execstack.c 8 Nov 2003 00:34:33 -0000
@@ -41,8 +41,11 @@ _dl_make_stack_executable (void)
if (__mprotect ((void *) page, GL(dl_pagesize),
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) == 0)
return 0;
- if (errno != EINVAL)
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != EINVAL) {
return errno;
+ }
no_growsdown = true;
}
# endif
@@ -64,8 +67,11 @@ _dl_make_stack_executable (void)
page -= size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GL(dl_pagesize))
/* We just tried to mprotect the top hole page and failed.
@@ -92,8 +98,11 @@ _dl_make_stack_executable (void)
if (__mprotect ((void *) page, GL(dl_pagesize),
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSUP) == 0)
return 0;
- if (errno != EINVAL)
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != EINVAL) {
return errno;
+ }
no_growsup = true;
}
# endif
@@ -114,8 +123,11 @@ _dl_make_stack_executable (void)
page += size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GL(dl_pagesize))
/* We just tried to mprotect the lowest hole page and failed.

View File

@@ -0,0 +1,17 @@
2000-05-22 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/fpu/bits/mathinline.h (__expm1_code): Avoid using ?:
with omitted middle operand.
--- libc/sysdeps/i386/fpu/bits/mathinline.h 4 Jun 2003 22:17:35 -0000 1.1.1.13
+++ libc/sysdeps/i386/fpu/bits/mathinline.h 4 Jun 2003 22:22:36 -0000 1.11
@@ -381,7 +381,8 @@ __sincosl (long double __x, long double
("fscale # 2^int(x * log2(e))\n\t" \
: "=t" (__temp) : "0" (1.0), "u" (__exponent)); \
__temp -= 1.0; \
- return __temp + __value ?: __x
+ __temp += __value; \
+ return __temp ? __temp : __x
__inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code)

View File

@@ -0,0 +1,14 @@
--- sysdeps/generic/framestate.c.orig Fri Apr 23 23:59:52 2004
+++ sysdeps/generic/framestate.c Sat Apr 24 00:00:13 2004
@@ -42,7 +42,11 @@
if (handle == NULL
|| (frame_state_for
= (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL)
+#ifndef __USING_SJLJ_EXCEPTIONS__
frame_state_for = fallback_frame_state_for;
+#else
+ frame_state_for = abort;
+#endif
}
return frame_state_for (pc, frame_state);

View File

@@ -0,0 +1,52 @@
diff -Naur glibc-2.3.2-orig/config.h.in glibc-2.3.2/config.h.in
--- glibc-2.3.2-orig/config.h.in 2004-05-11 21:44:51.000000000 -0400
+++ glibc-2.3.2/config.h.in 2004-05-11 22:41:34.903935791 -0400
@@ -208,6 +208,9 @@
/* Defined of libidn is available. */
#undef HAVE_LIBIDN
+/* Defined if economical random device is available. */
+#undef HAVE_DEV_ERANDOM
+
/*
*/
diff -Naur glibc-2.3.2-orig/configure.in glibc-2.3.2/configure.in
--- glibc-2.3.2-orig/configure.in 2004-05-11 21:44:51.000000000 -0400
+++ glibc-2.3.2/configure.in 2004-05-11 22:32:57.999546229 -0400
@@ -289,6 +289,13 @@
[])
AC_SUBST(all_warnings)
+dnl See whether the user wants to disable checking for /dev/erandom
+AC_ARG_ENABLE([dev-erandom],
+ AC_HELP_STRING([--disable-dev-erandom],
+ [disable testing for /dev/erandom]),
+ [try_dev_erandom=$enableval],
+ [try_dev_erandom=yes])
+
AC_CANONICAL_HOST
# The way shlib-versions is used to generate soversions.mk uses a
@@ -1911,6 +1918,21 @@
sizeof_long_double=$ac_cv_sizeof_long_double
AC_SUBST(sizeof_long_double)
+dnl check whether we have an economical random device
+if test "$try_dev_erandom" = yes ; then
+ AC_CACHE_CHECK(for economical random device, ac_cv_have_dev_random,
+ [if test -r "/dev/erandom" ; then
+ ac_cv_have_dev_erandom=yes; else ac_cv_have_dev_erandom=no; fi])
+ if test "$ac_cv_have_dev_erandom" = yes; then
+ AC_DEFINE(HAVE_DEV_ERANDOM,1,
+ [defined if the system supports an economical random device] )
+ fi
+else
+ AC_MSG_CHECKING(for economical random device)
+ ac_cv_have_dev_erandom=no
+ AC_MSG_RESULT(has been disabled)
+fi
+
### End of automated tests.
### Now run sysdeps configure fragments.

View File

@@ -0,0 +1,21 @@
--- stdio-common/sscanf.c.~1.8.~ 2003-01-16 11:25:20.000000000 +0100
+++ stdio-common/sscanf.c 2003-03-05 12:07:34.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,95,96,98,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,95,96,98,2002, 2003 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
@@ -27,9 +27,7 @@
/* Read formatted input from S, according to the format string FORMAT. */
/* VARARGS2 */
int
-sscanf (s, format)
- const char *s;
- const char *format;
+sscanf (const char *s, const char *format, ...)
{
va_list arg;
int done;

View File

@@ -0,0 +1,22 @@
--- glibc-2.3.2/sysdeps/i386/elf/start.S 2004-02-05 18:14:37.000000000 +0100
+++ glibc-2.3.2/sysdeps/i386/elf/start.S 2004-02-05 23:32:16.000000000 +0100
@@ -73,16 +73,13 @@ _start:
addl $_GLOBAL_OFFSET_TABLE_, %ebx
/* Push address of our own entry points to .fini and .init. */
- leal __libc_csu_fini@GOTOFF(%ebx), %eax
- pushl %eax
- leal __libc_csu_init@GOTOFF(%ebx), %eax
- pushl %eax
+ pushl __libc_csu_fini@GOT(%ebx)
+ pushl __libc_csu_init@GOT(%ebx)
pushl %ecx /* Push second argument: argv. */
pushl %esi /* Push first argument: argc. */
- leal BP_SYM (main)@GOTOFF(%ebx), %eax
- pushl %eax
+ pushl BP_SYM (main)@GOT(%ebx)
/* Call the user's main function, and exit with its value.
But let the libc call main. */

View File

@@ -0,0 +1,96 @@
From libc-alpha-return-13560-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com Wed Sep 24 06:27:22 2003
Return-Path: <libc-alpha-return-13560-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com>
Delivered-To: listarch-libc-alpha at sources dot redhat dot com
Received: (qmail 23856 invoked by alias); 24 Sep 2003 06:27:20 -0000
Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm
Precedence: bulk
List-Subscribe: <mailto:libc-alpha-subscribe at sources dot redhat dot com>
List-Archive: <http://sources.redhat.com/ml/libc-alpha/>
List-Post: <mailto:libc-alpha at sources dot redhat dot com>
List-Help: <mailto:libc-alpha-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
Sender: libc-alpha-owner at sources dot redhat dot com
Delivered-To: mailing list libc-alpha at sources dot redhat dot com
Received: (qmail 23847 invoked from network); 24 Sep 2003 06:27:16 -0000
Received: from unknown (HELO sccrmhc11.comcast.net) (204.127.202.55)
by sources dot redhat dot com with SMTP; 24 Sep 2003 06:27:16 -0000
Received: from lucon.org ([12.234.88.5])
by comcast dot net (sccrmhc11) with ESMTP
id <2003092406271601100ok1f3e>; Wed, 24 Sep 2003 06:27:16 +0000
Received: by lucon.org (Postfix, from userid 1000)
id 6B4D02C828; Tue, 23 Sep 2003 23:27:11 -0700 (PDT)
Date: Tue, 23 Sep 2003 23:27:11 -0700
From: "H dot J dot Lu" <hjl at lucon dot org>
To: Richard Henderson <rth at twiddle dot net>
Cc: GNU C Library <libc-alpha at sources dot redhat dot com>,
linux ia64 kernel <linux-ia64 at vger dot kernel dot org>
Subject: PATCH: Re: Inefficient ia64 system call implementation in glibc
Message-ID: <20030924062711.GA860@lucon.org>
References: <20030919163218.GA21480@lucon.org> <20030921210434.GA2280@twiddle.net> <20030922193918.GA1141@lucon.org> <20030922232123.GA17271@twiddle.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20030922232123 dot GA17271 at twiddle dot net>
User-Agent: Mutt/1.4.1i
On Mon, Sep 22, 2003 at 04:21:23PM -0700, Richard Henderson wrote:
> On Mon, Sep 22, 2003 at 12:39:18PM -0700, H. J. Lu wrote:
> > Can I get char * from char [300]?
>
> x+0 would work in this case; I'd guess it'd work for most of the
> cases that syscalls need to handle.
>
This patch works for me.
H.J.
---
2003-09-22 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/unix/sysv/linux/ia64/sysdep.h (LOAD_ARGS_1): Use
__typeof ((outX) + 0) instead of long.
(LOAD_ARGS_2): Likewise.
(LOAD_ARGS_3): Likewise.
(LOAD_ARGS_4): Likewise.
(LOAD_ARGS_5): Likewise.
(LOAD_ARGS_6): Likewise.
--- sysdeps/unix/sysv/linux/ia64/sysdep.h.inline 2003-08-21 07:05:30.000000000 -0700
+++ sysdeps/unix/sysv/linux/ia64/sysdep.h 2003-09-23 11:04:02.000000000 -0700
@@ -191,23 +191,23 @@
#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
#define LOAD_ARGS_0() do { } while (0)
-#define LOAD_ARGS_1(out0) \
- register long _out0 asm ("out0") = (long) (out0); \
+#define LOAD_ARGS_1(out0) \
+ register __typeof ((out0) + 0) _out0 asm ("out0") = (out0); \
LOAD_ARGS_0 ()
-#define LOAD_ARGS_2(out0, out1) \
- register long _out1 asm ("out1") = (long) (out1); \
+#define LOAD_ARGS_2(out0, out1) \
+ register __typeof ((out1) + 0) _out1 asm ("out1") = (out1); \
LOAD_ARGS_1 (out0)
-#define LOAD_ARGS_3(out0, out1, out2) \
- register long _out2 asm ("out2") = (long) (out2); \
+#define LOAD_ARGS_3(out0, out1, out2) \
+ register __typeof ((out2) + 0) _out2 asm ("out2") = (out2); \
LOAD_ARGS_2 (out0, out1)
-#define LOAD_ARGS_4(out0, out1, out2, out3) \
- register long _out3 asm ("out3") = (long) (out3); \
+#define LOAD_ARGS_4(out0, out1, out2, out3) \
+ register __typeof ((out3) + 0) _out3 asm ("out3") = (out3); \
LOAD_ARGS_3 (out0, out1, out2)
-#define LOAD_ARGS_5(out0, out1, out2, out3, out4) \
- register long _out4 asm ("out4") = (long) (out4); \
+#define LOAD_ARGS_5(out0, out1, out2, out3, out4) \
+ register __typeof ((out4) + 0) _out4 asm ("out4") = (out4); \
LOAD_ARGS_4 (out0, out1, out2, out3)
-#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5) \
- register long _out5 asm ("out5") = (long) (out5); \
+#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5) \
+ register __typeof ((out5) + 0) _out5 asm ("out5") = (out5); \
LOAD_ARGS_5 (out0, out1, out2, out3, out4)
#define ASM_OUTARGS_0

View File

@@ -0,0 +1,78 @@
--- glibc-2.3.2-net/iconv/iconvconfig.c 12 Jun 2003 09:48:20 -0000 1.1.1.10
+++ glibc-2.3.2-redhat/iconv/iconvconfig.c 12 Jun 2003 09:55:36 -0000 1.14
@@ -988,6 +988,34 @@ next_prime (uint32_t seed)
module name offset
(following last entry with step count 0)
*/
+
+static struct hash_entry *hash_table;
+static size_t hash_size;
+
+/* Function to insert the names. */
+static void name_insert (const void *nodep, VISIT value, int level)
+{
+ struct name *name;
+ unsigned int idx;
+ unsigned int hval2;
+
+ if (value != leaf && value != postorder)
+ return;
+
+ name = *(struct name **) nodep;
+ idx = name->hashval % hash_size;
+ hval2 = 1 + name->hashval % (hash_size - 2);
+
+ while (hash_table[idx].string_offset != 0)
+ if ((idx += hval2) >= hash_size)
+ idx -= hash_size;
+
+ hash_table[idx].string_offset = strtaboffset (name->strent);
+
+ assert (name->module_idx != -1);
+ hash_table[idx].module_idx = name->module_idx;
+}
+
static int
write_output (void)
{
@@ -995,8 +1023,6 @@ write_output (void)
char *string_table;
size_t string_table_size;
struct gconvcache_header header;
- struct hash_entry *hash_table;
- size_t hash_size;
struct module_entry *module_table;
char *extra_table;
char *cur_extra_table;
@@ -1008,30 +1034,6 @@ write_output (void)
char tmpfname[prefix_len + sizeof (GCONV_MODULES_CACHE)
+ strlen (".XXXXXX")];
char finalname[prefix_len + sizeof (GCONV_MODULES_CACHE)];
-
- /* Function to insert the names. */
- static void name_insert (const void *nodep, VISIT value, int level)
- {
- struct name *name;
- unsigned int idx;
- unsigned int hval2;
-
- if (value != leaf && value != postorder)
- return;
-
- name = *(struct name **) nodep;
- idx = name->hashval % hash_size;
- hval2 = 1 + name->hashval % (hash_size - 2);
-
- while (hash_table[idx].string_offset != 0)
- if ((idx += hval2) >= hash_size)
- idx -= hash_size;
-
- hash_table[idx].string_offset = strtaboffset (name->strent);
-
- assert (name->module_idx != -1);
- hash_table[idx].module_idx = name->module_idx;
- }
/* Open the output file. */
assert (GCONV_MODULES_CACHE[0] == '/');

View File

@@ -0,0 +1,112 @@
--- libc/resolv/nss_dns/dns-host.c 2003/10/26 08:33:27 1.38
+++ libc/resolv/nss_dns/dns-host.c 2004/01/15 09:45:57 1.39
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -298,6 +298,8 @@
return NSS_STATUS_UNAVAIL;
}
+ host_buffer.buf = orig_host_buffer = (querybuf *) alloca (1024);
+
switch (af)
{
case AF_INET:
@@ -305,29 +307,38 @@
(uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
- /* XXX Maybe we need an option to select whether to use the nibble
- or the bitfield form. The RFC requires the bitfield form so
- we use it. */
+ /* Only lookup with the byte string format if the user wants it. */
+ if (__builtin_expect (_res.options & RES_USEBSTRING, 0))
+ {
+ qp = stpcpy (qbuf, "\\[x");
+ for (n = 0; n < IN6ADDRSZ; ++n)
+ qp += sprintf (qp, "%02hhx", uaddr[n]);
+ strcpy (qp, "].ip6.arpa");
+ n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR,
+ host_buffer.buf->buf, 1024, &host_buffer.ptr);
+ if (n >= 0)
+ goto got_it_already;
+ }
qp = qbuf;
- qp = stpcpy (qbuf, "\\[x");
- for (n = 0; n < IN6ADDRSZ; ++n)
- qp += sprintf (qp, "%02hhx", uaddr[n]);
- strcpy (qp, "].ip6.arpa");
+ for (n = IN6ADDRSZ - 1; n >= 0; n--)
+ {
+ static const char nibblechar[16] = "0123456789abcdef";
+ *qp++ = nibblechar[uaddr[n] & 0xf];
+ *qp++ = '.';
+ *qp++ = nibblechar[(uaddr[n] >> 4) & 0xf];
+ *qp++ = '.';
+ }
+ strcpy(qp, "ip6.arpa");
break;
default:
/* Cannot happen. */
break;
}
- host_buffer.buf = orig_host_buffer = (querybuf *) alloca (1024);
-
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
1024, &host_buffer.ptr);
if (n < 0 && af == AF_INET6)
{
- qp = qbuf;
- for (n = IN6ADDRSZ - 1; n >= 0; n--)
- qp += sprintf (qp, "%x.%x.", uaddr[n] & 0xf, (uaddr[n] >> 4) & 0xf);
strcpy (qp, "ip6.int");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
@@ -342,6 +353,7 @@
return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
}
+ got_it_already:
status = getanswer_r (host_buffer.buf, n, qbuf, T_PTR, result, buffer, buflen,
errnop, h_errnop, 0 /* XXX */);
if (host_buffer.buf != orig_host_buffer)
--- libc/resolv/resolv.h 2002/12/15 23:22:50 1.37
+++ libc/resolv/resolv.h 2004/01/15 09:41:58 1.38
@@ -199,6 +199,8 @@
#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */
#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */
#define RES_BLAST 0x00020000 /* blast all recursive servers */
+#define RES_USEBSTRING 0x00040000 /* IPv6 reverse lookup with byte
+ strings */
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
--- libc/resolv/res_debug.c 2002/08/08 02:01:31 1.28
+++ libc/resolv/res_debug.c 2004/01/15 09:43:35 1.29
@@ -572,6 +572,10 @@
case RES_DNSRCH: return "dnsrch";
case RES_INSECURE1: return "insecure1";
case RES_INSECURE2: return "insecure2";
+ case RES_USE_INET6: return "inet6";
+ case RES_ROTATE: return "rotate";
+ case RES_NOCHECKNAME: return "no-check-names";
+ case RES_USEBSTRING: return "ip6-bytstring";
/* XXX nonreentrant */
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
return (nbuf);
--- libc/resolv/res_init.c 2003/09/04 12:48:52 1.34
+++ libc/resolv/res_init.c 2004/01/15 09:44:18 1.35
@@ -489,6 +489,9 @@
#endif
} else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) {
statp->options |= RES_USE_INET6;
+ } else if (!strncmp(cp, "ip6-bytestring",
+ sizeof("ip6-bytestring") - 1)) {
+ statp->options |= RES_USEBSTRING;
} else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) {
statp->options |= RES_ROTATE;
} else if (!strncmp(cp, "no-check-names",

View File

@@ -0,0 +1,153 @@
2003-09-10 Chris Demetriou <cgd@broadcom.com>
* sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h: New file.
Index: linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
--- /dev/null Wed Sep 10 15:45:19 2003
+++ linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h Wed Sep 10 15:45:14 2003
@@ -0,0 +1,145 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Chris Demetriou of Broadcom Corporation,
+ based on work by Guido Guenther <agx@sigxcpu.org>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#ifndef __ASSEMBLER__
+# include <linuxthreads/internals.h>
+#endif
+#include <sys/asm.h>
+
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
+#ifdef __PIC__
+# undef PSEUDO
+# define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+ 99: \
+ PTR_LA t9,__syscall_error; \
+ /* manual cpreturn. */ \
+ REG_L gp, STKOFF_GP(sp); \
+ RESTORESTK ; \
+ jr t9; \
+ ENTRY (name) \
+ SAVESTK ; \
+ .cpsetup t9, STKOFF_GP, name ; \
+ .set reorder; \
+ SINGLE_THREAD_P(t0); \
+ bne zero, t0, L(pseudo_cancel); \
+ .set noreorder; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, SYSCALL_ERROR_LABEL; \
+ /* manual cpreturn. */ \
+ REG_L gp, STKOFF_GP(sp); \
+ RESTORESTK ; \
+ ret; \
+ L(pseudo_cancel): \
+ REG_S ra, STKOFF_RA(sp); \
+ PUSHARGS_##args; /* save syscall args */ \
+ CENABLE; \
+ REG_S v0, STKOFF_SVMSK(sp); /* save mask */ \
+ POPARGS_##args; /* restore syscall args */ \
+ .set noreorder; \
+ li v0, SYS_ify (syscall_name); \
+ syscall; \
+ .set reorder; \
+ REG_S v0, STKOFF_SC_V0(sp); /* save syscall result */ \
+ REG_S a3, STKOFF_SC_ERR(sp); /* save syscall error flag */ \
+ REG_L a0, STKOFF_SVMSK(sp); /* pass mask as arg1 */ \
+ CDISABLE; \
+ REG_L a3, STKOFF_SC_ERR(sp); /* restore syscall error flag */ \
+ REG_L ra, STKOFF_RA(sp); /* restore return address */ \
+ REG_L v0, STKOFF_SC_V0(sp); /* restore syscall result */ \
+ bne a3, zero, SYSCALL_ERROR_LABEL; \
+ /* manual cpreturn. */ \
+ REG_L gp, STKOFF_GP(sp); \
+ RESTORESTK ; \
+ L(pseudo_end):
+#endif
+
+# define PUSHARGS_0 /* nothing to do */
+# define PUSHARGS_1 PUSHARGS_0 REG_S a0, STKOFF_A0(sp);
+# define PUSHARGS_2 PUSHARGS_1 REG_S a1, STKOFF_A1(sp);
+# define PUSHARGS_3 PUSHARGS_2 REG_S a2, STKOFF_A2(sp);
+# define PUSHARGS_4 PUSHARGS_3 REG_S a3, STKOFF_A3(sp);
+# define PUSHARGS_5 PUSHARGS_4 REG_S a4, STKOFF_A4(sp);
+# define PUSHARGS_6 PUSHARGS_5 REG_S a5, STKOFF_A5(sp);
+
+# define POPARGS_0 /* nothing to do */
+# define POPARGS_1 POPARGS_0 REG_L a0, STKOFF_A0(sp);
+# define POPARGS_2 POPARGS_1 REG_L a1, STKOFF_A1(sp);
+# define POPARGS_3 POPARGS_2 REG_L a2, STKOFF_A2(sp);
+# define POPARGS_4 POPARGS_3 REG_L a3, STKOFF_A3(sp);
+# define POPARGS_5 POPARGS_4 REG_L a4, STKOFF_A4(sp);
+# define POPARGS_6 POPARGS_5 REG_L a5, STKOFF_A5(sp);
+
+/* Save an even number of slots. Should be 0 if an even number of slots
+ are used below, or SZREG if an odd number are used. */
+# define STK_PAD SZREG
+
+/* Place values that we are more likely to use later in this sequence, i.e.
+ closer to the SP at function entry. If you do that, the are more
+ likely to already be in your d-cache. */
+# define STKOFF_A5 (STK_PAD)
+# define STKOFF_A4 (STKOFF_A5 + SZREG)
+# define STKOFF_A3 (STKOFF_A4 + SZREG)
+# define STKOFF_A2 (STKOFF_A3 + SZREG) /* MT and more args. */
+# define STKOFF_A1 (STKOFF_A2 + SZREG) /* MT and 2 args. */
+# define STKOFF_A0 (STKOFF_A1 + SZREG) /* MT and 1 arg. */
+# define STKOFF_RA (STKOFF_A0 + SZREG) /* Used if MT. */
+# define STKOFF_SC_V0 (STKOFF_RA + SZREG) /* Used if MT. */
+# define STKOFF_SC_ERR (STKOFF_SC_V0 + SZREG) /* Used if MT. */
+# define STKOFF_SVMSK (STKOFF_SC_ERR + SZREG) /* Used if MT. */
+# define STKOFF_GP (STKOFF_SVMSK + SZREG) /* Always used. */
+
+# define STKSPACE (STKOFF_GP + SZREG)
+# define SAVESTK PTR_SUBU sp, STKSPACE
+# define RESTORESTK PTR_ADDU sp, STKSPACE
+
+# ifdef IS_IN_libpthread
+# define CENABLE PTR_LA t9, __pthread_enable_asynccancel; jalr t9;
+# define CDISABLE PTR_LA t9, __pthread_disable_asynccancel; jalr t9;
+# define __local_multiple_threads __pthread_multiple_threads
+# else
+# define CENABLE PTR_LA t9, __libc_enable_asynccancel; jalr t9;
+# define CDISABLE PTR_LA t9, __libc_disable_asynccancel; jalr t9;
+# define __local_multiple_threads __libc_multiple_threads
+# endif
+
+# if !defined NOT_IN_libc
+# define __local_multiple_threads __libc_multiple_threads
+# else
+# define __local_multiple_threads __pthread_multiple_threads
+# endif
+
+# ifndef __ASSEMBLER__
+extern int __local_multiple_threads attribute_hidden;
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
+# else
+# define SINGLE_THREAD_P(reg) lw reg, __local_multiple_threads
+#endif
+
+#elif !defined __ASSEMBLER__
+
+/* This code should never be used but we define it anyhow. */
+# define SINGLE_THREAD_P (1)
+
+#endif

View File

@@ -0,0 +1,20 @@
2003-07-17 Guido Guenther <agx@sigxcpu.org>
* configure.in: pass $CFLAGS to ld --version-script test
Index: configure.in
===================================================================
RCS file: /cvs/glibc/libc/configure.in,v
retrieving revision 1.401
diff -u -r1.401 configure.in
--- configure.in 3 Jul 2003 21:03:56 -0000 1.401
+++ configure.in 16 Jul 2003 18:35:18 -0000
@@ -1051,7 +1051,7 @@
global: sym;
} VERS_1;
EOF
- if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
+ if ${CC-cc} -c $ASFLAGS $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
-o conftest.so conftest.o
-nostartfiles -nostdlib

View File

@@ -0,0 +1,132 @@
2003-09-10 Chris Demetriou <cgd@broadcom.com>
* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Remove
"#if 0" surrounding most of contents.
(SYSCALL_ERROR_LABEL): Define.
(__SYSCALL_CLOBBERS): Add $10.
(internal_syscall7): Remove.
* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise.
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
--- sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h Fri Aug 15 19:35:02 2003
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h Wed Sep 10 11:00:07 2003
@@ -33,9 +33,16 @@
# define SYS_ify(syscall_name) __NR_N32_/**/syscall_name
#endif
+#ifdef __ASSEMBLER__
-#ifndef __ASSEMBLER__
-#if 0 /* untested */
+/* We don't want the label for the error handler to be visible in the symbol
+ table when we define it here. */
+#ifdef __PIC__
+# define SYSCALL_ERROR_LABEL 99b
+#endif
+
+#else /* ! __ASSEMBLER__ */
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
@@ -227,37 +234,8 @@
} \
_sys_result; \
})
-
-#define internal_syscall7(name, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
-({ \
- long _sys_result; \
- \
- { \
- register long long __v0 asm("$2"); \
- register long long __a0 asm("$4") = (long long) arg1; \
- register long long __a1 asm("$5") = (long long) arg2; \
- register long long __a2 asm("$6") = (long long) arg3; \
- register long long __a3 asm("$7") = (long long) arg4; \
- register long long __a4 asm("$8") = (long long) arg5; \
- register long long __a5 asm("$9") = (long long) arg6; \
- register long long __a6 asm("$10") = (long long) arg7; \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- "li\t$2, %5\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
- "r" (__a4), "r" (__a5), "r" (__a6) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-#define __SYSCALL_CLOBBERS "$1", "$3", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
-#endif /* untested */
+#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
#endif /* __ASSEMBLER__ */
#endif /* linux/mips/sysdep.h */
Index: sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
--- sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h Fri Aug 15 19:35:02 2003
+++ sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h Wed Sep 10 11:00:07 2003
@@ -33,9 +33,16 @@
# define SYS_ify(syscall_name) __NR_N64_/**/syscall_name
#endif
+#ifdef __ASSEMBLER__
-#ifndef __ASSEMBLER__
-#if 0 /* untested */
+/* We don't want the label for the error handler to be visible in the symbol
+ table when we define it here. */
+#ifdef __PIC__
+# define SYSCALL_ERROR_LABEL 99b
+#endif
+
+#else /* ! __ASSEMBLER__ */
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
@@ -227,37 +234,8 @@
} \
_sys_result; \
})
-
-#define internal_syscall7(name, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
-({ \
- long _sys_result; \
- \
- { \
- register long __v0 asm("$2"); \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a2 asm("$6") = (long) arg3; \
- register long __a3 asm("$7") = (long) arg4; \
- register long __a4 asm("$8") = (long) arg5; \
- register long __a5 asm("$9") = (long) arg6; \
- register long __a6 asm("$10") = (long) arg7; \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- "li\t$2, %5\t\t\t# " #name "\n\t" \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), \
- "r" (__a4), "r" (__a5), "r" (__a6) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-#define __SYSCALL_CLOBBERS "$1", "$3", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
-#endif /* untested */
+#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
#endif /* __ASSEMBLER__ */
#endif /* linux/mips/sysdep.h */

View File

@@ -0,0 +1,21 @@
--- sysdeps/mips/dl-machine.h.org Thu Apr 15 11:24:26 2004
+++ sysdeps/mips/dl-machine.h Thu Apr 15 11:38:28 2004
@@ -474,7 +474,7 @@
" STRINGXP(PTR_LA) " $25, _dl_start_user\n\
.globl _dl_start_user\n\
.type _dl_start_user,@function\n\
- .ent _dl_start_user\n\
+ .aent _dl_start_user\n\
_dl_start_user:\n\
" STRINGXP(SETUP_GP) "\n\
" STRINGXV(SETUP_GP64($18,_dl_start_user)) "\n\
@@ -512,8 +512,7 @@
" STRINGXP(PTR_LA) " $2, _dl_fini\n\
# Jump to the user entry point.\n\
move $25, $17\n\
- jr $25\n\
- .end _dl_start_user\n\t"\
+ jr $25\n\t"\
_RTLD_EPILOGUE(ENTRY_POINT)\
".previous"\
);

View File

@@ -0,0 +1,137 @@
2003-05-30 Guido Guenther <agx@sigxcpu.org>
* sysdeps/unix/sysv/linux/mips/pread.c: include <stddef.h>
* sysdeps/unix/sysv/linux/mips/pread.c: handle __NR_N32_pread64,
__NR_O32_pread64 and __NR__N64_pread64.
* sysdeps/unix/sysv/linux/mips/pread64.c: likewise.
* sysdeps/unix/sysv/linux/mips/pwrite.c: handle __NR_N32_pwrite64,
__NR_O32_pwrite64 and __NR__N64_pwrite64.
* sysdeps/unix/sysv/linux/mips/pwrite64.c: likewise.
Index: sysdeps/unix/sysv/linux/mips//pread.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pread.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 pread.c
--- sysdeps/unix/sysv/linux/mips//pread.c 30 May 2003 17:41:46 -0000 1.11
+++ sysdeps/unix/sysv/linux/mips//pread.c 23 Jul 2003 11:49:51 -0000
@@ -33,6 +34,24 @@
# error "__NR_pread and __NR_pread64 both defined???"
# endif
# define __NR_pread __NR_pread64
+#endif
+#ifdef __NR_O32_pread64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_O32_pread
+# error "__NR_O32_pread and __NR_O32_pread64 both defined???"
+# endif
+# define __NR_O32_pread __NR_O32_pread64
+#endif
+#ifdef __NR_N32_pread64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N32_pread
+# error "__NR_N32_pread and __NR_N32_pread64 both defined???"
+# endif
+# define __NR_N32_pread __NR_N32_pread64
+#endif
+#ifdef __NR_N64_pread64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N64_pread
+# error "__NR_N64_pread and __NR_N64_pread64 both defined???"
+# endif
+# define __NR_N64_pread __NR_N64_pread64
#endif
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
Index: sysdeps/unix/sysv/linux/mips//pread64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pread64.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 pread64.c
--- sysdeps/unix/sysv/linux/mips//pread64.c 30 May 2003 17:41:46 -0000 1.11
+++ sysdeps/unix/sysv/linux/mips//pread64.c 23 Jul 2003 11:49:51 -0000
@@ -33,6 +33,24 @@
# endif
# define __NR_pread __NR_pread64
#endif
+#ifdef __NR_O32_pread64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_O32_pread
+# error "__NR_O32_pread and __NR_O32_pread64 both defined???"
+# endif
+# define __NR_O32_pread __NR_O32_pread64
+#endif
+#ifdef __NR_N32_pread64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N32_pread
+# error "__NR_N32_pread and __NR_N32_pread64 both defined???"
+# endif
+# define __NR_N32_pread __NR_N32_pread64
+#endif
+#ifdef __NR_N64_pread64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N64_pread
+# error "__NR_N64_pread and __NR_N64_pread64 both defined???"
+# endif
+# define __NR_N64_pread __NR_N64_pread64
+#endif
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
Index: sysdeps/unix/sysv/linux/mips//pwrite.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pwrite.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 pwrite.c
--- sysdeps/unix/sysv/linux/mips//pwrite.c 30 May 2003 17:41:46 -0000 1.11
+++ sysdeps/unix/sysv/linux/mips//pwrite.c 23 Jul 2003 11:49:51 -0000
@@ -34,6 +34,24 @@
# endif
# define __NR_pwrite __NR_pwrite64
#endif
+#ifdef __NR_O32_pwrite64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_O32_pwrite
+# error "__NR_O32_pwrite and __NR_O32_pwrite64 both defined???"
+# endif
+# define __NR_O32_pwrite __NR_O32_pwrite64
+#endif
+#ifdef __NR_N32_pwrite64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N32_pwrite
+# error "__NR_N32_pwrite and __NR_N32_pwrite64 both defined???"
+# endif
+# define __NR_N32_pwrite __NR_N32_pwrite64
+#endif
+#ifdef __NR_N64_pwrite64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N64_pwrite
+# error "__NR_N64_pwrite and __NR_N64_pwrite64 both defined???"
+# endif
+# define __NR_N64_pwrite __NR_N64_pwrite64
+#endif
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
Index: sysdeps/unix/sysv/linux/mips//pwrite64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pwrite64.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 pwrite64.c
--- sysdeps/unix/sysv/linux/mips//pwrite64.c 30 May 2003 17:41:46 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips//pwrite64.c 23 Jul 2003 11:49:51 -0000
@@ -33,6 +33,24 @@
# endif
# define __NR_pwrite __NR_pwrite64
#endif
+#ifdef __NR_O32_pwrite64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_O32_pwrite
+# error "__NR_O32_pwrite and __NR_O32_pwrite64 both defined???"
+# endif
+# define __NR_O32_pwrite __NR_O32_pwrite64
+#endif
+#ifdef __NR_N32_pwrite64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N32_pwrite
+# error "__NR_N32_pwrite and __NR_N32_pwrite64 both defined???"
+# endif
+# define __NR_N32_pwrite __NR_N32_pwrite64
+#endif
+#ifdef __NR_N64_pwrite64 /* Newer kernels renamed but it's the same. */
+# ifdef __NR_N64_pwrite
+# error "__NR_N64_pwrite and __NR_N64_pwrite64 both defined???"
+# endif
+# define __NR_N64_pwrite __NR_N64_pwrite64
+#endif
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0

View File

@@ -0,0 +1,10 @@
--- glibc-2.3.2/nptl/unwind.c.orig 2003-05-17 22:11:05.000000000 +0200
+++ glibc-2.3.2/nptl/unwind.c 2003-05-17 22:08:30.000000000 +0200
@@ -20,6 +20,7 @@
#include <setjmp.h>
#include <stdlib.h>
+#include <unistd.h>
#include "pthreadP.h"

View File

@@ -0,0 +1,29 @@
--- malloc/malloc.c.orig 2004-01-03 18:36:23.000000000 -0500
+++ malloc/malloc.c 2004-01-03 18:46:16.000000000 -0500
@@ -311,6 +311,11 @@ extern "C" {
#define assert(x) ((void)0)
#endif
+/* needed for owl-malloc-unlink-sanity-check */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+#define ABORT_INSTRUCTION
+#endif
/*
INTERNAL_SIZE_T is the word-size used for internal bookkeeping
@@ -1951,6 +1956,14 @@ typedef struct malloc_chunk* mbinptr;
#define unlink(P, BK, FD) { \
FD = P->fd; \
BK = P->bk; \
+ /* owl-malloc-unlink-sanity-check */ \
+ if (FD->bk != P || BK->fd != P) \
+ { \
+ ABORT_INSTRUCTION; \
+ _exit(127); \
+ while (1) \
+ ABORT_INSTRUCTION; \
+ } \
FD->bk = BK; \
BK->fd = FD; \
}

View File

@@ -0,0 +1,144 @@
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/generic/libc-start.c glibc-2.3.2/sysdeps/generic/libc-start.c
--- glibc-2.3.2.ORIG/sysdeps/generic/libc-start.c 2003-02-14 23:59:15.000000000 +0100
+++ glibc-2.3.2/sysdeps/generic/libc-start.c 2003-11-08 21:32:03.000000000 +0100
@@ -184,6 +184,9 @@
_dl_debug_printf ("\ntransferring control: %s\n\n", argv[0]);
#endif
+ /* call the __guard_setup to set up the random __guard value */
+ __guard_setup (); /* pappy@gentoo.org */
+
#ifdef HAVE_CLEANUP_JMP_BUF
/* Memory for the cancellation buffer. */
struct pthread_unwind_buf unwind_buf;
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Dist glibc-2.3.2/sysdeps/unix/sysv/linux/Dist
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Dist 2003-02-21 07:30:10.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Dist 2003-11-08 21:13:58.000000000 +0100
@@ -1,3 +1,4 @@
+ssp.c
bits/initspin.h
cmsg_nxthdr.c
dl-brk.c
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Makefile glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Makefile 2002-12-17 00:36:52.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile 2003-11-08 21:13:58.000000000 +0100
@@ -1,5 +1,5 @@
ifeq ($(subdir),csu)
-sysdep_routines += errno-loc
+sysdep_routines += errno-loc ssp
endif
ifeq ($(subdir),db2)
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Versions glibc-2.3.2/sysdeps/unix/sysv/linux/Versions
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Versions 2002-12-17 00:28:17.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Versions 2003-11-08 21:13:58.000000000 +0100
@@ -108,6 +108,8 @@
GLIBC_2.3.2 {
# New kernel interfaces.
epoll_create; epoll_ctl; epoll_wait;
+ # global objects and functions for the propolice patch in gcc - moved from libgcc by pappy@gentoo.org
+ __guard; __guard_setup; __stack_smash_handler;
}
GLIBC_PRIVATE {
# needed by libpthread.
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/ssp.c glibc-2.3.2/sysdeps/unix/sysv/linux/ssp.c
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/ssp.c 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/ssp.c 2003-11-08 21:13:58.000000000 +0100
@@ -0,0 +1,97 @@
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef _POSIX_SOURCE
+#include <signal.h>
+#endif
+
+#if defined(HAVE_SYSLOG)
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <sys/syslog.h>
+#ifndef _PATH_LOG
+#define _PATH_LOG "/dev/log"
+#endif
+#endif
+
+long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+
+void __guard_setup (void)
+{
+ int fd;
+ if (__guard[0]!=0) return;
+ fd = open ("/dev/urandom", 0);
+ if (fd != -1) {
+ ssize_t size = read (fd, (char*)&__guard, sizeof(__guard));
+ close (fd) ;
+ if (size == sizeof(__guard)) return;
+ }
+ /* If a random generator can't be used, the protector switches the guard
+ to the "terminator canary" */
+ ((char*)__guard)[0] = 0; ((char*)__guard)[1] = 0;
+ ((char*)__guard)[2] = '\n'; ((char*)__guard)[3] = 255;
+}
+
+void __stack_smash_handler (char func[], int damaged)
+{
+#if defined (__GNU_LIBRARY__)
+ extern char * __progname;
+#endif
+ const char message[] = ": stack smashing attack in function ";
+ int bufsz = 512, len;
+ char buf[bufsz];
+#if defined(HAVE_SYSLOG)
+ int LogFile;
+ struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
+#endif
+#ifdef _POSIX_SOURCE
+ {
+ sigset_t mask;
+ sigfillset(&mask);
+ sigdelset(&mask, SIGABRT); /* Block all signal handlers */
+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGABRT */
+ }
+#endif
+
+ strcpy(buf, "<2>"); len=3; /* send LOG_CRIT */
+#if defined (__GNU_LIBRARY__)
+ strncat(buf, __progname, bufsz-len-1); len = strlen(buf);
+#endif
+ if (bufsz>len) {strncat(buf, message, bufsz-len-1); len = strlen(buf);}
+ if (bufsz>len) {strncat(buf, func, bufsz-len-1); len = strlen(buf);}
+ /* print error message */
+ write (STDERR_FILENO, buf+3, len-3);
+#if defined(HAVE_SYSLOG)
+ if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
+
+ /*
+ * Send "found" message to the "/dev/log" path
+ */
+ SyslogAddr.sun_family = AF_UNIX;
+ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
+ sizeof(SyslogAddr.sun_path) - 1);
+ SyslogAddr.sun_path[sizeof(SyslogAddr.sun_path) - 1] = '\0';
+ sendto(LogFile, buf, len, 0, (struct sockaddr *)&SyslogAddr,
+ sizeof(SyslogAddr));
+ }
+#endif
+
+#ifdef _POSIX_SOURCE
+ { /* Make sure the default handler is associated with SIGABRT */
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(struct sigaction));
+ sigfillset(&sa.sa_mask); /* Block all signals */
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGABRT, &sa, NULL);
+ (void)kill(getpid(), SIGABRT);
+ }
+#endif
+ _exit(127);
+}
+

View File

@@ -0,0 +1,43 @@
diff -Naur glibc-2.3.2-orig/sysdeps/generic/libc-start.c glibc-2.3.2/sysdeps/generic/libc-start.c
--- glibc-2.3.2-orig/sysdeps/generic/libc-start.c 2004-05-10 01:59:09.000000000 -0400
+++ glibc-2.3.2/sysdeps/generic/libc-start.c 2004-05-10 02:06:00.865611770 -0400
@@ -188,6 +188,9 @@
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
#endif
+ /* call the __guard_setup to set up the random __guard value */
+ __guard_setup (); /* pappy@gentoo.org (pappy rules) */
+
#ifdef HAVE_CLEANUP_JMP_BUF
/* Memory for the cancellation buffer. */
struct pthread_unwind_buf unwind_buf;
diff -Naur glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Dist glibc-2.3.2/sysdeps/unix/sysv/linux/Dist
--- glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Dist 2004-05-10 01:59:10.000000000 -0400
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Dist 2004-05-10 02:06:54.862038647 -0400
@@ -1,3 +1,4 @@
+ssp.c
bits/initspin.h
cmsg_nxthdr.c
dl-brk.c
diff -Naur glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Makefile glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Makefile 2004-05-10 01:59:10.000000000 -0400
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile 2004-05-10 02:07:50.709582758 -0400
@@ -1,5 +1,5 @@
ifeq ($(subdir),csu)
-sysdep_routines += errno-loc
+sysdep_routines += errno-loc ssp
endif
ifeq ($(subdir),assert)
diff -Naur glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Versions glibc-2.3.2/sysdeps/unix/sysv/linux/Versions
--- glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Versions 2004-05-10 01:59:10.000000000 -0400
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Versions 2004-05-10 02:10:30.410716176 -0400
@@ -108,6 +108,8 @@
GLIBC_2.3.2 {
# New kernel interfaces.
epoll_create; epoll_ctl; epoll_wait;
+ # global objects and functions for the propolice patch in gcc - moved from libgcc by pappy@gentoo.org
+ __guard; __guard_setup; __stack_smash_handler;
}
GLIBC_2.3.3 {
gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;

View File

@@ -0,0 +1,144 @@
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/generic/libc-start.c glibc-2.3.2/sysdeps/generic/libc-start.c
--- glibc-2.3.2.ORIG/sysdeps/generic/libc-start.c 2003-02-14 23:59:15.000000000 +0100
+++ glibc-2.3.2/sysdeps/generic/libc-start.c 2003-11-08 21:32:03.000000000 +0100
@@ -149,6 +149,9 @@
{
/* XXX This is where the try/finally handling must be used. */
+ /* call the __guard_setup to set up the random __guard value */
+ __guard_setup (); /* pappy@gentoo.org */
+
result = main (argc, argv, __environ);
}
#ifdef HAVE_CANCELBUF
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Dist glibc-2.3.2/sysdeps/unix/sysv/linux/Dist
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Dist 2003-02-21 07:30:10.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Dist 2003-11-08 21:13:58.000000000 +0100
@@ -1,3 +1,4 @@
+ssp.c
bits/initspin.h
cmsg_nxthdr.c
dl-brk.c
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Makefile glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Makefile 2002-12-17 00:36:52.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile 2003-11-08 21:13:58.000000000 +0100
@@ -1,5 +1,5 @@
ifeq ($(subdir),csu)
-sysdep_routines += errno-loc
+sysdep_routines += errno-loc ssp
endif
ifeq ($(subdir),db2)
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Versions glibc-2.3.2/sysdeps/unix/sysv/linux/Versions
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/Versions 2002-12-17 00:28:17.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Versions 2003-11-08 21:13:58.000000000 +0100
@@ -108,6 +108,8 @@
GLIBC_2.3.2 {
# New kernel interfaces.
epoll_create; epoll_ctl; epoll_wait;
+ # global objects and functions for the propolice patch in gcc - moved from libgcc by pappy@gentoo.org
+ __guard; __guard_setup; __stack_smash_handler;
}
GLIBC_PRIVATE {
# needed by libpthread.
diff -u -r -N glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/ssp.c glibc-2.3.2/sysdeps/unix/sysv/linux/ssp.c
--- glibc-2.3.2.ORIG/sysdeps/unix/sysv/linux/ssp.c 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/ssp.c 2003-11-08 21:13:58.000000000 +0100
@@ -0,0 +1,97 @@
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef _POSIX_SOURCE
+#include <signal.h>
+#endif
+
+#if defined(HAVE_SYSLOG)
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <sys/syslog.h>
+#ifndef _PATH_LOG
+#define _PATH_LOG "/dev/log"
+#endif
+#endif
+
+long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+
+void __guard_setup (void)
+{
+ int fd;
+ if (__guard[0]!=0) return;
+ fd = open ("/dev/urandom", 0);
+ if (fd != -1) {
+ ssize_t size = read (fd, (char*)&__guard, sizeof(__guard));
+ close (fd) ;
+ if (size == sizeof(__guard)) return;
+ }
+ /* If a random generator can't be used, the protector switches the guard
+ to the "terminator canary" */
+ ((char*)__guard)[0] = 0; ((char*)__guard)[1] = 0;
+ ((char*)__guard)[2] = '\n'; ((char*)__guard)[3] = 255;
+}
+
+void __stack_smash_handler (char func[], int damaged)
+{
+#if defined (__GNU_LIBRARY__)
+ extern char * __progname;
+#endif
+ const char message[] = ": stack smashing attack in function ";
+ int bufsz = 512, len;
+ char buf[bufsz];
+#if defined(HAVE_SYSLOG)
+ int LogFile;
+ struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
+#endif
+#ifdef _POSIX_SOURCE
+ {
+ sigset_t mask;
+ sigfillset(&mask);
+ sigdelset(&mask, SIGABRT); /* Block all signal handlers */
+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGABRT */
+ }
+#endif
+
+ strcpy(buf, "<2>"); len=3; /* send LOG_CRIT */
+#if defined (__GNU_LIBRARY__)
+ strncat(buf, __progname, bufsz-len-1); len = strlen(buf);
+#endif
+ if (bufsz>len) {strncat(buf, message, bufsz-len-1); len = strlen(buf);}
+ if (bufsz>len) {strncat(buf, func, bufsz-len-1); len = strlen(buf);}
+ /* print error message */
+ write (STDERR_FILENO, buf+3, len-3);
+#if defined(HAVE_SYSLOG)
+ if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
+
+ /*
+ * Send "found" message to the "/dev/log" path
+ */
+ SyslogAddr.sun_family = AF_UNIX;
+ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
+ sizeof(SyslogAddr.sun_path) - 1);
+ SyslogAddr.sun_path[sizeof(SyslogAddr.sun_path) - 1] = '\0';
+ sendto(LogFile, buf, len, 0, (struct sockaddr *)&SyslogAddr,
+ sizeof(SyslogAddr));
+ }
+#endif
+
+#ifdef _POSIX_SOURCE
+ { /* Make sure the default handler is associated with SIGABRT */
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(struct sigaction));
+ sigfillset(&sa.sa_mask); /* Block all signals */
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGABRT, &sa, NULL);
+ (void)kill(getpid(), SIGABRT);
+ }
+#endif
+ _exit(127);
+}
+

View File

@@ -0,0 +1,29 @@
--- elf/elf.h.orig 2004-01-26 12:54:15.000000000 -0500
+++ elf/elf.h 2004-01-26 12:53:23.000000000 -0500
@@ -568,6 +568,7 @@
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
+#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
@@ -581,6 +582,18 @@
#define PF_X (1 << 0) /* Segment is executable */
#define PF_W (1 << 1) /* Segment is writable */
#define PF_R (1 << 2) /* Segment is readable */
+#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
+#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
+#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
+#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
+#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
+#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
+#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
+#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
+#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
+#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
+#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
+#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
#define PF_MASKOS 0x0ff00000 /* OS-specific */
#define PF_MASKPROC 0xf0000000 /* Processor-specific */

View File

@@ -0,0 +1,58 @@
--- glibc-2.3.2-net/linuxthreads/Makefile 13 May 2003 19:51:57 -0000 1.1.1.46
+++ glibc-2.3.2-redhat/linuxthreads/Makefile 13 May 2003 20:07:01 -0000 1.25
@@ -217,15 +217,18 @@ $(addprefix $(objpfx), \
$(filter-out $(tests-static) $(tests-reverse) unload, \
$(tests) $(test-srcs))): $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
-# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# $(objpfx)linklibc.so is used instead of $(common-objpfx)libc.so,
# since otherwise libpthread.so comes before libc.so when linking.
$(addprefix $(objpfx), $(tests-reverse)): \
- $(objpfx)../libc.so $(objpfx)libpthread.so \
+ $(objpfx)linklibc.so $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
$(objpfx)../libc.so: $(common-objpfx)libc.so ;
$(addprefix $(objpfx),$(librt-tests)): $(common-objpfx)rt/librt.so
$(objpfx)unload: $(common-objpfx)dlfcn/libdl.so
$(objpfx)unload.out: $(objpfx)libpthread.so $(objpfx)libpthread_nonshared.a
+$(objpfx)linklibc.so: $(common-objpfx)libc.so
+ ln -s ../libc.so $@
+generated += libclink.so
else
$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
$(addprefix $(objpfx),$(librt-tests)): $(common-objpfx)rt/librt.a
--- glibc-2.3.2-net/linuxthreads/cancel.c 22 Feb 2003 16:58:54 -0000 1.1.1.15
+++ glibc-2.3.2-redhat/linuxthreads/cancel.c 23 Feb 2003 21:15:06 -0000 1.10
@@ -230,5 +230,6 @@ void __pthread_perform_cleanup(char *cur
}
/* And the TSD which needs special help. */
+ THREAD_SETMEM (self, p_cancelstate, PTHREAD_CANCEL_DISABLE);
__libc_thread_freeres ();
}
--- glibc-2.3.2-net/linuxthreads/lockfile.c 18 Dec 2002 12:43:50 -0000 1.1.1.7
+++ glibc-2.3.2-redhat/linuxthreads/lockfile.c 18 Dec 2002 12:48:17 -0000 1.8
@@ -74,7 +74,11 @@ __fresetlockfiles (void)
__pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE_NP);
for (i = _IO_iter_begin(); i != _IO_iter_end(); i = _IO_iter_next(i))
- __pthread_mutex_init (_IO_iter_file(i)->_lock, &attr);
+ {
+ _IO_lock_t *_lock = _IO_iter_file(i)->_lock;
+ if (_lock)
+ __pthread_mutex_init (_lock, &attr);
+ }
__pthread_mutexattr_destroy (&attr);
--- glibc-2.3.2-net/linuxthreads/semaphore.h 25 Jun 2001 11:31:17 -0000 1.1.1.6
+++ glibc-2.3.2-redhat/linuxthreads/semaphore.h 5 Apr 2002 10:02:50 -0000 1.2
@@ -21,6 +21,7 @@
# define __need_timespec
# include <time.h>
#endif
+#include <bits/pthreadtypes.h>
#ifndef _PTHREAD_DESCR_DEFINED
/* Thread descriptors. Needed for `sem_t' definition. */

View File

@@ -0,0 +1,25 @@
--- glibc-2.3.2-net/nptl/Makefile 15 May 2003 13:07:24 -0000 1.1.1.45
+++ glibc-2.3.2-redhat/nptl/Makefile 15 May 2003 13:28:12 -0000 1.50
@@ -330,15 +330,19 @@ $(addprefix $(objpfx), \
$(tests) $(test-srcs))): $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
$(objpfx)tst-unload: $(common-objpfx)dlfcn/libdl.so
-# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# $(objpfx)linklibc.so is used instead of $(common-objpfx)libc.so,
# since otherwise libpthread.so comes before libc.so when linking.
$(addprefix $(objpfx), $(tests-reverse)): \
- $(objpfx)../libc.so $(objpfx)libpthread.so \
+ $(objpfx)linklibc.so $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
$(objpfx)../libc.so: $(common-objpfx)libc.so ;
$(addprefix $(objpfx),$(tests-static)): $(objpfx)libpthread.a
$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
+
+$(objpfx)linklibc.so: $(common-objpfx)libc.so
+ ln -s ../libc.so $@
+generated += libclink.so
else
$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
endif

View File

@@ -0,0 +1,23 @@
--- glibc-2.3.2/elf/rtld.c 2004-02-03 19:52:59.420623568 +0200
+++ glibc-2.3.2.rtld/elf/rtld.c 2004-02-03 19:53:20.505418192 +0200
@@ -1280,19 +1280,7 @@ of this helper program; chances are you
while (GL(dl_loaded)->l_searchlist.r_list[i] != &GL(dl_rtld_map))
++i;
GL(dl_rtld_map).l_prev = GL(dl_loaded)->l_searchlist.r_list[i - 1];
- if (__builtin_expect (mode, normal) == normal)
- GL(dl_rtld_map).l_next = (i + 1 < GL(dl_loaded)->l_searchlist.r_nlist
- ? GL(dl_loaded)->l_searchlist.r_list[i + 1]
- : NULL);
- else
- /* In trace mode there might be an invisible object (which we
- could not find) after the previous one in the search list.
- In this case it doesn't matter much where we put the
- interpreter object, so we just initialize the list pointer so
- that the assertion below holds. */
- GL(dl_rtld_map).l_next = GL(dl_rtld_map).l_prev->l_next;
-
- assert (GL(dl_rtld_map).l_prev->l_next == GL(dl_rtld_map).l_next);
+ GL(dl_rtld_map).l_next = GL(dl_rtld_map).l_prev->l_next;
GL(dl_rtld_map).l_prev->l_next = &GL(dl_rtld_map);
if (GL(dl_rtld_map).l_next != NULL)
{

View File

@@ -0,0 +1,149 @@
From bug-glibc-bounces+listarch-bug-glibc=sources dot redhat dot com at gnu dot org Tue Aug 05 19:52:26 2003
Return-Path: <bug-glibc-bounces+listarch-bug-glibc=sources dot redhat dot com at gnu dot org>
Delivered-To: listarch-bug-glibc at sources dot redhat dot com
Received: (qmail 31779 invoked from network); 5 Aug 2003 19:52:26 -0000
Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173)
by sources dot redhat dot com with SMTP; 5 Aug 2003 19:52:26 -0000
Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org)
by monty-python dot gnu dot org with esmtp (Exim 4 dot 20)
id 19k7hp-0004mC-J0
for listarch-bug-glibc at sources dot redhat dot com; Tue, 05 Aug 2003 15:42:49 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20)
id 19k7hd-0004lI-No
for bug-glibc at gnu dot org; Tue, 05 Aug 2003 15:42:37 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20)
id 19k7h7-0004TP-8U
for bug-glibc at gnu dot org; Tue, 05 Aug 2003 15:42:36 -0400
Received: from [32.97.182.102] (helo=e2.ny.us.ibm.com)
by monty-python dot gnu dot org with esmtp (Exim 4 dot 20) id 19k7h6-0004TH-V4
for bug-glibc at gnu dot org; Tue, 05 Aug 2003 15:42:05 -0400
Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com
[9 dot 56 dot 224 dot 150])
by e2 dot ny dot us dot ibm dot com (8 dot 12 dot 9/8 dot 12 dot 2) with ESMTP id h75Jg3PS037034;
Tue, 5 Aug 2003 15:42:03 -0400
Received: from D01ML249.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216])
by northrelay02 dot pok dot ibm dot com (8 dot 12 dot 9/NCO/VER6 dot 5) with ESMTP id
h75Jg2vu131828; Tue, 5 Aug 2003 15:42:02 -0400
Importance: Normal
MIME-Version: 1.0
Sensitivity:
To: schwab at suse dot de, Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>
X-Mailer: Lotus Notes Release 5.0.11 July 24, 2002
From: William Jay Huie <wjhuie at us dot ibm dot com>
Message-ID: <OF3D561D81.1A9679A6-ON85256D79.00619378-85256D79.006DAF9F@us.ibm.com>
Date: Tue, 5 Aug 2003 15:41:56 -0400
X-MIMETrack: Serialize by Router on D01ML249/01/M/IBM(Release 6.0.1 [IBM]|June
10, 2003) at 08/05/2003 15:42:02,
Serialize complete at 08/05/2003 15:42:02
Cc: bug-glibc at gnu dot org
Subject: fixed building gcc-2.3.2 on s390
X-BeenThere: bug-glibc@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for the GNU standard C library <bug-glibc.gnu.org>
List-Archive: <http://mail.gnu.org/pipermail/bug-glibc>
List-Post: <mailto:bug-glibc at gnu dot org>
List-Help: <mailto:bug-glibc-request at gnu dot org?subject=help>
List-Subscribe: <http://mail dot gnu dot org/mailman/listinfo/bug-glibc>,
<mailto:bug-glibc-request at gnu dot org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1920858710=="
Sender: bug-glibc-bounces+listarch-bug-glibc=sources dot redhat dot com at gnu dot org
Errors-To: bug-glibc-bounces+listarch-bug-glibc=sources.redhat.com@gnu.org
This is a multipart message in MIME format.
--===============1920858710==
Content-Type: multipart/alternative;
boundary="=_alternative 006DAF4085256D79_="
This is a multipart message in MIME format.
--=_alternative 006DAF4085256D79_=
Content-Type: text/plain; charset="us-ascii"
The problem was related to a file including an obsolete header file.
Checking /usr/include/sys/ustat.h shows the following comment;
/*
* This interface is obsolete. Use <sys/statfs.h>
instead.
*/
Changing the include in the offending file;
osatest2:/usr/src/packages/SOURCES/glibc-2.3.2/sysdeps/unix/sysv/linux #
diff -u old.ustat.c ustat.c
--- old.ustat.c 2001-07-07 12:21:32.000000000 -0700
+++ ustat.c 2003-08-05 11:24:20.000000000 -0700
@@ -18,7 +18,7 @@
02111-1307 USA. */
#include <errno.h>
-#include <sys/ustat.h>
+#include <sys/statfs.h>
#include <sys/sysmacros.h>
#include <sysdep.h>
Things then build correctly,
This is on a SLES-8 s390 31bit system using glibc levels 2.2.5-92.
j
Jay Huie
wjhuie@us.ibm.com
zSeries Linux System Test
Phone: 845-435-8164
--=_alternative 006DAF4085256D79_=
Content-Type: text/html; charset="us-ascii"
<br><font size=2 face="sans-serif">The problem was related to a file including an obsolete header file.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Checking /usr/include/sys/ustat.h shows the following comment;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* This interface is obsolete. &nbsp;Use &lt;sys/statfs.h&gt; instead.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Changing the include in the offending file;</font>
<br>
<br><font size=2 face="sans-serif">osatest2:/usr/src/packages/SOURCES/glibc-2.3.2/sysdeps/unix/sysv/linux # diff -u old.ustat.c ustat.c</font>
<br><font size=2 face="sans-serif">--- old.ustat.c 2001-07-07 12:21:32.000000000 -0700</font>
<br><font size=2 face="sans-serif">+++ ustat.c &nbsp; &nbsp; 2003-08-05 11:24:20.000000000 -0700</font>
<br><font size=2 face="sans-serif">@@ -18,7 +18,7 @@</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; 02111-1307 USA. &nbsp;*/</font>
<br>
<br><font size=2 face="sans-serif">&nbsp;#include &lt;errno.h&gt;</font>
<br><font size=2 face="sans-serif">-#include &lt;sys/ustat.h&gt;</font>
<br><font size=2 face="sans-serif">+#include &lt;sys/statfs.h&gt;</font>
<br><font size=2 face="sans-serif">&nbsp;#include &lt;sys/sysmacros.h&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp;#include &lt;sysdep.h&gt;<br>
</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Things then build correctly,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; This is on a SLES-8 s390 31bit system using glibc levels 2.2.5-92.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; j</font>
<br><font size=2 face="sans-serif"><br>
Jay Huie <br>
&nbsp;wjhuie@us.ibm.com<br>
&nbsp;zSeries Linux System Test<br>
&nbsp;Phone: 845-435-8164<br>
</font>
--=_alternative 006DAF4085256D79_=--
--===============1920858710==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Bug-glibc mailing list
Bug-glibc@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-glibc
--===============1920858710==--

View File

@@ -0,0 +1,40 @@
--- ./sysdeps/unix/sysv/linux/ssp.c.orig 2004-01-23 19:54:19.000000000 -0500
+++ ./sysdeps/unix/sysv/linux/ssp.c 2004-01-23 19:56:34.000000000 -0500
@@ -52,8 +52,8 @@
{
sigset_t mask;
sigfillset(&mask);
- sigdelset(&mask, SIGABRT); /* Block all signal handlers */
- sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGABRT */
+ sigdelset(&mask, SIGSEGV); /* Block all signal handlers */
+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGSEGV */
}
#endif
@@ -65,6 +65,7 @@
if (bufsz>len) {strncat(buf, func, bufsz-len-1); len = strlen(buf);}
/* print error message */
write (STDERR_FILENO, buf+3, len-3);
+ write (STDERR_FILENO, "()\n", 3);
#if defined(HAVE_SYSLOG)
if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
@@ -81,15 +82,15 @@
#endif
#ifdef _POSIX_SOURCE
- { /* Make sure the default handler is associated with SIGABRT */
+ { /* Make sure the default handler is associated with SIGSEGV */
struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction));
sigfillset(&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
- sigaction(SIGABRT, &sa, NULL);
- (void)kill(getpid(), SIGABRT);
+ sigaction(SIGSEGV, &sa, NULL);
+ (void)kill(getpid(), SIGSEGV);
}
#endif
_exit(127);

View File

@@ -0,0 +1,90 @@
/* Copyright (C) 2003, 2004 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
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
#include <kernel-features.h>
int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
/* Advice the system about the expected behaviour of the application with
respect to the file associated with FD. */
struct fadvise64_64_layout
{
int fd;
off64_t offset;
off64_t len;
int advise;
};
int
__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
{
#ifdef __NR_fadvise64_64
struct fadvise64_64_layout parameters;
INTERNAL_SYSCALL_DECL (err);
parameters.fd = fd;
parameters.offset = offset;
parameters.len = len;
parameters.advise = advise;
int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters);
if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
return 0;
# ifndef __ASSUME_FADVISE64_64_SYSCALL
if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
# endif
return INTERNAL_SYSCALL_ERRNO (ret, err);
#endif
#ifndef __ASSUME_FADVISE64_64_SYSCALL
# ifdef __NR_fadvise64
if (len != (off_t) len)
return EOVERFLOW;
INTERNAL_SYSCALL_DECL (err2);
int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
__LONG_LONG_PAIR ((long) (offset >> 32),
(long) offset),
(off_t) len, advise);
if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
return 0;
return INTERNAL_SYSCALL_ERRNO (ret2, err2);
# else
return ENOSYS;
# endif
#endif
}
#include <shlib-compat.h>
#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
int
__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
{
return __posix_fadvise64_l64 (fd, offset, len, advise);
}
versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
#else
strong_alias (__posix_fadvise64_l64, posix_fadvise64);
#endif

View File

@@ -0,0 +1,160 @@
/*
* Distributed under the terms of the GNU General Public License v2
* $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/2.3.2/ssp.c,v 1.1 2004/06/05 15:54:29 tseng Exp $
*
* This is a modified version of Hiroaki Etoh's stack smashing routines
* implemented for glibc.
*
* The following people have contributed input to this code.
* Ned Ludd - <solar[@]gentoo.org>
* Alexander Gabert - <pappy[@]gentoo.org>
* The PaX Team - <pageexec[@]freemail.hu>
* Peter S. Mazinger - <ps.m[@]gmx.net>
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
* Robert Connolly - <robert[@]linuxfromscratch.org>
* Cory Visi <cory@visi.name>
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/syslog.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#ifndef _PATH_LOG
#define _PATH_LOG "/dev/log"
#endif
#ifdef __PROPOLICE_BLOCK_SEGV__
#define SSP_SIGTYPE SIGSEGV
#elif __PROPOLICE_BLOCK_KILL__
#define SSP_SIGTYPE SIGKILL
#else
#define SSP_SIGTYPE SIGABRT
#endif
unsigned long __guard = 0UL;
void
__guard_setup (void)
{
size_t size;
#ifdef HAVE_DEV_ERANDOM
int mib[3];
#endif
if (__guard != 0UL)
return;
#ifndef __SSP_QUICK_CANARY__
#ifdef HAVE_DEV_ERANDOM
/* Random is another depth in Linux, hence an array of 3. */
mib[0] = CTL_KERN;
mib[1] = KERN_RANDOM;
mib[2] = RANDOM_ERANDOM;
size = sizeof (unsigned long);
if (__sysctl (mib, 3, &__guard, &size, NULL, 0) != (-1))
if (__guard != 0UL)
return;
#endif
/*
* Attempt to open kernel pseudo random device if one exists before
* opening urandom to avoid system entropy depletion.
*/
{
int fd;
#ifdef HAVE_DEV_ERANDOM
if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1))
#endif
fd = open ("/dev/urandom", O_RDONLY);
if (fd != (-1))
{
size = read (fd, (char *) &__guard, sizeof (__guard));
close (fd);
if (size == sizeof (__guard))
return;
}
}
#endif
/* If sysctl was unsuccessful, use the "terminator canary". */
__guard = 0xFF0A0D00UL;
{
/* Everything failed? Or we are using a weakened model of the
* terminator canary */
struct timeval tv;
gettimeofday (&tv, NULL);
__guard ^= tv.tv_usec ^ tv.tv_sec;
}
}
void
__stack_smash_handler (char func[], int damaged)
{
struct sockaddr_un sock; /* AF_UNIX address of local logger */
struct sigaction sa;
const char message[] = ": stack smashing attack in function ";
int bufsz, len, log;
char buf[512];
extern char *__progname;
sigset_t mask;
sigfillset (&mask);
sigdelset (&mask, SSP_SIGTYPE); /* Block all signal handlers */
sigprocmask (SIG_BLOCK, &mask, NULL); /* except SIGABRT */
bufsz = sizeof (buf);
strcpy (buf, "<2>");
len = 3;
strncat (buf, __progname, sizeof (buf) - 4);
len = strlen (buf);
if (bufsz > len)
{
strncat (buf, message, bufsz - len - 1);
len = strlen (buf);
}
if (bufsz > len)
{
strncat (buf, func, bufsz - len - 1);
len = strlen (buf);
}
/* print error message */
write (STDERR_FILENO, buf + 3, len - 3);
write (STDERR_FILENO, "()\n", 3);
if ((log = socket (AF_UNIX, SOCK_DGRAM, 0)) != -1)
{
/* Send "found" message to the "/dev/log" path */
sock.sun_family = AF_UNIX;
(void) strncpy (sock.sun_path, _PATH_LOG, sizeof (sock.sun_path) - 1);
sock.sun_path[sizeof (sock.sun_path) - 1] = '\0';
sendto (log, buf, len, 0, (struct sockaddr *) &sock, sizeof (sock));
}
/* Make sure the default handler is associated with the our signal handler */
memset (&sa, 0, sizeof (struct sigaction));
sigfillset (&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
sigaction (SSP_SIGTYPE, &sa, NULL);
(void) kill (getpid (), SSP_SIGTYPE);
_exit (127);
}

View File

@@ -0,0 +1,69 @@
/* Definitions of macros to access `dev_t' values.
Copyright (C) 1996, 1997, 1999, 2003 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
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H 1
#include <features.h>
/* If the compiler does not know long long it is out of luck. We are
not going to hack weird hacks to support the dev_t representation
they need. */
#ifdef __GLIBC_HAVE_LONG_LONG
__extension__
extern __inline unsigned int gnu_dev_major (unsigned long long int __dev)
__THROW;
__extension__
extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
__THROW;
__extension__
extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
__THROW;
# if defined __GNUC__ && __GNUC__ >= 2
__extension__ extern __inline unsigned int
gnu_dev_major (unsigned long long int __dev) __THROW
{
return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
}
__extension__ extern __inline unsigned int
gnu_dev_minor (unsigned long long int __dev) __THROW
{
return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
}
__extension__ extern __inline unsigned long long int
gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW
{
return ((__minor & 0xff) | ((__major & 0xfff) << 8)
| (((unsigned long long int) (__minor & ~0xff)) << 12)
| (((unsigned long long int) (__major & ~0xfff)) << 32));
}
# endif
/* Access the functions with their traditional names. */
# define major(dev) gnu_dev_major (dev)
# define minor(dev) gnu_dev_minor (dev)
# define makedev(maj, min) gnu_dev_makedev (maj, min)
#endif
#endif /* sys/sysmacros.h */

View File

@@ -0,0 +1,43 @@
diff -Naur glibc-2.3.2-orig/sysdeps/generic/libc-start.c glibc-2.3.2/sysdeps/generic/libc-start.c
--- glibc-2.3.2-orig/sysdeps/generic/libc-start.c 2004-05-10 01:59:09.000000000 -0400
+++ glibc-2.3.2/sysdeps/generic/libc-start.c 2004-05-10 02:06:00.865611770 -0400
@@ -188,6 +188,9 @@
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
#endif
+ /* call the __guard_setup to set up the random __guard value */
+ __guard_setup (); /* pappy@gentoo.org (pappy rules) */
+
#ifdef HAVE_CLEANUP_JMP_BUF
/* Memory for the cancellation buffer. */
struct pthread_unwind_buf unwind_buf;
diff -Naur glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Dist glibc-2.3.2/sysdeps/unix/sysv/linux/Dist
--- glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Dist 2004-05-10 01:59:10.000000000 -0400
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Dist 2004-05-10 02:06:54.862038647 -0400
@@ -1,3 +1,4 @@
+ssp.c
bits/initspin.h
cmsg_nxthdr.c
dl-brk.c
diff -Naur glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Makefile glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Makefile 2004-05-10 01:59:10.000000000 -0400
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Makefile 2004-05-10 02:07:50.709582758 -0400
@@ -1,5 +1,5 @@
ifeq ($(subdir),csu)
-sysdep_routines += errno-loc
+sysdep_routines += errno-loc ssp
endif
ifeq ($(subdir),assert)
diff -Naur glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Versions glibc-2.3.2/sysdeps/unix/sysv/linux/Versions
--- glibc-2.3.2-orig/sysdeps/unix/sysv/linux/Versions 2004-05-10 01:59:10.000000000 -0400
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/Versions 2004-05-10 02:10:30.410716176 -0400
@@ -108,6 +108,8 @@
GLIBC_2.3.2 {
# New kernel interfaces.
epoll_create; epoll_ctl; epoll_wait;
+ # global objects and functions for the propolice patch in gcc - moved from libgcc by pappy@gentoo.org
+ __guard; __guard_setup; __stack_smash_handler;
}
GLIBC_2.3.3 {
gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;

View File

@@ -0,0 +1,70 @@
--- glibc-2.3.3/sysdeps/unix/sysv/linux/dl-execstack.c 2003-12-13 15:42:16.853396224 +0200
+++ glibc-2.3.3.PaX/sysdeps/unix/sysv/linux/dl-execstack.c 2003-12-13 15:42:25.290113648 +0200
@@ -47,11 +47,17 @@
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) == 0)
goto return_success;
# if __ASSUME_PROT_GROWSUPDOWN == 0
- if (errno == EINVAL)
+ if (errno == EINVAL) {
no_growsdown = true;
- else
+ } else {
+# endif
+ if (errno == EACCES) /* PAX is enabled */
+ return 0;
+ else
+ return errno;
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+ }
# endif
- return errno;
}
# endif
@@ -73,8 +79,11 @@
page -= size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GL(dl_pagesize))
/* We just tried to mprotect the top hole page and failed.
@@ -105,11 +114,17 @@
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSUP) == 0)
goto return_success;
# if __ASSUME_PROT_GROWSUPDOWN == 0
- if (errno == EINVAL)
+ if (errno == EINVAL) {
no_growsup = true;
- else
+ } else {
+# endif
+ if (errno == EACCES) /* PAX is enabled */
+ return 0;
+ else
+ return errno;
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+ }
# endif
- return errno;
}
# endif
@@ -130,8 +145,11 @@
page += size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GL(dl_pagesize))
/* We just tried to mprotect the lowest hole page and failed.

View File

@@ -0,0 +1,52 @@
diff -Naur glibc-2.3.2-orig/config.h.in glibc-2.3.2/config.h.in
--- glibc-2.3.2-orig/config.h.in 2004-05-11 21:44:51.000000000 -0400
+++ glibc-2.3.2/config.h.in 2004-05-11 22:41:34.903935791 -0400
@@ -208,6 +208,9 @@
/* Defined of libidn is available. */
#undef HAVE_LIBIDN
+/* Defined if economical random device is available. */
+#undef HAVE_DEV_ERANDOM
+
/*
*/
diff -Naur glibc-2.3.2-orig/configure.in glibc-2.3.2/configure.in
--- glibc-2.3.2-orig/configure.in 2004-05-11 21:44:51.000000000 -0400
+++ glibc-2.3.2/configure.in 2004-05-11 22:32:57.999546229 -0400
@@ -289,6 +289,13 @@
[])
AC_SUBST(all_warnings)
+dnl See whether the user wants to disable checking for /dev/erandom
+AC_ARG_ENABLE([dev-erandom],
+ AC_HELP_STRING([--disable-dev-erandom],
+ [disable testing for /dev/erandom]),
+ [try_dev_erandom=$enableval],
+ [try_dev_erandom=yes])
+
AC_CANONICAL_HOST
# The way shlib-versions is used to generate soversions.mk uses a
@@ -1911,6 +1918,21 @@
sizeof_long_double=$ac_cv_sizeof_long_double
AC_SUBST(sizeof_long_double)
+dnl check whether we have an economical random device
+if test "$try_dev_erandom" = yes ; then
+ AC_CACHE_CHECK(for economical random device, ac_cv_have_dev_random,
+ [if test -r "/dev/erandom" ; then
+ ac_cv_have_dev_erandom=yes; else ac_cv_have_dev_erandom=no; fi])
+ if test "$ac_cv_have_dev_erandom" = yes; then
+ AC_DEFINE(HAVE_DEV_ERANDOM,1,
+ [defined if the system supports an economical random device] )
+ fi
+else
+ AC_MSG_CHECKING(for economical random device)
+ ac_cv_have_dev_erandom=no
+ AC_MSG_RESULT(has been disabled)
+fi
+
### End of automated tests.
### Now run sysdeps configure fragments.

View File

@@ -0,0 +1,68 @@
#! /bin/sh -e
# DP: Description: Fix localedef segfault when run under exec-shield,
# PaX or similar. (#231438, #198099)
# DP: Dpatch Author: James Troup <james@nocrew.org>
# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
# DP: Upstream status: Unknown
# DP: Status Details: Unknown
# DP: Date: 2004-03-16
if [ $# -ne 2 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
-unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
--- glibc-2.3.3-net/locale/programs/3level.h 16 Jun 2003 07:19:09 -0000 1.1.1.5
+++ glibc-2.3.3-redhat/locale/programs/3level.h 16 Jun 2003 09:32:40 -0000 1.4
@@ -204,6 +204,42 @@ CONCAT(TABLE,_iterate) (struct TABLE *t,
}
}
}
+
+/* GCC ATM seems to do a poor job with pointers to nested functions passed
+ to inlined functions. Help it a little bit with this hack. */
+#define wchead_table_iterate(tp, fn) \
+do \
+ { \
+ struct wchead_table *t = (tp); \
+ uint32_t index1; \
+ for (index1 = 0; index1 < t->level1_size; index1++) \
+ { \
+ uint32_t lookup1 = t->level1[index1]; \
+ if (lookup1 != ((uint32_t) ~0)) \
+ { \
+ uint32_t lookup1_shifted = lookup1 << t->q; \
+ uint32_t index2; \
+ for (index2 = 0; index2 < (1 << t->q); index2++) \
+ { \
+ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
+ if (lookup2 != ((uint32_t) ~0)) \
+ { \
+ uint32_t lookup2_shifted = lookup2 << t->p; \
+ uint32_t index3; \
+ for (index3 = 0; index3 < (1 << t->p); index3++) \
+ { \
+ struct element_t *lookup3 \
+ = t->level3[index3 + lookup2_shifted]; \
+ if (lookup3 != NULL) \
+ fn ((((index1 << t->q) + index2) << t->p) + index3, \
+ lookup3); \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } while (0)
+
#endif
#ifndef NO_FINALIZE

View File

@@ -0,0 +1,52 @@
Index: sysdeps/mips/mips64/n32/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/mips64/n32/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- sysdeps/mips/mips64/n32/Makefile 29 Mar 2003 08:15:28 -0000 1.2
+++ sysdeps/mips/mips64/n32/Makefile 14 May 2004 05:32:32 -0000
@@ -2,5 +2,9 @@
long-double-fcts = yes
ifeq ($(filter -mabi=n32,$(CC)),)
-CC += -mabi=n32
+CC += -mabi=n32
endif
+ifeq ($(filter "-Wl,-m,elf32btsmipn32",$(LD)),)
+LD += -Wl,-m,elf32btsmipn32
+endif
+ABI_FLAG= -Wl,-m,elf32btsmipn32
Index: sysdeps/mips/mips64/n64/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/mips64/n64/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- sysdeps/mips/mips64/n64/Makefile 29 Mar 2003 08:15:28 -0000 1.2
+++ sysdeps/mips/mips64/n64/Makefile 14 May 2004 05:32:32 -0000
@@ -4,3 +4,10 @@
ifeq ($(filter -mabi=64,$(CC)),)
CC += -mabi=64
endif
+ifeq ($(filter "-Wl,-m,elf64btsmip",$(LDFLAGS)),)
+LDFLAGS += -Wl,-m,elf64btsmip
+endif
+ifeq ($(filter "-Wl,-m,elf64btsmip",$(ASFLAGS-.os)),)
+ASFLAGS-.os += -Wl,-m,elf64btsmip
+endif
+ABI_FLAG= -Wl,-m,elf64btsmip
Index: csu/Makefile
===================================================================
RCS file: /cvs/glibc/libc/csu/Makefile,v
retrieving revision 1.73
diff -u -r1.73 Makefile
--- csu/Makefile 8 Mar 2004 21:28:15 -0000 1.73
+++ csu/Makefile 14 May 2004 05:32:18 -0000
@@ -146,7 +147,7 @@
subdir_lib: $(extra-objs:%=$(objpfx)%)
define link-relocatable
-$(CC) -nostdlib -nostartfiles -r -o $@ $^
+$(CC) $(ABI_FLAG) -nostdlib -nostartfiles -r -o $@ $^
endef
ifndef start-installed-name-rule

View File

@@ -0,0 +1,32 @@
Index: sysdeps/unix/sysv/linux/configure
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/configure,v
retrieving revision 1.86
diff -u -r1.86 configure
--- sysdeps/unix/sysv/linux/configure 23 Mar 2003 02:10:04 -0000 1.86
+++ sysdeps/unix/sysv/linux/configure 1 Jun 2004 04:25:42 -0000
@@ -224,8 +224,7 @@
/usr | /usr/)
# 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
case $machine in
- sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
- mips/mips64/n64/* )
+ sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 )
libc_cv_slibdir="/lib64"
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/lib64';
@@ -233,14 +232,6 @@
libc_cv_localedir='${exec_prefix}/lib/locale'
fi
;;
- mips/mips64/n32/* )
- libc_cv_slibdir="/lib32"
- if test "$libdir" = '${exec_prefix}/lib'; then
- libdir='${exec_prefix}/lib32';
- # Locale data can be shared between 32bit and 64bit libraries
- libc_cv_localedir='${exec_prefix}/lib/locale'
- fi
- ;;
*)
libc_cv_slibdir="/lib"
;;

View File

@@ -0,0 +1,12 @@
Index: sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list,v
retrieving revision 1.2
diff -u -r1.2 syscalls.list
--- sysdeps/unix/sysv/linux/mips/mips64/syscalls.list 3 Sep 2003 03:16:25 -0000 1.2
+++ sysdeps/unix/sysv/linux/mips/mips64/syscalls.list 14 May 2004 05:32:37 -0000
@@ -18,3 +18,4 @@
semop - semop i:ipi __semop semop
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
+semtimedop - semtimedop i:ipip semtimedop

View File

@@ -0,0 +1,30 @@
This patch actually makes file identical to default implementaion..
Index: sysdeps/unix/sysv/linux/mips/sys/syscall.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/syscall.h,v
retrieving revision 1.8
diff -u -r1.8 syscall.h
--- sysdeps/unix/sysv/linux/mips/sys/syscall.h 17 Mar 2003 15:50:05 -0000 1.8
+++ sysdeps/unix/sysv/linux/mips/sys/syscall.h 14 May 2004 17:03:29 -0000
@@ -19,17 +19,10 @@
#ifndef _SYSCALL_H
#define _SYSCALL_H 1
-/* This file should list the numbers of the system the system knows.
- But instead of duplicating this we use the information available
- from the kernel sources. */
-#ifdef _LIBC
-/* Since the kernel doesn't define macro names in a way usable for
- glibc, we preprocess this header, and use it during the glibc build
- process. */
-# include <asm-unistd.h>
-#else
+/* This file should list the numbers of the system calls the system
+ knows. But instead of duplicating this we use the information
+ available from the kernel sources. */
# include <asm/unistd.h>
-#endif
#ifndef _LIBC
/* The Linux kernel header file defines macros `__NR_<name>', but some

View File

@@ -0,0 +1,52 @@
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h,v
retrieving revision 1.3
diff -u -r1.3 sysdep.h
--- sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h 1 Oct 2003 06:59:39 -0000 1.3
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h 14 May 2004 19:01:28 -0000
@@ -28,9 +28,9 @@
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_N32_##syscall_name
+# define SYS_ify(syscall_name) __NR_##syscall_name
#else
-# define SYS_ify(syscall_name) __NR_N32_/**/syscall_name
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
#endif
#ifdef __ASSEMBLER__
Index: sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h,v
retrieving revision 1.3
diff -u -r1.3 sysdep.h
--- sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h 1 Oct 2003 06:59:40 -0000 1.3
+++ sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h 14 May 2004 19:01:28 -0000
@@ -28,9 +28,9 @@
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_N64_##syscall_name
+# define SYS_ify(syscall_name) __NR_##syscall_name
#else
-# define SYS_ify(syscall_name) __NR_N64_/**/syscall_name
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
#endif
#ifdef __ASSEMBLER__
--- sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h.orig 2004-05-18 14:51:16.000000000 -0700
+++ sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h 2004-05-19 15:07:23.000000000 -0700
@@ -28,9 +28,9 @@
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_O32_##syscall_name
+# define SYS_ify(syscall_name) __NR_##syscall_name
#else
-# define SYS_ify(syscall_name) __NR_O32_/**/syscall_name
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
#endif
#endif /* linux/mips/mips32/kern64/sysdep.h */

View File

@@ -0,0 +1,29 @@
--- malloc/malloc.c.orig 2004-01-03 18:36:23.000000000 -0500
+++ malloc/malloc.c 2004-01-03 18:46:16.000000000 -0500
@@ -311,6 +311,11 @@ extern "C" {
#define assert(x) ((void)0)
#endif
+/* needed for owl-malloc-unlink-sanity-check */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+#define ABORT_INSTRUCTION
+#endif
/*
INTERNAL_SIZE_T is the word-size used for internal bookkeeping
@@ -1951,6 +1956,14 @@ typedef struct malloc_chunk* mbinptr;
#define unlink(P, BK, FD) { \
FD = P->fd; \
BK = P->bk; \
+ /* owl-malloc-unlink-sanity-check */ \
+ if (FD->bk != P || BK->fd != P) \
+ { \
+ ABORT_INSTRUCTION; \
+ _exit(127); \
+ while (1) \
+ ABORT_INSTRUCTION; \
+ } \
FD->bk = BK; \
BK->fd = FD; \
}

View File

@@ -0,0 +1,53 @@
--- glibc-2.3.2.orig/debug/catchsegv.sh 2004-10-05 01:25:30.683814576 -0400
+++ glibc-2.3.2/debug/catchsegv.sh 2004-10-05 01:26:57.567606232 -0400
@@ -49,9 +49,7 @@
esac
fi
-segv_output=`basename "$prog"`.segv.$$
-# Make sure this output file does not exist.
-rm -f "$segv_output"
+segv_output=`mktemp \`basename "$prog".segv.XXXXXX\`` || exit 1
# Redirect stderr to avoid termination message from shell.
(exec 3>&2 2>/dev/null
@@ -64,7 +62,7 @@
# Check for output. Even if the program terminated correctly it might
# be that a minor process (clone) failed. Therefore we do not check the
# exit code.
-if test -f "$segv_output"; then
+if test -s "$segv_output"; then
# The program caught a signal. The output is in the file with the
# name we have in SEGFAULT_OUTPUT_NAME. In the output the names of
# functions in shared objects are available, but names in the static
@@ -101,7 +99,7 @@
;;
esac
done)
- rm -f "$segv_output"
fi
+rm -f "$segv_output"
exit $exval
--- glibc-2.3.2.orig/libio/oldtmpfile.c 2004-10-05 01:25:31.045759552 -0400
+++ glibc-2.3.2/libio/oldtmpfile.c 2004-10-05 01:27:55.304828840 -0400
@@ -36,7 +36,7 @@
int fd;
FILE *f;
- if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
+ if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 1))
return NULL;
fd = __gen_tempname (buf, __GT_FILE);
if (fd < 0)
--- glibc-2.3.2.orig/sysdeps/generic/tmpfile.c 2004-10-05 01:25:40.103382584 -0400
+++ glibc-2.3.2/sysdeps/generic/tmpfile.c 2004-10-05 01:28:55.235717960 -0400
@@ -43,7 +43,7 @@
int fd;
FILE *f;
- if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
+ if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 1))
return NULL;
fd = __gen_tempname (buf, GEN_THIS);
if (fd < 0)

View File

@@ -0,0 +1,22 @@
--- glibc-2.3.2/sysdeps/i386/elf/start.S 2004-02-05 18:14:37.000000000 +0100
+++ glibc-2.3.2/sysdeps/i386/elf/start.S 2004-02-05 23:32:16.000000000 +0100
@@ -73,16 +73,13 @@ _start:
addl $_GLOBAL_OFFSET_TABLE_, %ebx
/* Push address of our own entry points to .fini and .init. */
- leal __libc_csu_fini@GOTOFF(%ebx), %eax
- pushl %eax
- leal __libc_csu_init@GOTOFF(%ebx), %eax
- pushl %eax
+ pushl __libc_csu_fini@GOT(%ebx)
+ pushl __libc_csu_init@GOT(%ebx)
pushl %ecx /* Push second argument: argv. */
pushl %esi /* Push first argument: argc. */
- leal BP_SYM (main)@GOTOFF(%ebx), %eax
- pushl %eax
+ pushl BP_SYM (main)@GOT(%ebx)
/* Call the user's main function, and exit with its value.
But let the libc call main. */

View File

@@ -0,0 +1,29 @@
--- elf/elf.h.orig 2004-01-26 12:54:15.000000000 -0500
+++ elf/elf.h 2004-01-26 12:53:23.000000000 -0500
@@ -568,6 +568,7 @@
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
+#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
@@ -581,6 +582,18 @@
#define PF_X (1 << 0) /* Segment is executable */
#define PF_W (1 << 1) /* Segment is writable */
#define PF_R (1 << 2) /* Segment is readable */
+#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
+#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
+#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
+#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
+#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
+#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
+#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
+#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
+#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
+#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
+#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
+#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
#define PF_MASKOS 0x0ff00000 /* OS-specific */
#define PF_MASKPROC 0xf0000000 /* Processor-specific */

View File

@@ -0,0 +1,40 @@
--- ./sysdeps/unix/sysv/linux/ssp.c.orig 2004-01-23 19:54:19.000000000 -0500
+++ ./sysdeps/unix/sysv/linux/ssp.c 2004-01-23 19:56:34.000000000 -0500
@@ -52,8 +52,8 @@
{
sigset_t mask;
sigfillset(&mask);
- sigdelset(&mask, SIGABRT); /* Block all signal handlers */
- sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGABRT */
+ sigdelset(&mask, SIGSEGV); /* Block all signal handlers */
+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGSEGV */
}
#endif
@@ -65,6 +65,7 @@
if (bufsz>len) {strncat(buf, func, bufsz-len-1); len = strlen(buf);}
/* print error message */
write (STDERR_FILENO, buf+3, len-3);
+ write (STDERR_FILENO, "()\n", 3);
#if defined(HAVE_SYSLOG)
if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
@@ -81,15 +82,15 @@
#endif
#ifdef _POSIX_SOURCE
- { /* Make sure the default handler is associated with SIGABRT */
+ { /* Make sure the default handler is associated with SIGSEGV */
struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction));
sigfillset(&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
- sigaction(SIGABRT, &sa, NULL);
- (void)kill(getpid(), SIGABRT);
+ sigaction(SIGSEGV, &sa, NULL);
+ (void)kill(getpid(), SIGSEGV);
}
#endif
_exit(127);

View File

@@ -0,0 +1,39 @@
Index: sysdeps/mips/dl-machine.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/dl-machine.h,v
retrieving revision 1.71
diff -u -r1.71 dl-machine.h
--- sysdeps/mips/dl-machine.h 15 Apr 2004 14:08:16 -0000 1.71
+++ sysdeps/mips/dl-machine.h 30 Apr 2004 15:05:23 -0000
@@ -254,7 +255,7 @@
}
}
- INTUSE (_dl_signal_error) (0, NULL, NULL, "cannot find runtime link map");
+ GLRO(dl_signal_error) (0, NULL, NULL, "cannot find runtime link map");
return NULL;
}
@@ -362,17 +363,17 @@
\
if (version->hash != 0) \
{ \
- value = _dl_lookup_versioned_symbol(strtab + sym->st_name, l, \
+ value = GLRO(dl_lookup_symbol_x)(strtab + sym->st_name, l, \
&sym, l->l_scope, version,\
- ELF_RTYPE_CLASS_PLT, 0); \
+ ELF_RTYPE_CLASS_PLT, 0,NULL); \
break; \
} \
/* Fall through. */ \
} \
case 0: \
- value = _dl_lookup_symbol (strtab + sym->st_name, l, &sym, \
- l->l_scope, ELF_RTYPE_CLASS_PLT, \
- DL_LOOKUP_ADD_DEPENDENCY); \
+ value = GLRO(dl_lookup_symbol_x) (strtab + sym->st_name, l, &sym, \
+ l->l_scope, NULL, ELF_RTYPE_CLASS_PLT, \
+ DL_LOOKUP_ADD_DEPENDENCY,NULL); \
} \
\
/* Currently value contains the base load address of the object \

View File

@@ -0,0 +1,252 @@
--- ./sysdeps/mips/bits/setjmp.h.orig 2003-12-12 02:59:09.000000000 +0100
+++ ./sysdeps/mips/bits/setjmp.h 2003-12-12 03:28:17.000000000 +0100
@@ -22,6 +22,8 @@
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
+#include <sgidefs.h>
+
typedef struct
{
#if _MIPS_SIM == _MIPS_SIM_ABI32
--- ./sysdeps/mips/mips64/setjmp.S.orig 2003-12-12 03:48:28.000000000 +0100
+++ ./sysdeps/mips/mips64/setjmp.S 2003-12-12 03:48:19.000000000 +0100
@@ -17,6 +17,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <sgidefs.h>
#include <sys/asm.h>
/* The function __sigsetjmp_aux saves all the registers, but it can't
--- ./sysdeps/mips/mips64/bsd-_setjmp.S.orig 2003-12-12 03:48:06.000000000 +0100
+++ ./sysdeps/mips/mips64/bsd-_setjmp.S 2003-12-12 03:47:56.000000000 +0100
@@ -22,6 +22,7 @@
in setjmp doesn't clobber the state restored by longjmp. */
#include <sysdep.h>
+#include <sgidefs.h>
#include <sys/asm.h>
#ifdef __PIC__
--- ./sysdeps/mips/mips64/bsd-setjmp.S.orig 2003-12-12 03:47:41.000000000 +0100
+++ ./sysdeps/mips/mips64/bsd-setjmp.S 2003-12-12 03:47:30.000000000 +0100
@@ -22,6 +22,7 @@
in setjmp doesn't clobber the state restored by longjmp. */
#include <sysdep.h>
+#include <sgidefs.h>
#include <sys/asm.h>
#ifdef PIC
--- ./sysdeps/mips/fpu/bits/mathdef.h.orig 2003-12-12 02:59:09.000000000 +0100
+++ ./sysdeps/mips/fpu/bits/mathdef.h 2003-12-12 03:26:31.000000000 +0100
@@ -21,6 +21,8 @@
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
+#include <sgidefs.h>
+
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
--- ./sysdeps/mips/sys/regdef.h.orig 2003-12-12 02:59:10.000000000 +0100
+++ ./sysdeps/mips/sys/regdef.h 2003-12-12 03:26:58.000000000 +0100
@@ -20,6 +20,8 @@
#ifndef _SYS_REGDEF_H
#define _SYS_REGDEF_H
+#include <sgidefs.h>
+
/*
* Symbolic register names for 32 bit ABI
*/
--- ./sysdeps/mips/sys/ucontext.h.orig 2003-12-12 02:59:10.000000000 +0100
+++ ./sysdeps/mips/sys/ucontext.h 2003-12-12 03:29:41.000000000 +0100
@@ -23,6 +23,7 @@
#include <features.h>
#include <signal.h>
+#include <sgidefs.h>
/* Type for general register. */
#if _MIPS_SIM == _MIPS_SIM_ABI32
--- ./sysdeps/mips/elf/start.S.orig 2003-12-12 03:47:16.000000000 +0100
+++ ./sysdeps/mips/elf/start.S 2003-12-12 03:47:05.000000000 +0100
@@ -20,6 +20,7 @@
#define __ASSEMBLY__ 1
#include <entry.h>
+#include <sgidefs.h>
#include <sys/asm.h>
#ifndef ENTRY_POINT
--- ./sysdeps/mips/atomicity.h.orig 2003-12-12 03:46:51.000000000 +0100
+++ ./sysdeps/mips/atomicity.h 2003-12-12 03:46:43.000000000 +0100
@@ -21,6 +21,7 @@
#define _MIPS_ATOMICITY_H 1
#include <inttypes.h>
+#include <sgidefs.h>
static inline int
__attribute__ ((unused))
--- ./sysdeps/mips/dl-machine.h.orig 2003-12-12 03:46:33.000000000 +0100
+++ ./sysdeps/mips/dl-machine.h 2003-12-12 03:46:19.000000000 +0100
@@ -27,6 +27,7 @@
#define ELF_MACHINE_NO_PLT
#include <entry.h>
+#include <sgidefs.h>
#ifndef ENTRY_POINT
#error ENTRY_POINT needs to be defined for MIPS.
--- ./sysdeps/mips/machine-gmon.h.orig 2003-12-12 03:46:05.000000000 +0100
+++ ./sysdeps/mips/machine-gmon.h 2003-12-12 03:45:55.000000000 +0100
@@ -18,6 +18,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <sgidefs.h>
+
#define _MCOUNT_DECL(frompc,selfpc) \
static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
--- ./sysdeps/unix/mips/sysdep.h.orig 2003-12-12 03:45:36.000000000 +0100
+++ ./sysdeps/unix/mips/sysdep.h 2003-12-12 03:45:23.000000000 +0100
@@ -19,6 +19,7 @@
02111-1307 USA. */
#include <sysdeps/unix/sysdep.h>
+#include <sgidefs.h>
#ifdef __ASSEMBLER__
--- ./sysdeps/unix/sysv/linux/mips/bits/sigcontext.h.orig 2003-12-12 02:59:10.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/bits/sigcontext.h 2003-12-12 03:33:57.000000000 +0100
@@ -20,6 +20,8 @@
# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
#endif
+#include <sgidefs.h>
+
#ifndef sigcontext_struct
/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
we need sigcontext. */
--- ./sysdeps/unix/sysv/linux/mips/bits/stat.h.orig 2003-12-12 02:59:10.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/bits/stat.h 2003-12-12 03:34:15.000000000 +0100
@@ -21,6 +21,8 @@
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#include <sgidefs.h>
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
--- ./sysdeps/unix/sysv/linux/mips/sigaction.c.orig 2003-12-12 03:43:00.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/sigaction.c 2003-12-12 03:42:49.000000000 +0100
@@ -21,6 +21,7 @@
#include <string.h>
#include <sysdep.h>
+#include <sgidefs.h>
#include <sys/syscall.h>
#include "kernel-features.h"
--- ./sysdeps/unix/sysv/linux/mips/sys/tas.h.orig 2003-12-12 02:59:10.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/sys/tas.h 2003-12-12 03:36:26.000000000 +0100
@@ -21,6 +21,7 @@
#define _SYS_TAS_H 1
#include <features.h>
+#include <sgidefs.h>
__BEGIN_DECLS
--- ./sysdeps/unix/sysv/linux/mips/sys/user.h.orig 2003-12-12 02:59:10.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/sys/user.h 2003-12-12 03:36:35.000000000 +0100
@@ -19,6 +19,8 @@
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
+#include <sgidefs.h>
+
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
--- ./sysdeps/unix/sysv/linux/mips/sys/ucontext.h.orig 2003-12-12 03:45:05.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/sys/ucontext.h 2003-12-12 03:44:55.000000000 +0100
@@ -22,6 +22,7 @@
#define _SYS_UCONTEXT_H 1
#include <features.h>
+#include <sgidefs.h>
#include <signal.h>
/* We need the signal context definitions even if they are not used
--- ./sysdeps/unix/sysv/linux/mips/kernel_stat.h.orig 2003-12-12 03:44:37.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/kernel_stat.h 2003-12-12 03:44:22.000000000 +0100
@@ -1,6 +1,9 @@
/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the
userland data structures are not identical, because of different
padding. */
+
+#include <sgidefs.h>
+
/* Definition of `struct stat' used in the kernel. */
#if _MIPS_SIM != _MIPS_SIM_ABI32
struct kernel_stat
--- ./sysdeps/unix/sysv/linux/mips/configure.orig 2003-12-12 03:51:49.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/configure 2003-12-12 03:49:46.000000000 +0100
@@ -41,7 +41,7 @@ echo "$as_me: WARNING: *** asm/unistd.h
name = $2;
sub (/_O32_/, "_", name);
print;
- print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
+ print "#if defined _ABIO32 && _MIPS_SIM == _ABIO32";
print "# define " name " " $2;
print "#endif";
next;
--- ./sysdeps/unix/sysv/linux/mips/configure.in.orig 2003-12-12 03:51:35.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/configure.in 2003-12-12 03:49:38.000000000 +0100
@@ -41,7 +41,7 @@ mips*64*)
name = $2;
sub (/_O32_/, "_", name);
print;
- print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
+ print "#if defined _ABIO32 && _MIPS_SIM == _ABIO32";
print "# define " name " " $2;
print "#endif";
next;
--- ./sysdeps/unix/sysv/linux/mips/sigcontextinfo.h.orig 2003-12-12 03:43:32.000000000 +0100
+++ ./sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 2003-12-12 03:43:16.000000000 +0100
@@ -17,6 +17,8 @@
02111-1307 USA. */
+#include <sgidefs.h>
+
#if _MIPS_SIM == _MIPS_SIM_ABI32
#define SIGCONTEXT unsigned long _code, struct sigcontext *
--- ./linuxthreads/sysdeps/mips/pspinlock.c.orig 2003-12-12 02:59:09.000000000 +0100
+++ ./linuxthreads/sysdeps/mips/pspinlock.c 2003-12-12 03:59:27.000000000 +0100
@@ -19,6 +19,7 @@
#include <errno.h>
#include <pthread.h>
+#include <sgidefs.h>
#include <sys/tas.h>
#include "internals.h"
--- ./linuxthreads/sysdeps/mips/pt-machine.h.orig 2003-12-12 02:59:09.000000000 +0100
+++ ./linuxthreads/sysdeps/mips/pt-machine.h 2003-12-12 03:59:26.000000000 +0100
@@ -24,6 +24,7 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <sgidefs.h>
#include <sys/tas.h>
#ifndef PT_EI

View File

@@ -0,0 +1,166 @@
/*
* Distributed under the terms of the GNU General Public License v2
* $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/2.3.3/ssp.c,v 1.3 2004/08/07 17:53:20 solar Exp $
*
* This is a modified version of Hiroaki Etoh's stack smashing routines
* implemented for glibc.
*
* The following people have contributed input to this code.
* Ned Ludd - <solar[@]gentoo.org>
* Alexander Gabert - <pappy[@]gentoo.org>
* The PaX Team - <pageexec[@]freemail.hu>
* Peter S. Mazinger - <ps.m[@]gmx.net>
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
* Robert Connolly - <robert[@]linuxfromscratch.org>
* Cory Visi <cory@visi.name>
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/syslog.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#ifndef _PATH_LOG
#define _PATH_LOG "/dev/log"
#endif
#ifdef __PROPOLICE_BLOCK_SEGV__
#define SSP_SIGTYPE SIGSEGV
#elif __PROPOLICE_BLOCK_KILL__
#define SSP_SIGTYPE SIGKILL
#else
#define SSP_SIGTYPE SIGABRT
#endif
unsigned long __guard = 0UL;
void
__guard_setup (void)
{
size_t size;
#ifdef HAVE_DEV_ERANDOM
int mib[3];
#endif
if (__guard != 0UL)
return;
#ifndef __SSP_QUICK_CANARY__
#ifdef HAVE_DEV_ERANDOM
/* Random is another depth in Linux, hence an array of 3. */
mib[0] = CTL_KERN;
mib[1] = KERN_RANDOM;
mib[2] = RANDOM_ERANDOM;
size = sizeof (unsigned long);
if (__sysctl (mib, 3, &__guard, &size, NULL, 0) != (-1))
if (__guard != 0UL)
return;
#endif
/*
* Attempt to open kernel pseudo random device if one exists before
* opening urandom to avoid system entropy depletion.
*/
{
int fd;
#ifdef HAVE_DEV_ERANDOM
if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1))
#endif
fd = open ("/dev/urandom", O_RDONLY);
if (fd != (-1))
{
size = read (fd, (char *) &__guard, sizeof (__guard));
close (fd);
if (size == sizeof (__guard))
return;
}
}
#endif
/* If sysctl was unsuccessful, use the "terminator canary". */
__guard = 0xFF0A0D00UL;
{
/* Everything failed? Or we are using a weakened model of the
* terminator canary */
struct timeval tv;
gettimeofday (&tv, NULL);
__guard ^= tv.tv_usec ^ tv.tv_sec;
}
}
void
__stack_smash_handler (char func[], int damaged)
{
struct sigaction sa;
const char message[] = ": stack smashing attack in function ";
int bufsz, len;
char buf[512];
#ifndef __dietlibc__
struct sockaddr_un sock; /* AF_UNIX address of local logger */
int log;
extern char *__progname;
#else
static char *__progname = "dietapp";
#endif
sigset_t mask;
sigfillset (&mask);
sigdelset (&mask, SSP_SIGTYPE); /* Block all signal handlers */
sigprocmask (SIG_BLOCK, &mask, NULL); /* except SIGABRT */
bufsz = sizeof (buf);
strcpy (buf, "<2>");
len = 3;
strncat (buf, __progname, sizeof (buf) - 4);
len = strlen (buf);
if (bufsz > len)
{
strncat (buf, message, bufsz - len - 1);
len = strlen (buf);
}
if (bufsz > len)
{
strncat (buf, func, bufsz - len - 1);
len = strlen (buf);
}
/* print error message */
write (STDERR_FILENO, buf + 3, len - 3);
write (STDERR_FILENO, "()\n", 3);
#ifndef __dietlibc__
if ((log = socket (AF_UNIX, SOCK_DGRAM, 0)) != -1)
{
/* Send "found" message to the "/dev/log" path */
sock.sun_family = AF_UNIX;
(void) strncpy (sock.sun_path, _PATH_LOG, sizeof (sock.sun_path) - 1);
sock.sun_path[sizeof (sock.sun_path) - 1] = '\0';
sendto (log, buf, len, 0, (struct sockaddr *) &sock, sizeof (sock));
}
#endif
/* Make sure the default handler is associated with the our signal handler */
memset (&sa, 0, sizeof (struct sigaction));
sigfillset (&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
sigaction (SSP_SIGTYPE, &sa, NULL);
(void) kill (getpid (), SSP_SIGTYPE);
_exit (127);
}

View File

@@ -0,0 +1,460 @@
--- resolv/res_hconf.c
+++ resolv/res_hconf.c 2004/09/21 12:56:54
@@ -59,6 +59,7 @@
#define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS"
#define ENV_MULTI "RESOLV_MULTI"
#define ENV_REORDER "RESOLV_REORDER"
+#define ENV_MDNS "RESOLV_MDNS"
static const char *arg_service_list (const char *, int, const char *,
unsigned int);
@@ -81,7 +82,8 @@
{"multi", arg_bool, HCONF_FLAG_MULTI},
{"nospoof", arg_bool, HCONF_FLAG_SPOOF},
{"spoofalert", arg_bool, HCONF_FLAG_SPOOFALERT},
- {"reorder", arg_bool, HCONF_FLAG_REORDER}
+ {"reorder", arg_bool, HCONF_FLAG_REORDER},
+ {"mdns", arg_bool, HCONF_FLAG_MDNS}
};
/* Structure containing the state. */
@@ -431,6 +433,9 @@
memset (&_res_hconf, '\0', sizeof (_res_hconf));
+ /* Default for mdns is "on". */
+ _res_hconf.flags |= HCONF_FLAG_MDNS;
+
hconf_name = getenv (ENV_HOSTCONF);
if (hconf_name == NULL)
hconf_name = _PATH_HOSTCONF;
@@ -483,6 +488,10 @@
arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval, 0);
}
+ envval = getenv (ENV_MDNS);
+ if (envval)
+ arg_bool (ENV_MDNS, 1, envval, HCONF_FLAG_MDNS);
+
_res_hconf.initialized = 1;
}
--- resolv/res_hconf.h
+++ resolv/res_hconf.h 2004/09/21 12:56:54
@@ -44,6 +44,7 @@
# define HCONF_FLAG_SPOOFALERT (1 << 2) /* syslog warning of spoofed */
# define HCONF_FLAG_REORDER (1 << 3) /* list best address first */
# define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */
+# define HCONF_FLAG_MDNS (1 << 5) /* Disable MDNS support */
};
extern struct hconf _res_hconf;
--- resolv/res_query.c
+++ resolv/res_query.c 2004/09/21 12:57:59
@@ -82,6 +82,8 @@
#include <stdlib.h>
#include <string.h>
+#include "res_hconf.h"
+
/* Options. Leave them on. */
/* #undef DEBUG */
@@ -278,6 +280,13 @@
*domain && !done;
domain++) {
+ if ((_res_hconf.flags & HCONF_FLAG_MDNS) != 0) {
+ /* don't add "local" domain if query contains a dot */
+ if (dots && (!__strcasecmp(*domain, "local") ||
+ !__strcasecmp(*domain, "local.")))
+ continue;
+ }
+
if (domain[0][0] == '\0' ||
(domain[0][0] == '.' && domain[0][1] == '\0'))
root_on_list++;
--- resolv/res_send.c
+++ resolv/res_send.c 2004/09/21 12:58:14
@@ -86,6 +86,9 @@
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
+#if defined(_LIBC) && defined(linux)
+#include <net/if.h>
+#endif
#include <errno.h>
#include <netdb.h>
@@ -96,6 +99,8 @@
#include <string.h>
#include <unistd.h>
+#include "res_hconf.h"
+
#if PACKETSZ > 65536
#define MAXPACKET PACKETSZ
#else
@@ -188,6 +193,9 @@
static int send_dg(res_state, const u_char *, int,
u_char **, int *, int *, int,
int *, int *, u_char **);
+static int send_dg_mdns(res_state, const u_char *, int,
+ u_char **, int *, int *, struct sockaddr_in6 *,
+ int *, int *, u_char **);
#ifdef DEBUG
static void Aerror(const res_state, FILE *, const char *, int,
const struct sockaddr *);
@@ -366,6 +374,35 @@
u_char *ans, int anssiz, u_char **ansp)
{
int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
+ int usemdns;
+ HEADER *qhp = (HEADER *) buf;
+
+ usemdns = 0;
+ if ((_res_hconf.flags & HCONF_FLAG_MDNS) != 0 &&
+ qhp->qr == 0 && qhp->opcode == QUERY && qhp->qdcount == htons(1)) {
+ /* got one simple query */
+ const u_char *bp, *be;
+ be = buf + buflen;
+ for (bp = buf + NS_HFIXEDSZ; bp < be; )
+ if ((*bp & NS_CMPRSFLGS) != 0)
+ break;
+ else if (*bp) {
+ if (*bp == 5 && !strncasecmp(bp, "\005local\000", 7)) {
+ usemdns = 1;
+ break;
+ }
+ if (*bp == 3 && !strncasecmp(bp, "\003254\003169\007in-addr\004arpa\000", 22)) {
+ usemdns = 1;
+ break;
+ }
+ if (*bp == 1 && !strncasecmp(bp, "\0010\0018\001e\001f\003ip6\004arpa\000", 18)) {
+ usemdns = 2;
+ break;
+ }
+ bp += *bp + 1;
+ } else
+ break;
+ }
if (statp->nscount == 0) {
__set_errno (ESRCH);
@@ -524,13 +561,28 @@
*/
for (try = 0; try < statp->retry; try++) {
#ifdef _LIBC
- for (ns = 0; ns < MAXNS; ns++)
+ for (ns = 0; ns < (usemdns ? 1 : MAXNS); ns++)
#else
for (ns = 0; ns < statp->nscount; ns++)
#endif
{
#ifdef _LIBC
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+ if (usemdns == 1) {
+ static struct sockaddr_in mdns4;
+ mdns4.sin_family = AF_INET;
+ mdns4.sin_port = htons(5353);
+ mdns4.sin_addr.s_addr = htonl(0xe00000fb);
+ nsap = (struct sockaddr_in6 *)&mdns4;
+ }
+ if (usemdns == 2) {
+ static struct sockaddr_in6 mdns6;
+ mdns6.sin6_family = AF_INET6;
+ mdns6.sin6_port = htons(5353);
+ mdns6.sin6_addr.s6_addr32[0] = htonl(0xff020000);
+ mdns6.sin6_addr.s6_addr32[3] = htonl(0x000000fb);
+ nsap = &mdns6;
+ }
if (nsap == NULL)
goto next_ns;
@@ -602,8 +654,11 @@
resplen = n;
} else {
/* Use datagrams. */
- n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
- ns, &v_circuit, &gotsomewhere, ansp);
+ if (usemdns)
+ n = send_dg_mdns(statp, buf, buflen, &ans, &anssiz, &terrno, nsap, &v_circuit, &gotsomewhere, ansp);
+ else
+ n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
+ ns, &v_circuit, &gotsomewhere, ansp);
if (n < 0)
return (-1);
if (n == 0)
@@ -675,8 +730,15 @@
if (!v_circuit) {
if (!gotsomewhere)
__set_errno (ECONNREFUSED); /* no nameservers found */
- else
+ else if (!usemdns) {
__set_errno (ETIMEDOUT); /* no answer obtained */
+ } else {
+ /* treat timeout as host not found */
+ HEADER *anhp = (HEADER *) ans;
+ memset(ans, 0, HFIXEDSZ);
+ anhp->rcode = NXDOMAIN;
+ return HFIXEDSZ;
+ }
} else
__set_errno (terrno);
return (-1);
@@ -1140,6 +1202,255 @@
return (resplen);
}
+static int
+send_dg_mdns(res_state statp,
+ const u_char *buf, int buflen, u_char **ansp, int *anssizp,
+ int *terrno, struct sockaddr_in6 *nsap, int *v_circuit, int *gotsomewhere, u_char **anscp)
+{
+ const HEADER *hp = (HEADER *) buf;
+ u_char *ans = *ansp;
+ int anssiz = *anssizp;
+ HEADER *anhp = (HEADER *) ans;
+ struct timespec now, timeout, finish;
+ struct pollfd pfd[32];
+ int ptimeout;
+ int fromlen, resplen, seconds, n, s;
+ int on = 1;
+ struct msghdr mhdr;
+ struct iovec iov;
+ u_char cmsgbuf[CMSG_SPACE(sizeof(int))];
+ struct cmsghdr *cmsg;
+ int ttl;
+ struct ifconf ifconf;
+ struct ifreq ifreq[64];
+ int ifreqn;
+ int i, j;
+ int ifidx[32], ifidxn;
+ struct ip_mreqn mreqn;
+
+ s = socket(nsap->sin6_family == AF_INET ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
+ if (s < 0) {
+ *terrno = errno;
+ Perror(statp, stderr, "socket(dg)", errno);
+ return (-1);
+ }
+ ifconf.ifc_len = sizeof(ifreq);
+ ifconf.ifc_req = ifreq;
+ ifidxn = 0;
+ if (ioctl(s, SIOCGIFCONF, &ifconf) == 0) {
+ ifreqn = ifconf.ifc_len / sizeof(*ifreq);
+ for (i = 0 ; i < ifreqn; i++) {
+ if (ioctl(s, SIOCGIFFLAGS, ifreq + i))
+ continue;
+ if (!(ifreq[i].ifr_flags & IFF_MULTICAST))
+ continue;
+ if (ioctl(s, SIOCGIFINDEX, ifreq + i))
+ continue;
+ for (j = 0; j < ifidxn; j++)
+ if (ifidx[j] == ifreq[i].ifr_ifindex)
+ break;
+ if (j < ifidxn)
+ continue;
+ ifidx[ifidxn++] = ifreq[i].ifr_ifindex;
+ if (ifidxn == sizeof(ifidx)/sizeof(*ifidx))
+ break;
+ }
+ }
+ j = 0;
+ for (i = 0; i < (ifidxn ? ifidxn : 1); i++) {
+ if (i) {
+ s = socket(nsap->sin6_family == AF_INET ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
+ if (!s)
+ continue;
+ }
+ if (setsockopt(s, SOL_IP, IP_RECVTTL, &on, sizeof(on))) {
+ *terrno = errno;
+ Perror(statp, stderr, "IP_RECVTTL(dg)", errno);
+ close(s);
+ continue;
+ }
+ if (ifidxn) {
+ memset(&mreqn, 0, sizeof(mreqn));
+ mreqn.imr_ifindex = ifidx[i];
+ if (setsockopt(s, SOL_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn))) {
+ *terrno = errno;
+ Perror(statp, stderr, "IP_MULTICAST_IF", errno);
+ close(s);
+ continue;
+ }
+ }
+ if (sendto(s, (char*)buf, buflen, 0,
+ (struct sockaddr *)nsap, sizeof *nsap) != buflen) {
+ Aerror(statp, stderr, "sendto", errno, *(struct sockaddr_in *)nsap);
+ close(s);
+ continue;
+ }
+ pfd[j].fd = s;
+ pfd[j].events = POLLIN;
+ j++;
+ }
+ /*
+ * Wait for reply.
+ */
+ seconds = statp->retrans;
+ if (seconds <= 0)
+ seconds = 1;
+ evNowTime(&now);
+ evConsTime(&timeout, seconds, 0);
+ evAddTime(&finish, &now, &timeout);
+ wait:
+ if (j == 0) {
+ return (0);
+ }
+
+ /* Convert struct timespec in milliseconds. */
+ ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
+ n = __poll (pfd, j, ptimeout);
+ if (n == 0) {
+ Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
+ *gotsomewhere = 1;
+ for (i = 0; i < j; i++)
+ close(pfd[i].fd);
+ return (0);
+ }
+ if (n < 0) {
+ if (errno == EINTR) {
+ evNowTime(&now);
+ if (evCmpTime(finish, now) > 0) {
+ evSubTime(&timeout, &finish, &now);
+ goto wait;
+ }
+ }
+ Perror(statp, stderr, "select", errno);
+ for (i = 0; i < j; i++)
+ close(pfd[i].fd);
+ res_nclose(statp);
+ return (0);
+ }
+ for (i = 0; i < j - 1; i++)
+ if (pfd[j].revents == POLLIN)
+ break;
+ s = pfd[i].fd;
+ __set_errno (0);
+ fromlen = sizeof(struct sockaddr_in6);
+ if (anssiz < MAXPACKET
+ && anscp
+ && (ioctl (s, FIONREAD, &resplen) < 0
+ || anssiz < resplen)) {
+ ans = malloc (MAXPACKET);
+ if (ans == NULL)
+ ans = *ansp;
+ else {
+ anssiz = MAXPACKET;
+ *anssizp = MAXPACKET;
+ *ansp = ans;
+ *anscp = ans;
+ anhp = (HEADER *) ans;
+ }
+ }
+ iov.iov_base = ans;
+ iov.iov_len = anssiz;
+ mhdr.msg_name = 0;
+ mhdr.msg_namelen = 0;
+ mhdr.msg_iov = &iov;
+ mhdr.msg_iovlen = 1;
+ mhdr.msg_control = cmsgbuf;
+ mhdr.msg_controllen = sizeof(cmsgbuf);
+ mhdr.msg_flags = 0;
+ resplen = recvmsg(s, &mhdr, 0);
+ if (resplen <= 0) {
+ if (errno == EAGAIN)
+ goto wait;
+ Perror(statp, stderr, "recvfrom", errno);
+wait2:
+ close(s);
+ if (i < j)
+ memmove(pfd + i, pfd + i + 1, sizeof(*pfd) * (j - i));
+ j--;
+ goto wait;
+ }
+ cmsg = CMSG_FIRSTHDR(&mhdr);
+ for (cmsg = CMSG_FIRSTHDR(&mhdr); cmsg; CMSG_NXTHDR(&mhdr, cmsg))
+ if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_TTL)
+ break;
+ if (!cmsg) {
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; no TTL found\n"));
+ goto wait2;
+ }
+ ttl = *(int *)CMSG_DATA(cmsg);
+ if (ttl != 255) {
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; answer with bad TTL: %d \n", ttl));
+ goto wait;
+ }
+ *gotsomewhere = 1;
+ if (resplen < HFIXEDSZ) {
+ /*
+ * Undersized message.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; undersized: %d\n",
+ resplen));
+ *terrno = EMSGSIZE;
+ goto wait;
+ }
+ if (hp->id != anhp->id) {
+ /*
+ * response from old query, ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; old answer:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ if (!(statp->options & RES_INSECURE2) &&
+ !res_queriesmatch(buf, buf + buflen,
+ ans, ans + anssiz)) {
+ /*
+ * response contains wrong query? ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; wrong query name:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ if (anhp->rcode == SERVFAIL ||
+ anhp->rcode == NOTIMP ||
+ anhp->rcode == REFUSED) {
+ DprintQ(statp->options & RES_DEBUG,
+ (stdout, "server rejected query:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ for (i = 0; i < j; i++)
+ close(pfd[i].fd);
+#if 0
+ if (!(statp->options & RES_IGNTC) && anhp->tc) {
+ /*
+ * To get the rest of answer,
+ * use TCP with same server.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; truncated answer\n"));
+ *v_circuit = 1;
+ res_nclose(statp);
+ return (1);
+ }
+#endif
+ /*
+ * All is well, or the error is fatal. Signal that the
+ * next nameserver ought not be tried.
+ */
+ return (resplen);
+}
+
#ifdef DEBUG
static void
Aerror(const res_state statp, FILE *file, const char *string, int error,

View File

@@ -0,0 +1,81 @@
#
# Submitted:
#
# Robert Schwebel, 2004-01-31 (patch by RSC & Dan Kegel)
#
# Error:
#
# arm-unknown-linux-gnu-gcc ../sysdeps/unix/sysv/linux/arm/ioperm.c -c
# -std=gnu99 -O -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g0
# -O99 -fomit-frame-pointer -D__USE_STRING_INLINES -I../include -I.
# -I/ptx/work/cvs-rsc/ptxdist/build/glibc-2.3.2-build/mis c -I.. -I../libio
# -I/ptx/work/cvs-rsc/ptxdist/build/glibc-2.3.2-build -I../sysdeps/arm/elf
# -I../linuxthreads/sysdeps/unix/sysv/linu x/arm
# -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread
# -I../sysdeps/pthread -I../linuxthreads/sysdeps/uni x/sysv
# -I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/arm
# -I../sysdeps/unix/sysv/linux/arm -I../sysdeps/unix/sysv/linux
# -I ../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman
# -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/arm
# -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/arm -I../sysdeps/wordsize-32
# -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-6 4 -I../sysdeps/ieee754 -I../sysdeps/generic/elf
# -I../sysdeps/generic -nostdinc -isystem
# /opt/ptxdist/arm-linux-3.3.2/lib/gcc-lib/arm-unknown-linux-gnu/3.3.2/include -isystem
# /opt/ptxdist/arm-linux-3.3.2/arm-unknown-linux-gnu/include -D_LIBC_REENTRANT -include
# ../include/libc-symbols.h -o /ptx/work/cvs-rsc/ptxdist/build/glibc-2.3.2-build/misc/ioperm.o
# ../sysdeps/unix/sysv/linux/arm/ioperm.c: In function `init_iosys':
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:103: error: `BUS_ISA' undeclared (first use in this function)
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:103: error: (Each undeclared identifier is reported only once
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:103: error: for each function it appears in.)
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:103: error: initializer element is not constant
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:103: error: (near initialization for `iobase_name[1]')
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:104: error: initializer element is not constant
# ../sysdeps/unix/sysv/linux/arm/ioperm.c:104: error: (near initialization for `ioshift_name[1]')
# make[3]: *** [/ptx/work/cvs-rsc/ptxdist/build/glibc-2.3.2-build/misc/ioperm.o] Error 1
#
#
# Description:
#
# Kernel headers have changed to avoid confusion with BUS_ISA in input.h.
#
# State:
#
# Kernels > 2.4.24 and > 2.6 have a CTL_BUS_ISA definition. Older kernels should not be used anyway :-)
#
diff -urN glibc-2.3.2/sysdeps/unix/sysv/linux/arm/ioperm.c glibc-2.3.2-ptx/sysdeps/unix/sysv/linux/arm/ioperm.c
--- glibc-2.3.2/sysdeps/unix/sysv/linux/arm/ioperm.c 2004-02-02 07:37:24.000000000 +0100
+++ glibc-2.3.2-ptx/sysdeps/unix/sysv/linux/arm/ioperm.c 2004-02-02 08:15:06.000000000 +0100
@@ -47,6 +47,12 @@
#include <asm/page.h>
#include <sys/sysctl.h>
+/* see http://www.ussg.iu.edu/hypermail/linux/kernel/0311.0/0529.html */
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23))
+#define CTL_BUS_ISA BUS_ISA /* and hope it's not the one from linux/input.h */
+#endif
+
#define PATH_ARM_SYSTYPE "/etc/arm_systype"
#define PATH_CPUINFO "/proc/cpuinfo"
@@ -80,7 +86,7 @@
* Initialize I/O system. There are several ways to get the information
* we need. Each is tried in turn until one succeeds.
*
- * 1. Sysctl (CTL_BUS, BUS_ISA, ISA_*). This is the preferred method
+ * 1. Sysctl (CTL_BUS, CTL_BUS_ISA, ISA_*). This is the preferred method
* but not all kernels support it.
*
* 2. Read the value (not the contents) of symlink PATH_ARM_SYSTYPE.
@@ -100,8 +106,8 @@
{
char systype[256];
int i, n;
- static int iobase_name[] = { CTL_BUS, BUS_ISA, BUS_ISA_PORT_BASE };
- static int ioshift_name[] = { CTL_BUS, BUS_ISA, BUS_ISA_PORT_SHIFT };
+ static int iobase_name[] = { CTL_BUS, CTL_BUS_ISA, BUS_ISA_PORT_BASE };
+ static int ioshift_name[] = { CTL_BUS, CTL_BUS_ISA, BUS_ISA_PORT_SHIFT };
size_t len = sizeof(io.base);
if (! sysctl (iobase_name, 3, &io.io_base, &len, NULL, 0)

View File

@@ -0,0 +1,50 @@
diff -Nru glibc-2.3.3.old/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.3.3/sysdeps/unix/sysv/linux/dl-execstack.c
--- glibc-2.3.3.old/sysdeps/unix/sysv/linux/dl-execstack.c 2004-09-24 01:40:02.663710000 -0400
+++ glibc-2.3.3/sysdeps/unix/sysv/linux/dl-execstack.c 2004-09-24 01:54:55.883919888 -0400
@@ -56,11 +56,17 @@
__stack_prot) == 0, 1))
goto return_success;
# if __ASSUME_PROT_GROWSUPDOWN == 0
- if (errno == EINVAL)
+ if (errno == EINVAL) {
no_growsupdown = true;
- else
+ } else {
+# endif
+ if (errno == EACCES) /* PAX is enabled */
+ return 0;
+ else
+ return errno;
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+ }
# endif
- return errno;
}
#endif
@@ -84,8 +90,11 @@
page -= size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GLRO(dl_pagesize))
/* We just tried to mprotect the top hole page and failed.
@@ -107,8 +116,11 @@
page += size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GLRO(dl_pagesize))
/* We just tried to mprotect the lowest hole page and failed.

View File

@@ -0,0 +1,11 @@
--- include/features.h.orig 2004-11-04 15:42:23.777521424 -0500
+++ include/features.h 2004-11-04 15:43:16.734470744 -0500
@@ -262,7 +262,7 @@
# define __USE_REENTRANT 1
#endif
-#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
+#if (_FORTIFY_SOURCE > 0) && defined(__OPTIMIZE__) \
&& (__GNUC_PREREQ (4, 1) \
|| (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0)) \
|| (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (3, 4) \

View File

@@ -0,0 +1,57 @@
--- glibc-2.3.3.old/elf/rtld.c 2004-10-26 21:41:41.989117872 -0400
+++ glibc-2.3.3/elf/rtld.c 2004-10-26 21:45:15.015732904 -0400
@@ -1087,53 +1087,6 @@
++GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
++GL(dl_load_adds);
-#if defined(__i386__)
- /* Force non-TLS libraries for glibc 2.0 binaries
- or if a buggy binary references non-TLS errno or h_errno. */
- if (__builtin_expect (main_map->l_info[DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGIDX (DT_VERNEED)]
- == NULL, 0)
- && main_map->l_info[DT_DEBUG])
- GLRO(dl_osversion) = 0x20205;
- else if ((__builtin_expect (mode, normal) != normal
- || main_map->l_info[ADDRIDX (DT_GNU_LIBLIST)] == NULL)
- /* Only binaries have DT_DEBUG dynamic tags... */
- && main_map->l_info[DT_DEBUG])
- {
- /* Workaround for buggy binaries. This doesn't handle buggy
- libraries. */
- bool buggy = false;
- const ElfW(Sym) *symtab = (const void *) D_PTR (main_map,
- l_info[DT_SYMTAB]);
- const char *strtab = (const void *) D_PTR (main_map,
- l_info[DT_STRTAB]);
- Elf_Symndx symidx;
- for (symidx = main_map->l_buckets[0x6c994f % main_map->l_nbuckets];
- symidx != STN_UNDEF;
- symidx = main_map->l_chain[symidx])
- {
- if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
- "errno") == 0, 0)
- && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
- buggy = true;
- }
- for (symidx = main_map->l_buckets[0xe5c992f % main_map->l_nbuckets];
- symidx != STN_UNDEF;
- symidx = main_map->l_chain[symidx])
- {
- if (__builtin_expect (strcmp (strtab + symtab[symidx].st_name,
- "h_errno") == 0, 0)
- && ELFW(ST_TYPE) (symtab[symidx].st_info) != STT_TLS)
- buggy = true;
- }
- if (__builtin_expect (buggy, false) && GLRO(dl_osversion) > 0x20401)
- {
- GLRO(dl_osversion) = 0x20401;
- _dl_error_printf ("Incorrectly built binary which accesses errno or h_errno directly. Needs to be fixed.\n");
- }
- }
-#endif
-
/* If LD_USE_LOAD_BIAS env variable has not been seen, default
to not using bias for non-prelinked PIEs and libraries
and using it for executables or prelinked PIEs or libraries. */

View File

@@ -0,0 +1,70 @@
--- glibc-2.3.3.old/elf/rtld.c 2004-10-26 21:41:41.989117872 -0400
+++ glibc-2.3.3/elf/rtld.c 2004-10-26 21:45:15.015732904 -0400
@@ -1306,67 +1259,6 @@
}
}
-
-#if defined(__i386__) || defined(__alpha__) || (defined(__sparc__) && !defined(__arch64__))
- /*
- * Modifications by Red Hat Software
- *
- * Deal with the broken binaries from the non-versioned ages of glibc.
- * If a binary does not have version information enabled, we assume that
- * it is a glibc 2.0 binary and we load a compatibility library to try to
- * overcome binary incompatibilities.
- * Blame: gafton@redhat.com
- */
-#define LIB_NOVERSION "/lib/libNoVersion.so.1"
-
- if (__builtin_expect (main_map->l_info[DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGIDX (DT_VERNEED)]
- == NULL, 0)
- && (main_map->l_info[DT_DEBUG]
- || !(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)))
- {
- struct stat test_st;
- int test_fd;
- int can_load;
-
- HP_TIMING_NOW (start);
-
-/* _dl_sysdep_message("Loading compatibility library... ", NULL); */
-
- can_load = 1;
- test_fd = __open (LIB_NOVERSION, O_RDONLY);
- if (test_fd < 0) {
- can_load = 0;
-/* _dl_sysdep_message(" Can't find " LIB_NOVERSION "\n", NULL); */
- } else {
- if (__fxstat (_STAT_VER, test_fd, &test_st) < 0 || test_st.st_size == 0) {
- can_load = 0;
-/* _dl_sysdep_message(" Can't stat " LIB_NOVERSION "\n", NULL); */
- }
- }
-
- if (test_fd >= 0) /* open did no fail.. */
- __close(test_fd); /* avoid fd leaks */
-
- if (can_load != 0) {
- struct link_map *new_map;
- new_map = _dl_map_object (main_map, LIB_NOVERSION,
- 1, lt_library, 0, 0, LM_ID_BASE);
- if (++new_map->l_opencount == 1) {
- /* It is no duplicate. */
- ++npreloads;
-/* _dl_sysdep_message(" DONE\n", NULL); */
- } else {
-/* _dl_sysdep_message(" FAILED\n", NULL); */
- }
- }
-
- HP_TIMING_NOW (stop);
- HP_TIMING_DIFF (diff, start, stop);
- HP_TIMING_ACCUM_NT (load_time, diff);
- }
-#endif
-
if (__builtin_expect (npreloads, 0) != 0)
{
/* Set up PRELOADS with a vector of the preloaded libraries. */

View File

@@ -0,0 +1,11 @@
--- malloc/malloc.c.fedora 2004-11-04 16:45:51.365618552 -0500
+++ malloc/malloc.c 2004-11-04 16:46:43.132748752 -0500
@@ -2355,7 +2355,7 @@
/* ---------------- Error behavior ------------------------------------ */
#ifndef DEFAULT_CHECK_ACTION
-#define DEFAULT_CHECK_ACTION 3
+#define DEFAULT_CHECK_ACTION 0
#endif
static int check_action = DEFAULT_CHECK_ACTION;

View File

@@ -0,0 +1,268 @@
Gentoo bug #52374.
==================
Note, this patch includes both:
-----
2005-01-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Fix assertion and
recognition of last entry.
-----
and:
-----
2005-03-15 Jakub Jelinek <jakub@redhat.com>
[BZ#786]
* sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Handle
GL(dl_tls_static_nelem) == GL(dl_tls_max_dtv_idx).
* elf/Makefile: Add rules to build and run tst-tls15.
* elf/tst-tls15.c: New test.
* elf/tst-tlsmod15a.c: New file.
* elf/tst-tlsmod15b.c: New file.
-----
================================================================================
On Sun, Mar 13, 2005 at 09:39:04PM +0200, Martin Schlemmer wrote:
> Basically the issue above. This is valid for glibc 2.3.[234] if I did
> not miss anything. Here is a good test case:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=219352#msg122
>
> I came up with attached patch that seems to work and passes all the
> tests (except for the one or two usual ones). Is this the correct fix,
> or are the problem deeper?
>
>--- glibc-2.3.4/sysdeps/generic/dl-tls.c.az 2005-03-13 19:26:55.000000000 +0200
>+++ glibc-2.3.4/sysdeps/generic/dl-tls.c 2005-03-13 19:29:14.000000000 +0200
>@@ -69,7 +69,10 @@
> result = GL(dl_tls_static_nelem) + 1;
> /* If the following would not be true we mustn't have assumed
> there is a gap. */
>- assert (result <= GL(dl_tls_max_dtv_idx));
>+ /* The +1 is needed, as we add +1 above, but dl_tls_static_nelem
>+ is only once set as far as I can see in dl_main (elf/rtld.c),
>+ and that is equal to dl_tls_max_dtv_idx ... */
>+ assert (result <= (GL(dl_tls_max_dtv_idx) + 1));
> do
> {
> while (result - disp < runp->len)
>@@ -92,7 +95,8 @@
> {
> /* The new index must indeed be exactly one higher than the
> previous high. */
>- assert (result == GL(dl_tls_max_dtv_idx));
>+ /* Once again +1 for the same reasons as above ... */
>+ assert (result == (GL(dl_tls_max_dtv_idx) + 1));
>
> /* There is no gap anymore. */
> GL(dl_tls_dtv_gaps) = false;
>
That patch certainly doesn't apply to neither HEAD nor glibc-2_3-branch,
see especially:
2005-01-10 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Fix assertion and
recognition of last entry.
The fix can either be that dl-open.c only sets GL(dl_tls_dtv_gaps)
to true if GL(dl_tls_static_nelem) < GL(dl_tls_max_dtv_idx)
(if it is equal, there are certainly no gaps), or handling that case
in _dl_next_tls_modid. In _dl_next_tls_modid, the choices are either
to do what the patch below does, i.e. just clear GL(dl_tls_dtv_gaps)
if that happens, or just change the assert and let the do ... while
loop run, it shouldn't increment result anyway.
2005-03-15 Jakub Jelinek <jakub@redhat.com>
[BZ#786]
* sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Handle
GL(dl_tls_static_nelem) == GL(dl_tls_max_dtv_idx).
* elf/Makefile: Add rules to build and run tst-tls15.
* elf/tst-tls15.c: New test.
* elf/tst-tlsmod15a.c: New file.
* elf/tst-tlsmod15b.c: New file.
diff -urpN glibc-2.3.4.az/elf/Makefile glibc-2.3.4/elf/Makefile
--- glibc-2.3.4.az/elf/Makefile 2005-03-15 17:38:36.000000000 +0200
+++ glibc-2.3.4/elf/Makefile 2005-03-15 17:39:07.000000000 +0200
@@ -152,7 +152,7 @@ tests += loadtest restest1 preloadtest l
neededtest3 neededtest4 unload2 lateglobal initfirst global \
restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
- tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
+ tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 tst-align \
$(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3
# reldep9
@@ -182,6 +182,7 @@ modules-names = testobj1 testobj2 testob
tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
+ tst-tlsmod15a tst-tlsmod15b \
circlemod1 circlemod1a circlemod2 circlemod2a \
circlemod3 circlemod3a \
reldep8mod1 reldep8mod2 reldep8mod3 \
@@ -454,6 +455,7 @@ tst-tlsmod10.so-no-z-defs = yes
tst-tlsmod12.so-no-z-defs = yes
tst-tlsmod14a.so-no-z-defs = yes
tst-tlsmod14b.so-no-z-defs = yes
+tst-tlsmod15a.so-no-z-defs = yes
circlemod2.so-no-z-defs = yes
circlemod3.so-no-z-defs = yes
circlemod3a.so-no-z-defs = yes
@@ -664,8 +666,11 @@ $(objpfx)tst-tls12: $(objpfx)tst-tlsmod1
$(objpfx)tst-tls13: $(libdl)
$(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
-$(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
-$(objpfx)tst-tls14.out:$(objpfx)tst-tlsmod14b.so
+$(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
+$(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
+
+$(objpfx)tst-tls15: $(libdl)
+$(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
CFLAGS-tst-align.c = $(stack-align-test-flags)
CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
diff -urpN glibc-2.3.4.az/elf/tst-tls15.c glibc-2.3.4/elf/tst-tls15.c
--- glibc-2.3.4.az/elf/tst-tls15.c 1970-01-01 02:00:00.000000000 +0200
+++ glibc-2.3.4/elf/tst-tls15.c 2005-03-15 17:39:07.000000000 +0200
@@ -0,0 +1,32 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ void *h = dlopen ("tst-tlsmod15a.so", RTLD_NOW);
+ if (h != NULL)
+ {
+ puts ("unexpectedly succeeded to open tst-tlsmod15a.so");
+ exit (1);
+ }
+
+ h = dlopen ("tst-tlsmod15b.so", RTLD_NOW);
+ if (h == NULL)
+ {
+ puts ("failed to open tst-tlsmod15b.so");
+ exit (1);
+ }
+
+ int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso");
+ if (fp == NULL)
+ {
+ puts ("cannot find in_dso");
+ exit (1);
+ }
+
+ return fp ();
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff -urpN glibc-2.3.4.az/elf/tst-tlsmod15a.c glibc-2.3.4/elf/tst-tlsmod15a.c
--- glibc-2.3.4.az/elf/tst-tlsmod15a.c 1970-01-01 02:00:00.000000000 +0200
+++ glibc-2.3.4/elf/tst-tlsmod15a.c 2005-03-15 17:39:07.000000000 +0200
@@ -0,0 +1,6 @@
+extern int nonexistent_dummy_var;
+int *
+foo (void)
+{
+ return &nonexistent_dummy_var;
+}
diff -urpN glibc-2.3.4.az/elf/tst-tlsmod15b.c glibc-2.3.4/elf/tst-tlsmod15b.c
--- glibc-2.3.4.az/elf/tst-tlsmod15b.c 1970-01-01 02:00:00.000000000 +0200
+++ glibc-2.3.4/elf/tst-tlsmod15b.c 2005-03-15 17:39:07.000000000 +0200
@@ -0,0 +1,17 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread int mod15b_var __attribute__((tls_model("initial-exec")));
+
+int
+in_dso (void)
+{
+ return mod15b_var;
+}
+#else
+int
+in_dso (void)
+{
+ return 0;
+}
+#endif
diff -urpN glibc-2.3.4.az/sysdeps/generic/dl-tls.c glibc-2.3.4/sysdeps/generic/dl-tls.c
--- glibc-2.3.4.az/sysdeps/generic/dl-tls.c 2005-03-15 17:40:56.000000000 +0200
+++ glibc-2.3.4/sysdeps/generic/dl-tls.c 2005-03-15 17:39:07.000000000 +0200
@@ -65,34 +65,35 @@ _dl_next_tls_modid (void)
/* Note that this branch will never be executed during program
start since there are no gaps at that time. Therefore it
does not matter that the dl_tls_dtv_slotinfo is not allocated
- yet when the function is called for the first times. */
- result = GL(dl_tls_static_nelem) + 1;
- /* If the following would not be true we mustn't have assumed
- there is a gap. */
- assert (result <= GL(dl_tls_max_dtv_idx));
- do
- {
- while (result - disp < runp->len)
- {
- if (runp->slotinfo[result - disp].map == NULL)
- break;
-
- ++result;
- assert (result <= GL(dl_tls_max_dtv_idx) + 1);
- }
+ yet when the function is called for the first times.
- if (result - disp < runp->len)
- break;
-
- disp += runp->len;
- }
- while ((runp = runp->next) != NULL);
+ NB: the offset +1 is due to the fact that DTV[0] is used
+ for something else. */
+ result = GL(dl_tls_static_nelem) + 1;
+ if (result <= GL(dl_tls_max_dtv_idx))
+ do
+ {
+ while (result - disp < runp->len)
+ {
+ if (runp->slotinfo[result - disp].map == NULL)
+ break;
+
+ ++result;
+ assert (result <= GL(dl_tls_max_dtv_idx) + 1);
+ }
+
+ if (result - disp < runp->len)
+ break;
+
+ disp += runp->len;
+ }
+ while ((runp = runp->next) != NULL);
- if (result >= GL(dl_tls_max_dtv_idx))
+ if (result > GL(dl_tls_max_dtv_idx))
{
/* The new index must indeed be exactly one higher than the
previous high. */
- assert (result == GL(dl_tls_max_dtv_idx));
+ assert (result == GL(dl_tls_max_dtv_idx) + 1);
/* There is no gap anymore. */
GL(dl_tls_dtv_gaps) = false;
@@ -577,7 +578,7 @@ __tls_get_addr (GET_ADDR_ARGS)
{
size_t cnt;
- for (cnt = total = 0 ? 1 : 0; cnt < listp->len; ++cnt)
+ for (cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt)
{
size_t gen = listp->slotinfo[cnt].gen;
struct link_map *map;

View File

@@ -0,0 +1,358 @@
2004-09-02 Steven Munroe <sjmunroe@us.ibm.com>
[BZ #357]
* stdlib/tst-setcontext.c (test_stack): Added test for stack clobber.
(main): Call test_stack.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
(__getcontext): Push stack frame then save parms in local frame.
Improve instruction scheduling.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
(__swapcontext): Push stack frame then save parms in local frame.
Improve instruction scheduling.
diff -urN libc23-cvstip-20040830/stdlib/tst-setcontext.c libc23/stdlib/tst-setcontext.c
--- libc23-cvstip-20040830/stdlib/tst-setcontext.c 2002-08-30 22:21:40.000000000 -0500
+++ libc23/stdlib/tst-setcontext.c 2004-09-02 10:10:28.055274880 -0500
@@ -72,6 +72,55 @@
was_in_f2 = 1;
}
+void
+test_stack(volatile int a, volatile int b,
+ volatile int c, volatile int d)
+{
+ volatile int e = 5;
+ volatile int f = 6;
+ ucontext_t uc;
+
+ /* Test for cases where getcontext is clobbering the callers
+ stack, including parameters. */
+ getcontext(&uc);
+
+ if (a != 1)
+ {
+ printf ("%s: getcontext clobbers parm a\n", __FUNCTION__);
+ exit (1);
+ }
+
+ if (b != 2)
+ {
+ printf ("%s: getcontext clobbers parm b\n", __FUNCTION__);
+ exit (1);
+ }
+
+ if (c != 3)
+ {
+ printf ("%s: getcontext clobbers parm c\n", __FUNCTION__);
+ exit (1);
+ }
+
+ if (d != 4)
+ {
+ printf ("%s: getcontext clobbers parm d\n", __FUNCTION__);
+ exit (1);
+ }
+
+ if (e != 5)
+ {
+ printf ("%s: getcontext clobbers varible e\n", __FUNCTION__);
+ exit (1);
+ }
+
+ if (f != 6)
+ {
+ printf ("%s: getcontext clobbers variable f\n", __FUNCTION__);
+ exit (1);
+ }
+}
+
volatile int global;
int
@@ -88,6 +137,8 @@
printf ("%s: getcontext: %m\n", __FUNCTION__);
exit (1);
}
+
+ test_stack (1, 2, 3, 4);
/* Play some tricks with this context. */
if (++global == 1)
diff -urN libc23-cvstip-20040830/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
--- libc23-cvstip-20040830/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2004-06-15 15:02:20.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2004-09-02 12:46:16.064221704 -0500
@@ -27,18 +27,22 @@
.machine "altivec"
ENTRY(__getcontext)
+ stwu r1,-16(r1)
+/* Insure that the _UC_REGS start on a quadword boundary. */
stw r3,_FRAME_PARM_SAVE1(r1)
addi r3,r3,_UC_REG_SPACE+12
clrrwi r3,r3,4
+
+/* Save the general purpose registers */
stw r0,_UC_GREGS+(PT_R0*4)(r3)
mflr r0
- stw r1,_UC_GREGS+(PT_R1*4)(r3)
- stwu r1,-16(r1)
+ stw r2,_UC_GREGS+(PT_R2*4)(r3)
+ stw r4,_UC_GREGS+(PT_R4*4)(r3)
+/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
+ return address. */
stw r0,_UC_GREGS+(PT_LNK*4)(r3)
stw r0,_UC_GREGS+(PT_NIP*4)(r3)
stw r0,_FRAME_LR_SAVE+16(r1)
- stw r2,_UC_GREGS+(PT_R2*4)(r3)
- stw r4,_UC_GREGS+(PT_R4*4)(r3)
stw r5,_UC_GREGS+(PT_R5*4)(r3)
stw r6,_UC_GREGS+(PT_R6*4)(r3)
stw r7,_UC_GREGS+(PT_R7*4)(r3)
@@ -66,23 +70,28 @@
stw r29,_UC_GREGS+(PT_R29*4)(r3)
stw r30,_UC_GREGS+(PT_R30*4)(r3)
stw r31,_UC_GREGS+(PT_R31*4)(r3)
- mfctr r0
- stw r0,_UC_GREGS+(PT_CTR*4)(r3)
- mfxer r0
- stw r0,_UC_GREGS+(PT_XER*4)(r3)
- mfcr r0
- stw r0,_UC_GREGS+(PT_CCR*4)(r3)
-
- /* Set the return value of getcontext to "success". R3 is the only
- register whose value is not preserved in the saved context. */
+/* Save the value of R1. We had to push the stack before we
+ had the address of uc_reg_space. So compute the address of
+ the callers stack pointer and save it as R1. */
+ addi r8,r1,16
li r0,0
+/* Save the count, exception and condition registers. */
+ mfctr r11
+ mfxer r10
+ mfcr r9
+ stw r8,_UC_GREGS+(PT_R1*4)(r3)
+ stw r11,_UC_GREGS+(PT_CTR*4)(r3)
+ stw r10,_UC_GREGS+(PT_XER*4)(r3)
+ stw r9,_UC_GREGS+(PT_CCR*4)(r3)
+/* Set the return value of getcontext to "success". R3 is the only
+ register whose value is not preserved in the saved context. */
stw r0,_UC_GREGS+(PT_R3*4)(r3)
- /* Zero fill fields that can't be set in user state. */
+/* Zero fill fields that can't be set in user state. */
stw r0,_UC_GREGS+(PT_MSR*4)(r3)
stw r0,_UC_GREGS+(PT_MQ*4)(r3)
- /* Save the floating-point registers */
+/* Save the floating-point registers */
stfd fp0,_UC_FREGS+(0*8)(r3)
stfd fp1,_UC_FREGS+(1*8)(r3)
stfd fp2,_UC_FREGS+(2*8)(r3)
@@ -136,21 +145,31 @@
lwz r7,_dl_hwcap@l(r7)
#endif
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
- beq L(no_vec)
la r10,(_UC_VREGS)(r3)
la r9,(_UC_VREGS+16)(r3)
+
+ beq L(no_vec)
+/* address of the combined VSCR/VSAVE quadword. */
+ la r8,(_UC_VREGS+512)(r3)
+/* Save the vector registers */
stvx v0,0,r10
stvx v1,0,r9
addi r10,r10,32
addi r9,r9,32
+/* We need to get the Vector Status and Control Register early to avoid
+ store order problems later with the VSAVE register that shares the
+ same quadword. */
+ mfvscr v0
stvx v2,0,r10
stvx v3,0,r9
addi r10,r10,32
addi r9,r9,32
+ stvx v0,0,r8
+
stvx v4,0,r10
stvx v5,0,r9
addi r10,r10,32
@@ -216,20 +235,18 @@
addi r10,r10,32
addi r9,r9,32
+ mfspr r0,VRSAVE
stvx v30,0,r10
stvx v31,0,r9
- addi r10,r10,32
- addi r9,r9,32
- mfvscr v0
- mfspr r0,VRSAVE
- stvx v0,0,r10
- sync
- stw r0,0(r10)
+ stw r0,0(r8)
L(no_vec):
-/* Restore ucontext (parm1) from stack. */
- lwz r12,_FRAME_PARM_SAVE1+16(r1)
+/* We need to set up parms and call sigprocmask which will clobber
+ volatile registers. So before the call we need to retrieve the
+ original ucontext ptr (parm1) from stack and store the UC_REGS_PTR
+ (current R3). */
+ lwz r12,_FRAME_PARM_SAVE1(r1)
li r4,0
stw r3,_UC_REGS_PTR(r12)
addi r5,r12,_UC_SIGMASK
diff -urN libc23-cvstip-20040830/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
--- libc23-cvstip-20040830/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2004-06-15 15:02:20.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2004-09-02 12:45:43.125302872 -0500
@@ -27,22 +27,23 @@
.machine "altivec"
ENTRY(__swapcontext)
- /* Save the current context */
+ stwu r1,-16(r1)
+/* Insure that the _UC_REGS start on a quadword boundary. */
stw r3,_FRAME_PARM_SAVE1(r1)
addi r3,r3,_UC_REG_SPACE+12
+ stw r4,_FRAME_PARM_SAVE2(r1) /* new context pointer */
clrrwi r3,r3,4
+
+/* Save the general purpose registers */
stw r0,_UC_GREGS+(PT_R0*4)(r3)
- stw r1,_UC_GREGS+(PT_R1*4)(r3)
mflr r0
- stwu r1,-16(r1)
- stw r0,20(r1)
- stw r31,12(r1)
- stw r31,_UC_GREGS+(PT_R31*4)(r3)
- mr r31,r4 /* new context pointer */
+ stw r2,_UC_GREGS+(PT_R2*4)(r3)
+ stw r4,_UC_GREGS+(PT_R4*4)(r3)
+/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
+ return address. */
stw r0,_UC_GREGS+(PT_LNK*4)(r3)
stw r0,_UC_GREGS+(PT_NIP*4)(r3)
- stw r2,_UC_GREGS+(PT_R2*4)(r3)
- stw r4,_UC_GREGS+(PT_R4*4)(r3)
+ stw r0,_FRAME_LR_SAVE+16(r1)
stw r5,_UC_GREGS+(PT_R5*4)(r3)
stw r6,_UC_GREGS+(PT_R6*4)(r3)
stw r7,_UC_GREGS+(PT_R7*4)(r3)
@@ -69,16 +70,23 @@
stw r28,_UC_GREGS+(PT_R28*4)(r3)
stw r29,_UC_GREGS+(PT_R29*4)(r3)
stw r30,_UC_GREGS+(PT_R30*4)(r3)
- mfctr r0
- stw r0,_UC_GREGS+(PT_CTR*4)(r3)
- mfxer r0
- stw r0,_UC_GREGS+(PT_XER*4)(r3)
- mfcr r0
- stw r0,_UC_GREGS+(PT_CCR*4)(r3)
-
- /* Set the return value of swapcontext to "success". R3 is the only
- register whose value is not preserved in the saved context. */
+ stw r31,_UC_GREGS+(PT_R31*4)(r3)
+
+/* Save the value of R1. We had to push the stack before we
+ had the address of uc_reg_space. So compute the address of
+ the callers stack pointer and save it as R1. */
+ addi r8,r1,16
li r0,0
+/* Save the count, exception and condition registers. */
+ mfctr r11
+ mfxer r10
+ mfcr r9
+ stw r8,_UC_GREGS+(PT_R1*4)(r3)
+ stw r11,_UC_GREGS+(PT_CTR*4)(r3)
+ stw r10,_UC_GREGS+(PT_XER*4)(r3)
+ stw r9,_UC_GREGS+(PT_CCR*4)(r3)
+/* Set the return value of getcontext to "success". R3 is the only
+ register whose value is not preserved in the saved context. */
stw r0,_UC_GREGS+(PT_R3*4)(r3)
/* Zero fill fields that can't be set in user state. */
@@ -138,20 +146,30 @@
lwz r7,_dl_hwcap@l(r7)
#endif
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
- beq L(no_vec)
la r10,(_UC_VREGS)(r3)
la r9,(_UC_VREGS+16)(r3)
+
+ beq L(no_vec)
+/* address of the combined VSCR/VSAVE quadword. */
+ la r8,(_UC_VREGS+512)(r3)
+/* Save the vector registers */
stvx v0,0,r10
stvx v1,0,r9
addi r10,r10,32
addi r9,r9,32
+/* We need to get the Vector Status and Control Register early to avoid
+ store order problems later with the VSAVE register that shares the
+ same quadword. */
+ mfvscr v0
stvx v2,0,r10
stvx v3,0,r9
addi r10,r10,32
addi r9,r9,32
+
+ stvx v0,0,r8
stvx v4,0,r10
stvx v5,0,r9
@@ -218,20 +236,15 @@
addi r10,r10,32
addi r9,r9,32
+ mfvscr v0
stvx v30,0,r10
stvx v31,0,r9
- addi r10,r10,32
- addi r9,r9,32
- mfvscr v0
- mfspr r0,VRSAVE
- stvx v0,0,r10
- sync
- stw r0,0(r10)
+ stw r0,0(r8)
L(no_vec):
/* Restore ucontext (parm1) from stack. */
- lwz r12,_FRAME_PARM_SAVE1+16(r1)
+ lwz r12,_FRAME_PARM_SAVE1(r1)
li r4,0
stw r3,_UC_REGS_PTR(r12)
addi r5,r12,_UC_SIGMASK
@@ -251,8 +264,8 @@
* r0, xer, ctr. We don't restore r2 since it will be used as
* the TLS pointer.
*/
- mr r4,r31
- lwz r31,_UC_REGS_PTR(r31)
+ lwz r4,_FRAME_PARM_SAVE2(r1)
+ lwz r31,_UC_REGS_PTR(r4)
lwz r0,_UC_GREGS+(PT_MSR*4)(r31)
cmpwi r0,0
bne L(do_sigret)
@@ -451,8 +464,7 @@
bctr
L(error_exit):
- lwz r31,12(r1)
- lwz r0,20(r1)
+ lwz r0,_FRAME_LR_SAVE+16(r1)
addi r1,r1,16
mtlr r0
blr

View File

@@ -0,0 +1,11 @@
--- sysdeps/unix/sysv/linux/i386/sysdep.h.orig 2004-06-13 13:08:49.905902169 -0600
+++ sysdeps/unix/sysv/linux/i386/sysdep.h 2004-06-13 13:09:16.312954075 -0600
@@ -401,7 +401,7 @@
#define LOADARGS_0
#ifdef __PIC__
-# if defined I386_USE_SYSENTER
+# if defined I386_USE_SYSENTER && defined SHARED
# define LOADARGS_1 \
"bpushl .L__X'%k3, %k3\n\t"
# define LOADARGS_5 \

View File

@@ -0,0 +1,69 @@
diff -u -r -N glibc-2.3.4-hppa/csu/elf-init.c glibc-2.3.4-hppa-hardened/csu/elf-init.c
--- glibc-2.3.4-hppa/csu/elf-init.c 2004-07-22 12:13:09.207029032 +0200
+++ glibc-2.3.4-hppa-hardened/csu/elf-init.c 2004-07-22 13:24:02.652407048 +0200
@@ -19,15 +19,14 @@
#include <stddef.h>
-#ifdef HAVE_INITFINI_ARRAY
-/* These magic symbols are provided by the linker. */
-extern void (*__preinit_array_start []) (void) attribute_hidden;
-extern void (*__preinit_array_end []) (void) attribute_hidden;
-extern void (*__init_array_start []) (void) attribute_hidden;
-extern void (*__init_array_end []) (void) attribute_hidden;
-extern void (*__fini_array_start []) (void) attribute_hidden;
-extern void (*__fini_array_end []) (void) attribute_hidden;
-#endif
+/* there is no hppalinux.xd and hppalinux.xdc linker script available */
+/* this is why __init_array_start|__init_array_end cannot be resolved */
+/* if we are using hardened with auto PIE, we need to disable startup */
+/* code for such additional arrays normally found in a PROVIDE script */
+
+/* the hppalinux.xd and .xdc scripts can easily be converted from the */
+/* hppalinux.xc shared linker scripts, using diffs from sparc example */
+/* however, the ld does not even automatically use these scripts then */
/* These function symbols are provided for the .init/.fini section entry
points automagically by the linker. */
@@ -42,41 +41,11 @@
void
__libc_csu_init (void)
{
-#ifdef HAVE_INITFINI_ARRAY
- /* For dynamically linked executables the preinit array is executed by
- the dynamic linker (before initializing any shared object. */
-
-# ifndef LIBC_NONSHARED
- /* For static executables, preinit happens rights before init. */
- {
- const size_t size = __preinit_array_end - __preinit_array_start;
- size_t i;
- for (i = 0; i < size; i++)
- (*__preinit_array_start [i]) ();
- }
-# endif
-#endif
-
_init ();
-
-#ifdef HAVE_INITFINI_ARRAY
- {
- const size_t size = __init_array_end - __init_array_start;
- size_t i;
- for (i = 0; i < size; i++)
- (*__init_array_start [i]) ();
- }
-#endif
}
void
__libc_csu_fini (void)
{
-#ifdef HAVE_INITFINI_ARRAY
- size_t i = __fini_array_end - __fini_array_start;
- while (i-- > 0)
- (*__fini_array_start [i]) ();
-#endif
-
_fini ();
}

View File

@@ -0,0 +1,60 @@
diff -Nru glibc-2.3.3.old/sysdeps/unix/sysv/linux/dl-sysdep.c glibc-2.3.3/sysdeps/unix/sysv/linux/dl-sysdep.c
--- glibc-2.3.3.old/sysdeps/unix/sysv/linux/dl-sysdep.c 2004-08-16 10:47:10.361264216 -0400
+++ glibc-2.3.3/sysdeps/unix/sysv/linux/dl-sysdep.c 2004-08-16 10:47:55.068467688 -0400
@@ -1,5 +1,5 @@
/* Dynamic linker system dependencies for Linux.
- Copyright (C) 1995, 1997, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 2001, 2004 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
@@ -21,6 +21,8 @@
the generic dynamic linker system interface code. */
#include <unistd.h>
+#include <ldsodefs.h>
+#include "kernel-features.h"
#define DL_SYSDEP_INIT frob_brk ()
@@ -28,6 +30,27 @@
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 void *__curbrk attribute_hidden;
+ extern void _end attribute_hidden;
+ void *const endpage = (void *) 0 + (((__curbrk - (void *) 0)
+ + GLRO(dl_pagesize) - 1)
+ & -GLRO(dl_pagesize));
+ if (__builtin_expect (__curbrk >= &_end && __curbrk < endpage, 0))
+ __brk (endpage);
+#endif
}
#include <sysdeps/generic/dl-sysdep.c>
diff -Nru glibc-2.3.3.old/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.3.3/sysdeps/unix/sysv/linux/kernel-features.h
--- glibc-2.3.3.old/sysdeps/unix/sysv/linux/kernel-features.h 2004-08-16 10:47:09.458401472 -0400
+++ glibc-2.3.3/sysdeps/unix/sysv/linux/kernel-features.h 2004-08-16 10:48:02.345361432 -0400
@@ -400,3 +400,9 @@
#if __LINUX_KERNEL_VERSION >= 132612
# 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. */
+#if __LINUX_KERNEL_VERSION >= 132355
+# define __ASSUME_BRK_PAGE_ROUNDED 1
+#endif

View File

@@ -0,0 +1,463 @@
diff -Nru glibc-2.3.3/resolv/res_hconf.c libc-mdns/resolv/res_hconf.c
--- glibc-2.3.3/resolv/res_hconf.c 2004-11-04 15:14:48.265197552 -0500
+++ libc-mdns/resolv/res_hconf.c 2004-11-04 15:01:40.000000000 -0500
@@ -59,6 +59,7 @@
#define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS"
#define ENV_MULTI "RESOLV_MULTI"
#define ENV_REORDER "RESOLV_REORDER"
+#define ENV_MDNS "RESOLV_MDNS"
static const char *arg_service_list (const char *, int, const char *,
unsigned int);
@@ -81,7 +82,8 @@
{"multi", arg_bool, HCONF_FLAG_MULTI},
{"nospoof", arg_bool, HCONF_FLAG_SPOOF},
{"spoofalert", arg_bool, HCONF_FLAG_SPOOFALERT},
- {"reorder", arg_bool, HCONF_FLAG_REORDER}
+ {"reorder", arg_bool, HCONF_FLAG_REORDER},
+ {"mdns", arg_bool, HCONF_FLAG_MDNS}
};
/* Structure containing the state. */
@@ -431,6 +433,9 @@
memset (&_res_hconf, '\0', sizeof (_res_hconf));
+ /* Default for mdns is "on". */
+ _res_hconf.flags |= HCONF_FLAG_MDNS;
+
hconf_name = getenv (ENV_HOSTCONF);
if (hconf_name == NULL)
hconf_name = _PATH_HOSTCONF;
@@ -483,6 +488,10 @@
arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval, 0);
}
+ envval = getenv (ENV_MDNS);
+ if (envval)
+ arg_bool (ENV_MDNS, 1, envval, HCONF_FLAG_MDNS);
+
_res_hconf.initialized = 1;
}
diff -Nru glibc-2.3.3/resolv/res_hconf.h libc-mdns/resolv/res_hconf.h
--- glibc-2.3.3/resolv/res_hconf.h 2001-07-06 00:55:39.000000000 -0400
+++ libc-mdns/resolv/res_hconf.h 2004-11-04 15:01:40.000000000 -0500
@@ -44,6 +44,7 @@
# define HCONF_FLAG_SPOOFALERT (1 << 2) /* syslog warning of spoofed */
# define HCONF_FLAG_REORDER (1 << 3) /* list best address first */
# define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */
+# define HCONF_FLAG_MDNS (1 << 5) /* Disable MDNS support */
};
extern struct hconf _res_hconf;
diff -Nru glibc-2.3.3/resolv/res_query.c libc-mdns/resolv/res_query.c
--- glibc-2.3.3/resolv/res_query.c 2004-11-04 15:14:48.268197096 -0500
+++ libc-mdns/resolv/res_query.c 2004-11-04 15:01:40.000000000 -0500
@@ -82,6 +82,8 @@
#include <stdlib.h>
#include <string.h>
+#include "res_hconf.h"
+
/* Options. Leave them on. */
/* #undef DEBUG */
@@ -280,6 +282,13 @@
*domain && !done;
domain++) {
+ if ((_res_hconf.flags & HCONF_FLAG_MDNS) != 0) {
+ /* don't add "local" domain if query contains a dot */
+ if (dots && (!__strcasecmp(*domain, "local") ||
+ !__strcasecmp(*domain, "local.")))
+ continue;
+ }
+
if (domain[0][0] == '\0' ||
(domain[0][0] == '.' && domain[0][1] == '\0'))
root_on_list++;
diff -Nru glibc-2.3.3/resolv/res_send.c libc-mdns/resolv/res_send.c
--- glibc-2.3.3/resolv/res_send.c 2004-11-04 15:14:48.269196944 -0500
+++ libc-mdns/resolv/res_send.c 2004-11-04 15:06:31.000000000 -0500
@@ -85,6 +85,9 @@
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
+#if defined(_LIBC) && defined(linux)
+#include <net/if.h>
+#endif
#include <errno.h>
#include <fcntl.h>
@@ -96,6 +99,8 @@
#include <string.h>
#include <unistd.h>
+#include "res_hconf.h"
+
#if PACKETSZ > 65536
#define MAXPACKET PACKETSZ
#else
@@ -180,6 +185,9 @@
static int send_dg(res_state, const u_char *, int,
u_char **, int *, int *, int,
int *, int *, u_char **);
+static int send_dg_mdns(res_state, const u_char *, int,
+ u_char **, int *, int *, struct sockaddr_in6 *,
+ int *, int *, u_char **);
#ifdef DEBUG
static void Aerror(const res_state, FILE *, const char *, int,
const struct sockaddr *);
@@ -332,6 +340,35 @@
u_char *ans, int anssiz, u_char **ansp)
{
int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
+ int usemdns;
+ HEADER *qhp = (HEADER *) buf;
+
+ usemdns = 0;
+ if ((_res_hconf.flags & HCONF_FLAG_MDNS) != 0 &&
+ qhp->qr == 0 && qhp->opcode == QUERY && qhp->qdcount == htons(1)) {
+ /* got one simple query */
+ const u_char *bp, *be;
+ be = buf + buflen;
+ for (bp = buf + NS_HFIXEDSZ; bp < be; )
+ if ((*bp & NS_CMPRSFLGS) != 0)
+ break;
+ else if (*bp) {
+ if (*bp == 5 && !strncasecmp(bp, "\005local\000", 7)) {
+ usemdns = 1;
+ break;
+ }
+ if (*bp == 3 && !strncasecmp(bp, "\003254\003169\007in-addr\004arpa\000", 22)) {
+ usemdns = 1;
+ break;
+ }
+ if (*bp == 1 && !strncasecmp(bp, "\0010\0018\001e\001f\003ip6\004arpa\000", 18)) {
+ usemdns = 2;
+ break;
+ }
+ bp += *bp + 1;
+ } else
+ break;
+ }
if (statp->nscount == 0) {
__set_errno (ESRCH);
@@ -465,10 +502,27 @@
* Send request, RETRY times, or until successful.
*/
for (try = 0; try < statp->retry; try++) {
- for (ns = 0; ns < MAXNS; ns++)
+ for (ns = 0; ns < (usemdns ? 1 : MAXNS); ns++)
{
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+ if (usemdns == 1) {
+ static struct sockaddr_in mdns4;
+ mdns4.sin_family = AF_INET;
+ mdns4.sin_port = htons(5353);
+ mdns4.sin_addr.s_addr = htonl(0xe00000fb);
+ nsap = (struct sockaddr_in6 *)&mdns4;
+ }
+ if (usemdns == 2) {
+ static struct sockaddr_in6 mdns6;
+ mdns6.sin6_family = AF_INET6;
+ mdns6.sin6_port = htons(5353);
+ mdns6.sin6_addr.s6_addr32[0] = htonl(0xff020000);
+ mdns6.sin6_addr.s6_addr32[3] = htonl(0x000000fb);
+ nsap = &mdns6;
+ }
+
+
if (nsap == NULL)
goto next_ns;
same_ns:
@@ -525,8 +579,11 @@
resplen = n;
} else {
/* Use datagrams. */
- n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
- ns, &v_circuit, &gotsomewhere, ansp);
+ if (usemdns)
+ n = send_dg_mdns(statp, buf, buflen, &ans, &anssiz, &terrno, nsap, &v_circuit, &gotsomewhere, ansp);
+ else
+ n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
+ ns, &v_circuit, &gotsomewhere, ansp);
if (n < 0)
return (-1);
if (n == 0)
@@ -593,8 +650,15 @@
if (!v_circuit) {
if (!gotsomewhere)
__set_errno (ECONNREFUSED); /* no nameservers found */
- else
+ else if (!usemdns) {
__set_errno (ETIMEDOUT); /* no answer obtained */
+ } else {
+ /* treat timeout as host not found */
+ HEADER *anhp = (HEADER *) ans;
+ memset(ans, 0, HFIXEDSZ);
+ anhp->rcode = NXDOMAIN;
+ return HFIXEDSZ;
+ }
} else
__set_errno (terrno);
return (-1);
@@ -1035,6 +1099,255 @@
}
}
+static int
+send_dg_mdns(res_state statp,
+ const u_char *buf, int buflen, u_char **ansp, int *anssizp,
+ int *terrno, struct sockaddr_in6 *nsap, int *v_circuit, int *gotsomewhere, u_char **anscp)
+{
+ const HEADER *hp = (HEADER *) buf;
+ u_char *ans = *ansp;
+ int anssiz = *anssizp;
+ HEADER *anhp = (HEADER *) ans;
+ struct timespec now, timeout, finish;
+ struct pollfd pfd[32];
+ int ptimeout;
+ int fromlen, resplen, seconds, n, s;
+ int on = 1;
+ struct msghdr mhdr;
+ struct iovec iov;
+ u_char cmsgbuf[CMSG_SPACE(sizeof(int))];
+ struct cmsghdr *cmsg;
+ int ttl;
+ struct ifconf ifconf;
+ struct ifreq ifreq[64];
+ int ifreqn;
+ int i, j;
+ int ifidx[32], ifidxn;
+ struct ip_mreqn mreqn;
+
+ s = socket(nsap->sin6_family == AF_INET ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
+ if (s < 0) {
+ *terrno = errno;
+ Perror(statp, stderr, "socket(dg)", errno);
+ return (-1);
+ }
+ ifconf.ifc_len = sizeof(ifreq);
+ ifconf.ifc_req = ifreq;
+ ifidxn = 0;
+ if (ioctl(s, SIOCGIFCONF, &ifconf) == 0) {
+ ifreqn = ifconf.ifc_len / sizeof(*ifreq);
+ for (i = 0 ; i < ifreqn; i++) {
+ if (ioctl(s, SIOCGIFFLAGS, ifreq + i))
+ continue;
+ if (!(ifreq[i].ifr_flags & IFF_MULTICAST))
+ continue;
+ if (ioctl(s, SIOCGIFINDEX, ifreq + i))
+ continue;
+ for (j = 0; j < ifidxn; j++)
+ if (ifidx[j] == ifreq[i].ifr_ifindex)
+ break;
+ if (j < ifidxn)
+ continue;
+ ifidx[ifidxn++] = ifreq[i].ifr_ifindex;
+ if (ifidxn == sizeof(ifidx)/sizeof(*ifidx))
+ break;
+ }
+ }
+ j = 0;
+ for (i = 0; i < (ifidxn ? ifidxn : 1); i++) {
+ if (i) {
+ s = socket(nsap->sin6_family == AF_INET ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
+ if (!s)
+ continue;
+ }
+ if (setsockopt(s, SOL_IP, IP_RECVTTL, &on, sizeof(on))) {
+ *terrno = errno;
+ Perror(statp, stderr, "IP_RECVTTL(dg)", errno);
+ close(s);
+ continue;
+ }
+ if (ifidxn) {
+ memset(&mreqn, 0, sizeof(mreqn));
+ mreqn.imr_ifindex = ifidx[i];
+ if (setsockopt(s, SOL_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn))) {
+ *terrno = errno;
+ Perror(statp, stderr, "IP_MULTICAST_IF", errno);
+ close(s);
+ continue;
+ }
+ }
+ if (sendto(s, (char*)buf, buflen, 0,
+ (struct sockaddr *)nsap, sizeof *nsap) != buflen) {
+ Aerror(statp, stderr, "sendto", errno, *(struct sockaddr_in *)nsap);
+ close(s);
+ continue;
+ }
+ pfd[j].fd = s;
+ pfd[j].events = POLLIN;
+ j++;
+ }
+ /*
+ * Wait for reply.
+ */
+ seconds = statp->retrans;
+ if (seconds <= 0)
+ seconds = 1;
+ evNowTime(&now);
+ evConsTime(&timeout, seconds, 0);
+ evAddTime(&finish, &now, &timeout);
+ wait:
+ if (j == 0) {
+ return (0);
+ }
+
+ /* Convert struct timespec in milliseconds. */
+ ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
+ n = __poll (pfd, j, ptimeout);
+ if (n == 0) {
+ Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
+ *gotsomewhere = 1;
+ for (i = 0; i < j; i++)
+ close(pfd[i].fd);
+ return (0);
+ }
+ if (n < 0) {
+ if (errno == EINTR) {
+ evNowTime(&now);
+ if (evCmpTime(finish, now) > 0) {
+ evSubTime(&timeout, &finish, &now);
+ goto wait;
+ }
+ }
+ Perror(statp, stderr, "select", errno);
+ for (i = 0; i < j; i++)
+ close(pfd[i].fd);
+ res_nclose(statp);
+ return (0);
+ }
+ for (i = 0; i < j - 1; i++)
+ if (pfd[j].revents == POLLIN)
+ break;
+ s = pfd[i].fd;
+ __set_errno (0);
+ fromlen = sizeof(struct sockaddr_in6);
+ if (anssiz < MAXPACKET
+ && anscp
+ && (ioctl (s, FIONREAD, &resplen) < 0
+ || anssiz < resplen)) {
+ ans = malloc (MAXPACKET);
+ if (ans == NULL)
+ ans = *ansp;
+ else {
+ anssiz = MAXPACKET;
+ *anssizp = MAXPACKET;
+ *ansp = ans;
+ *anscp = ans;
+ anhp = (HEADER *) ans;
+ }
+ }
+ iov.iov_base = ans;
+ iov.iov_len = anssiz;
+ mhdr.msg_name = 0;
+ mhdr.msg_namelen = 0;
+ mhdr.msg_iov = &iov;
+ mhdr.msg_iovlen = 1;
+ mhdr.msg_control = cmsgbuf;
+ mhdr.msg_controllen = sizeof(cmsgbuf);
+ mhdr.msg_flags = 0;
+ resplen = recvmsg(s, &mhdr, 0);
+ if (resplen <= 0) {
+ if (errno == EAGAIN)
+ goto wait;
+ Perror(statp, stderr, "recvfrom", errno);
+wait2:
+ close(s);
+ if (i < j)
+ memmove(pfd + i, pfd + i + 1, sizeof(*pfd) * (j - i));
+ j--;
+ goto wait;
+ }
+ cmsg = CMSG_FIRSTHDR(&mhdr);
+ for (cmsg = CMSG_FIRSTHDR(&mhdr); cmsg; CMSG_NXTHDR(&mhdr, cmsg))
+ if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_TTL)
+ break;
+ if (!cmsg) {
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; no TTL found\n"));
+ goto wait2;
+ }
+ ttl = *(int *)CMSG_DATA(cmsg);
+ if (ttl != 255) {
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; answer with bad TTL: %d \n", ttl));
+ goto wait;
+ }
+ *gotsomewhere = 1;
+ if (resplen < HFIXEDSZ) {
+ /*
+ * Undersized message.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; undersized: %d\n",
+ resplen));
+ *terrno = EMSGSIZE;
+ goto wait;
+ }
+ if (hp->id != anhp->id) {
+ /*
+ * response from old query, ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; old answer:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ if (!(statp->options & RES_INSECURE2) &&
+ !res_queriesmatch(buf, buf + buflen,
+ ans, ans + anssiz)) {
+ /*
+ * response contains wrong query? ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; wrong query name:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ if (anhp->rcode == SERVFAIL ||
+ anhp->rcode == NOTIMP ||
+ anhp->rcode == REFUSED) {
+ DprintQ(statp->options & RES_DEBUG,
+ (stdout, "server rejected query:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ for (i = 0; i < j; i++)
+ close(pfd[i].fd);
+#if 0
+ if (!(statp->options & RES_IGNTC) && anhp->tc) {
+ /*
+ * To get the rest of answer,
+ * use TCP with same server.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; truncated answer\n"));
+ *v_circuit = 1;
+ res_nclose(statp);
+ return (1);
+ }
+#endif
+ /*
+ * All is well, or the error is fatal. Signal that the
+ * next nameserver ought not be tried.
+ */
+ return (resplen);
+}
+
#ifdef DEBUG
static void
Aerror(const res_state statp, FILE *file, const char *string, int error,

View File

@@ -0,0 +1,36 @@
2004-11-08 Richard Sandiford <rsandifo@redhat.com>
* sysdeps/mips/sys/regdef.h: Include #include <sgidefs.h>
* sysdeps/mips/sys/ucontext.h: Likewise.
Index: sysdeps/mips/sys/regdef.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/sys/regdef.h,v
retrieving revision 1.4
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 regdef.h
--- sysdeps/mips/sys/regdef.h 9 Apr 2003 02:51:04 -0000 1.4
+++ sysdeps/mips/sys/regdef.h 28 Oct 2004 12:57:20 -0000
@@ -20,6 +20,8 @@
#ifndef _SYS_REGDEF_H
#define _SYS_REGDEF_H
+#include <sgidefs.h>
+
/*
* Symbolic register names for 32 bit ABI
*/
Index: sysdeps/mips/sys/ucontext.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/sys/ucontext.h,v
retrieving revision 1.4
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 ucontext.h
--- sysdeps/mips/sys/ucontext.h 17 Mar 2003 15:47:12 -0000 1.4
+++ sysdeps/mips/sys/ucontext.h 28 Oct 2004 12:57:20 -0000
@@ -23,6 +23,7 @@ #define _SYS_UCONTEXT_H 1
#include <features.h>
#include <signal.h>
+#include <sgidefs.h>
/* Type for general register. */
#if _MIPS_SIM == _MIPS_SIM_ABI32

View File

@@ -0,0 +1,254 @@
--- sysdeps/unix/sysv/linux/mips/configure.in.orig 2004-09-29 23:49:30.000000000 -0400
+++ sysdeps/unix/sysv/linux/mips/configure.in 2004-09-30 02:04:26.000000000 -0400
@@ -19,50 +19,62 @@ mips*64*)
AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
echo '#include <asm/unistd.h>' > asm-unistd.h
else
- # The point of this preprocessing is to turn __NR_<syscall> into
- # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
- # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
- # and <abi> is the compiler-enabled ABI.
+ # There are two versions of this header. The older form defined
+ # __NR_foo, __NR_N32_foo, and __NR_O32_foo. The new form defines
+ # only __NR_foo, but does it based on the current ABI.
+ # We want to have __NR_O32_foo, __NR_N64_foo, and __NR_N32_foo defined
+ # always, and __NR_foo defined conditionally. Only the newer form is
+ # supported.
cat "$asm_unistd_h" |
- sed -e 's,__NR_,__NR_N64_,g' \
- -e 's,__NR_N64_##,__NR_##,g' \
- -e 's,__NR_N64_O32_,__NR_O32_,g' \
- -e 's,__NR_N64_N32_,__NR_N32_,g' \
- -e 's,__NR_N64_N64_,__NR_N64_,g' \
- | awk > asm-unistd.h '
+ awk > asm-unistd.h '
BEGIN { print "#include <sgidefs.h>"; }
-/^#define __NR.*unused/ { print; next; }
-/^#define __NR_N64__exit __NR_N64_exit/ {
- print "#define __NR__exit __NR_exit";
- print "#define __NR_O32__exit __NR_O32_exit";
- print "#define __NR_N32__exit __NR_N32_exit";
- print; next;
-}
-/^#define __NR_O32_/ {
- name = $2;
- sub (/_O32_/, "_", name);
- print;
+/^#if _MIPS_SIM == _MIPS_SIM_ABI32/,/^#endif.*_MIPS_SIM_ABI32/ {
+ if (/^#define __NR_Linux/) { print; next; }
+ if (/^#define __NR_/) {
+ line = $0;
+ gsub (/_NR_/, "_NR_O32_", line);
+ print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */";
+ print "";
+ print line;
+ print "";
print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
- print "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N32_/ {
- name = $2;
- sub (/_N32_/, "_", name);
- print;
+/^#if _MIPS_SIM == _MIPS_SIM_NABI32/,/^#endif.*_MIPS_SIM_NABI32/ {
+ if (/^#define __NR_Linux/) { print; next; }
+ if (/^#define __NR_/) {
+ line = $0;
+ gsub (/_NR_/, "_NR_N32_", line);
+ print "#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */";
+ print "";
+ print line;
+ print "";
print "#if _MIPS_SIM == _MIPS_SIM_NABI32";
- print "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N64_/ {
- name = $2;
- sub (/_N64_/, "_", name);
- print;
+/^#if _MIPS_SIM == _MIPS_SIM_ABI64/,/^#endif.*_MIPS_SIM_ABI64/ {
+ if (/^#define __NR_Linux/) { print; next; }
+ if (/^#define __NR_/) {
+ line = $0;
+ gsub (/_NR_/, "_NR_N64_", line);
+ print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */";
+ print "";
+ print line;
+ print "";
print "#if _MIPS_SIM == _MIPS_SIM_ABI64";
- print "# define " name " " $2;
- print "#endif";
+ print; next;
+ }
+ print; next;
+}
+/^#define __NR_64_/ {
+ line = $0;
+ gsub (/_NR_64_/, "_NR_N64_", line);
+ print;
+ print line;
next;
}
{
--- sysdeps/unix/sysv/linux/mips/configure.orig 2004-09-29 23:49:30.000000000 -0400
+++ sysdeps/unix/sysv/linux/mips/configure 2004-09-30 02:06:58.000000000 -0400
@@ -19,50 +19,62 @@ mips*64*)
echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
echo '#include <asm/unistd.h>' > asm-unistd.h
else
- # The point of this preprocessing is to turn __NR_<syscall> into
- # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
- # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
- # and <abi> is the compiler-enabled ABI.
+ # There are two versions of this header. The older form defined
+ # __NR_foo, __NR_N32_foo, and __NR_O32_foo. The new form defines
+ # only __NR_foo, but does it based on the current ABI.
+ # We want to have __NR_O32_foo, __NR_N64_foo, and __NR_N32_foo defined
+ # always, and __NR_foo defined conditionally. Only the newer form is
+ # supported.
cat "$asm_unistd_h" |
- sed -e 's,__NR_,__NR_N64_,g' \
- -e 's,__NR_N64_##,__NR_##,g' \
- -e 's,__NR_N64_O32_,__NR_O32_,g' \
- -e 's,__NR_N64_N32_,__NR_N32_,g' \
- -e 's,__NR_N64_N64_,__NR_N64_,g' \
- | awk > asm-unistd.h '
+ awk > asm-unistd.h '
BEGIN { print "#include <sgidefs.h>"; }
-/^#define __NR.*unused/ { print; next; }
-/^#define __NR_N64__exit __NR_N64_exit/ {
- print "#define __NR__exit __NR_exit";
- print "#define __NR_O32__exit __NR_O32_exit";
- print "#define __NR_N32__exit __NR_N32_exit";
- print; next;
-}
-/^#define __NR_O32_/ {
- name = $2;
- sub (/_O32_/, "_", name);
- print;
+/^#if _MIPS_SIM == _MIPS_SIM_ABI32/,/^#endif.*_MIPS_SIM_ABI32/ {
+ if (/^#define __NR_Linux/) { print; next; }
+ if (/^#define __NR_/) {
+ line = $0;
+ gsub (/_NR_/, "_NR_O32_", line);
+ print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */";
+ print "";
+ print line;
+ print "";
print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
- print "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N32_/ {
- name = $2;
- sub (/_N32_/, "_", name);
- print;
+/^#if _MIPS_SIM == _MIPS_SIM_NABI32/,/^#endif.*_MIPS_SIM_NABI32/ {
+ if (/^#define __NR_Linux/) { print; next; }
+ if (/^#define __NR_/) {
+ line = $0;
+ gsub (/_NR_/, "_NR_N32_", line);
+ print "#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */";
+ print "";
+ print line;
+ print "";
print "#if _MIPS_SIM == _MIPS_SIM_NABI32";
- print "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N64_/ {
- name = $2;
- sub (/_N64_/, "_", name);
- print;
+/^#if _MIPS_SIM == _MIPS_SIM_ABI64/,/^#endif.*_MIPS_SIM_ABI64/ {
+ if (/^#define __NR_Linux/) { print; next; }
+ if (/^#define __NR_/) {
+ line = $0;
+ gsub (/_NR_/, "_NR_N64_", line);
+ print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */";
+ print "";
+ print line;
+ print "";
print "#if _MIPS_SIM == _MIPS_SIM_ABI64";
- print "# define " name " " $2;
- print "#endif";
+ print; next;
+ }
+ print; next;
+}
+/^#define __NR_64_/ {
+ line = $0;
+ gsub (/_NR_64_/, "_NR_N64_", line);
+ print;
+ print line;
next;
}
{
--- sysdeps/unix/sysv/linux/mips/Makefile.orig 2004-09-29 23:49:30.000000000 -0400
+++ sysdeps/unix/sysv/linux/mips/Makefile 2004-09-30 02:12:30.000000000 -0400
@@ -12,7 +12,7 @@ no_syscall_list_h = 1
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
# it exists, but also define SYS_<abi>_<syscall> for all ABIs.
-$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
+$(objpfx)syscall-list.h $(objpfx)syscall-list.d: $(common-objpfx)asm-unistd.h
$(make-target-directory)
{ \
echo '/* Generated at libc build time from kernel syscall list. */';\
@@ -22,35 +22,9 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.
echo '#endif'; \
echo ''; \
echo '#include <sgidefs.h>'; \
- rm -f $(@:.d=.h).newt; \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
- -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
- sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
- > $(@:.d=.h).newt; \
- if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
- echo '#if _MIPS_SIM == _MIPS_SIM_NABI32'; \
- sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
- echo '#elif _MIPS_SIM == _MIPS_SIM_ABI64'; \
- sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
- echo '#else'; \
- sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
- echo '#endif'; \
- sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort +1.8; \
- else \
- cat $(@:.d=.h).newt; \
- fi; \
- rm $(@:.d=.h).newt; \
+ grep -E '^#.*(MIPS_SIM|__NR)' $(common-objpfx)asm-unistd.h \
+ | sed 's/__NR_/SYS_/g' ; \
} > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h)
-ifneq (,$(objpfx))
- sed $(sed-remove-objpfx) $(@:.h=.d)-t > $(@:.h=.d)-t2
- rm -f $(@:.h=.d)-t
- mv -f $(@:.h=.d)-t2 $(@:.h=.d)
-else
- mv -f $(@:.h=.d)-t $(@:.h=.d)
-endif
+ echo > $(@:.h=.d)
endif

View File

@@ -0,0 +1,32 @@
2004-10-18 Maciej W. Rozycki <macro@mips.com>
* sysdeps/unix/sysv/linux/mips/bits/mman.h (PROT_GROWSDOWN):
Define.
(PROT_GROWSUP): Likewise.
Please apply.
Maciej
glibc-2.3.3-20041018-mips-prot_grows-1
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/mman.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/mman.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/mman.h Sat Mar 8 03:26:00 2003
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/mman.h Mon Oct 18 14:48:57 2004
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/MIPS version.
- Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2003, 2004 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
@@ -34,6 +34,10 @@
#define PROT_WRITE 0x2 /* Page can be written. */
#define PROT_EXEC 0x4 /* Page can be executed. */
#define PROT_NONE 0x0 /* Page can not be accessed. */
+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
+ growsdown vma (mprotect only). */
+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
+ growsup vma (mprotect only). */
/* Sharing types (must choose one and only one of these). */
#define MAP_SHARED 0x01 /* Share changes. */

View File

@@ -0,0 +1,31 @@
2004-10-18 Maciej W. Rozycki <macro@mips.com>
* sysdeps/mips/bits/dlfcn.h (RTLD_DEEPBIND): Define.
Please apply.
Maciej
glibc-2.3.3-20041018-mips-rtld_deepbind-2.patch
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/bits/dlfcn.h glibc-2.3.3-20041018/sysdeps/mips/bits/dlfcn.h
--- glibc-2.3.3-20041018.macro/sysdeps/mips/bits/dlfcn.h Sat Oct 27 02:25:51 2001
+++ glibc-2.3.3-20041018/sysdeps/mips/bits/dlfcn.h Mon Oct 18 16:21:44 2004
@@ -1,5 +1,6 @@
/* System dependent definitions for run-time dynamic loading.
- Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1999, 2000, 2001, 2004
+ 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
@@ -24,8 +25,9 @@
/* The MODE argument to `dlopen' contains one of the following: */
#define RTLD_LAZY 0x0001 /* Lazy function call binding. */
#define RTLD_NOW 0x0002 /* Immediate function call binding. */
-#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
+#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
#define RTLD_NOLOAD 0x00008 /* Do not load the object. */
+#define RTLD_DEEPBIND 0x00010 /* Use deep binding. */
/* If the following bit is set in the MODE argument to `dlopen',
the symbols of the loaded object and its dependencies are made

View File

@@ -0,0 +1,54 @@
Index: linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h,v
retrieving revision 1.2
diff -u -r1.2 sysdep-cancel.h
--- linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h 28 Jul 2003 18:45:37 -0000 1.2
+++ linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h 1 Jun 2004 17:19:08 -0000
@@ -27,9 +27,6 @@
#ifdef __PIC__
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
- .align 2; \
- 99: la t9,__syscall_error; \
- jr t9; \
ENTRY (name) \
.set noreorder; \
.cpload t9; \
@@ -44,25 +41,25 @@
ret; \
L(pseudo_cancel): \
SAVESTK_##args; \
- sw ra, 28(sp); \
- sw gp, 32(sp); \
+ sw gp, 28(sp); \
+ sw ra, 32(sp); \
PUSHARGS_##args; /* save syscall args */ \
CENABLE; \
- lw gp, 32(sp); \
- sw v0, 44(sp); /* save mask */ \
+ lw gp, 28(sp); \
+ sw v0, 36(sp); /* save mask */ \
POPARGS_##args; /* restore syscall args */ \
.set noreorder; \
li v0, SYS_ify (syscall_name); \
syscall; \
.set reorder; \
- sw v0, 36(sp); /* save syscall result */ \
- sw a3, 40(sp); /* save syscall error flag */ \
- lw a0, 44(sp); /* pass mask as arg1 */ \
+ sw v0, 40(sp); /* save syscall result */ \
+ sw a3, 44(sp); /* save syscall error flag */ \
+ lw a0, 36(sp); /* pass mask as arg1 */ \
CDISABLE; \
- lw gp, 32(sp); \
- lw v0, 36(sp); /* restore syscall result */ \
- lw a3, 40(sp); /* restore syscall error flag */ \
- lw ra, 28(sp); /* restore return address */ \
+ lw gp, 28(sp); \
+ lw v0, 40(sp); /* restore syscall result */ \
+ lw a3, 44(sp); /* restore syscall error flag */ \
+ lw ra, 32(sp); /* restore return address */ \
RESTORESTK; \
bne a3, zero, SYSCALL_ERROR_LABEL; \
L(pseudo_end):

View File

@@ -0,0 +1,44 @@
2004-10-18 Maciej W. Rozycki <macro@mips.com>
* sysdeps/unix/sysv/linux/mips/bits/socket.h (__cmsg_nxthdr): Use
__NTH instead of __THROW in the inline definition.
* sysdeps/unix/sysv/linux/mips/sys/tas.h (_test_and_set):
Likewise.
Please apply.
Maciej
glibc-2.3.3-20041018-mips-nth-1.patch
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/socket.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/socket.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/socket.h Thu Sep 27 02:25:58 2001
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/socket.h Mon Oct 18 13:12:39 2004
@@ -1,5 +1,6 @@
/* System-specific socket constants and types. Linux/MIPS version.
- Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004
+ 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
@@ -261,7 +262,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st
# define _EXTERN_INLINE extern __inline
# endif
_EXTERN_INLINE struct cmsghdr *
-__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
+__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
{
if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/sys/tas.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/sys/tas.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/sys/tas.h Wed Jul 21 01:26:43 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/sys/tas.h Mon Oct 18 11:18:56 2004
@@ -35,7 +35,7 @@ extern int _test_and_set (int *p, int v)
# endif
_EXTERN_INLINE int
-_test_and_set (int *p, int v) __THROW
+__NTH (_test_and_set (int *p, int v))
{
int r, t;

View File

@@ -0,0 +1,229 @@
diff -urN libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
--- libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2004-05-28 16:19:18.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2004-06-14 19:28:43.131988368 -0500
@@ -187,8 +187,8 @@
addi r9,r9,32
stvx v18,0,r10
- stvx v11,0,r9
- addi r19,r10,32
+ stvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
stvx v20,0,r10
@@ -221,11 +221,6 @@
addi r10,r10,32
addi r9,r9,32
- stvx v10,0,r10
- stvx v11,0,r9
- addi r10,r10,32
- addi r9,r9,32
-
mfvscr v0
mfspr r0,VRSAVE
stvx v0,0,r10
diff -urN libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
--- libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S 2004-05-28 16:19:18.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S 2004-06-14 19:36:33.639954472 -0500
@@ -133,8 +133,8 @@
addi r9,r9,32
lvx v18,0,r10
- lvx v11,0,r9
- addi r19,r10,32
+ lvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
lvx v20,0,r10
diff -urN libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
--- libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2004-05-28 16:19:18.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2004-06-14 19:39:49.580990280 -0500
@@ -189,8 +189,8 @@
addi r9,r9,32
stvx v18,0,r10
- stvx v11,0,r9
- addi r19,r10,32
+ stvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
stvx v20,0,r10
@@ -223,11 +223,6 @@
addi r10,r10,32
addi r9,r9,32
- stvx v10,0,r10
- stvx v11,0,r9
- addi r10,r10,32
- addi r9,r9,32
-
mfvscr v0
mfspr r0,VRSAVE
stvx v0,0,r10
@@ -339,8 +334,8 @@
addi r9,r9,32
lvx v18,0,r10
- lvx v11,0,r9
- addi r19,r10,32
+ lvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
lvx v20,0,r10
diff -urN libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
--- libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S 2004-05-28 16:19:18.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S 2004-06-14 19:27:34.406052600 -0500
@@ -268,21 +268,22 @@
stfd fp0,(SIGCONTEXT_FP_REGS+(32*8))(r3)
ld r5,.LC__dl_hwcap@toc(r2)
- li r10,0
# ifdef SHARED
/* Load _rtld-global._dl_hwcap. */
ld r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
# else
ld r5,0(r5) /* Load extern _dl_hwcap. */
-# endif
- andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
- beq L(has_no_vec)
-
+# endif
la r10,(SIGCONTEXT_V_RESERVE+8)(r3)
la r9,(SIGCONTEXT_V_RESERVE+24)(r3)
+
+ andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+
clrrdi r10,r10,4
+ beq L(has_no_vec)
clrrdi r9,r9,4
-
+ mr r5,r10 /* Capture *v_regs value in r5. */
+
stvx v0,0,r10
stvx v1,0,r9
addi r10,r10,32
@@ -329,8 +330,8 @@
addi r9,r9,32
stvx v18,0,r10
- stvx v11,0,r9
- addi r19,r10,32
+ stvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
stvx v20,0,r10
@@ -363,11 +364,6 @@
addi r10,r10,32
addi r9,r9,32
- stvx v10,0,r10
- stvx v11,0,r9
- addi r10,r10,32
- addi r9,r9,32
-
mfvscr v0
mfspr r0,VRSAVE
stvx v0,0,r10
@@ -378,7 +374,7 @@
Store either a NULL or a quadword aligned pointer to the Vector register
array into *v_regs.
*/
- std r10,(SIGCONTEXT_V_REGS_PTR)(r3)
+ std r5,(SIGCONTEXT_V_REGS_PTR)(r3)
addi r5,r3,UCONTEXT_SIGMASK
li r4,0
diff -urN libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
--- libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S 2004-05-28 16:19:18.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S 2004-06-09 11:28:37.000000000 -0500
@@ -293,8 +293,8 @@
addi r9,r9,32
lvx v18,0,r10
- lvx v11,0,r9
- addi r19,r10,32
+ lvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
lvx v20,0,r10
diff -urN libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
--- libc23-cvstip-20040607/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S 2004-05-28 16:19:18.000000000 -0500
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S 2004-06-14 19:28:05.164035488 -0500
@@ -391,20 +391,22 @@
stfd fp0,(SIGCONTEXT_FP_REGS+(32*8))(r3)
ld r8,.LC__dl_hwcap@toc(r2)
- li r10,0
#ifdef SHARED
/* Load _rtld-global._dl_hwcap. */
ld r8,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r8)
#else
ld r8,0(r8) /* Load extern _dl_hwcap. */
#endif
- andis. r8,r8,(PPC_FEATURE_HAS_ALTIVEC >> 16)
- beq L(has_no_vec)
-
la r10,(SIGCONTEXT_V_RESERVE+8)(r3)
la r9,(SIGCONTEXT_V_RESERVE+24)(r3)
+
+ andis. r8,r8,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+
clrrdi r10,r10,4
+ beq L(has_no_vec)
+
clrrdi r9,r9,4
+ mr r8,r10 /* Capture *v_regs value in r5. */
stvx v0,0,r10
stvx v1,0,r9
@@ -452,8 +454,8 @@
addi r9,r9,32
stvx v18,0,r10
- stvx v11,0,r9
- addi r19,r10,32
+ stvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
stvx v20,0,r10
@@ -486,11 +488,6 @@
addi r10,r10,32
addi r9,r9,32
- stvx v10,0,r10
- stvx v11,0,r9
- addi r10,r10,32
- addi r9,r9,32
-
mfvscr v0
mfspr r0,VRSAVE
stvx v0,0,r10
@@ -501,7 +498,7 @@
Store either a NULL or a quadword aligned pointer to the Vector register
array into *v_regs.
*/
- std r10,(SIGCONTEXT_V_REGS_PTR)(r3)
+ std r8,(SIGCONTEXT_V_REGS_PTR)(r3)
mr r31,r4
addi r5,r3,UCONTEXT_SIGMASK
@@ -596,8 +593,8 @@
addi r9,r9,32
lvx v18,0,r10
- lvx v11,0,r9
- addi r19,r10,32
+ lvx v19,0,r9
+ addi r10,r10,32
addi r9,r9,32
lvx v20,0,r10

View File

@@ -0,0 +1,96 @@
--- glibc-2.3.3.old/nptl/sysdeps/pthread/pthread.h 2004-09-21 19:52:49.003553536 +0000
+++ glibc-2.3.3/nptl/sysdeps/pthread/pthread.h 2004-09-21 19:55:01.582398488 +0000
@@ -27,6 +27,7 @@
#include <signal.h>
#include <bits/pthreadtypes.h>
#include <bits/setjmp.h>
+#include <bits/wordsize.h>
/* Detach state. */
@@ -63,17 +64,26 @@
#define PTHREAD_MUTEX_INITIALIZER \
{ }
#ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { .__data = { .__kind = PTHREAD_MUTEX_RECURSIVE_NP } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { .__data = { .__kind = PTHREAD_MUTEX_ERRORCHECK_NP } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { .__data = { .__kind = PTHREAD_MUTEX_ADAPTIVE_NP } }
+# if __WORDSIZE == 64
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+# else
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+# endif
#endif
/* Read-write lock types. */
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
enum
{
PTHREAD_RWLOCK_PREFER_READER_NP,
@@ -81,15 +91,21 @@
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
};
-#endif /* Unix98 */
/* Read-write lock initializers. */
-#define PTHREAD_RWLOCK_INITIALIZER \
+# define PTHREAD_RWLOCK_INITIALIZER \
{ }
-#ifdef __USE_GNU
-# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { .__data = { .__flags = PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
-#endif
+# ifdef __USE_GNU
+# if __WORDSIZE == 64
+# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
+ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+# else
+# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
+ { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+# endif
+# endif
+#endif /* Unix98 or XOpen2K */
/* Scheduler inheritance. */
@@ -390,9 +406,12 @@
/* Guarantee that the initialization function INIT_ROUTINE will be called
only once, even if pthread_once is executed several times with the
same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or
- extern variable initialized to PTHREAD_ONCE_INIT. */
+ extern variable initialized to PTHREAD_ONCE_INIT.
+
+ The initialization functions might throw exception which is why
+ this function is not marked with __THROW. */
extern int pthread_once (pthread_once_t *__once_control,
- void (*__init_routine) (void)) __THROW;
+ void (*__init_routine) (void));
/* Functions for handling cancellation.
@@ -699,7 +718,7 @@
#endif
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Functions for handling read-write locks. */
/* Initialize read-write lock RWLOCK using attributes ATTR, or use

View File

@@ -0,0 +1,120 @@
2004-08-12 H.J. Lu <hongjiu.lu@intel.com>
* resolv/res_libc.c: Move definition of __res_maybe_init ...
* resolv/res_init.c: ... here.
2004-08-11 Andreas Schwab <schwab@suse.de>
* resolv/res_libc.c: Move definition of __res_initstamp ...
* resolv/res_init.c: ... here.
--- resolv/res_init.c.res_init 2004-08-11 14:23:06.000000000 -0700
+++ resolv/res_init.c 2004-08-12 16:29:09.000000000 -0700
@@ -106,6 +106,10 @@ static u_int32_t net_mask __P((struct in
# define isascii(c) (!(c & 0200))
#endif
+#ifdef _LIBC
+unsigned long long int __res_initstamp attribute_hidden;
+#endif
+
/*
* Resolver state default settings.
*/
@@ -162,7 +166,6 @@ __res_vinit(res_state statp, int preinit
int dots;
#endif
#ifdef _LIBC
- extern unsigned long long int __res_initstamp attribute_hidden;
statp->_u._ext.initstamp = __res_initstamp;
#endif
@@ -574,6 +577,39 @@ libc_hidden_def (__res_nclose)
#endif
#ifdef _LIBC
+/* Initialize resp if RES_INIT is not yet set or if res_init in some other
+ thread requested re-initializing. */
+int
+__res_maybe_init (res_state resp, int preinit)
+{
+ if (resp->options & RES_INIT) {
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0) {
+ __res_nclose (resp);
+ for (int ns = 0; ns < MAXNS; ns++) {
+ free (resp->_u._ext.nsaddrs[ns]);
+ resp->_u._ext.nsaddrs[ns] = NULL;
+ }
+ return __res_vinit (resp, 1);
+ }
+ }
+ return 0;
+ } else if (preinit) {
+ if (!resp->retrans)
+ resp->retrans = RES_TIMEOUT;
+ if (!resp->retry)
+ resp->retry = 4;
+ resp->options = RES_DEFAULT;
+ if (!resp->id)
+ resp->id = res_randomid ();
+ return __res_vinit (resp, 1);
+ } else
+ return __res_ninit (resp);
+}
+libc_hidden_def (__res_maybe_init)
+#endif
+
+#ifdef _LIBC
# ifdef _LIBC_REENTRANT
/* This is called when a thread is exiting to free resources held in _res. */
static void __attribute__ ((section ("__libc_thread_freeres_fn")))
--- resolv/res_libc.c.res_init 2004-08-11 14:23:06.000000000 -0700
+++ resolv/res_libc.c 2004-08-12 16:28:00.000000000 -0700
@@ -28,7 +28,7 @@
out) since res_init() should go into libc.so but the rest of that
file should not. */
-unsigned long long int __res_initstamp attribute_hidden;
+extern unsigned long long int __res_initstamp attribute_hidden;
/* We have atomic increment operations on 64-bit platforms. */
#if __WORDSIZE == 64
# define atomicinclock(lock) (void) 0
@@ -94,37 +94,6 @@ res_init(void) {
return (__res_vinit(&_res, 1));
}
-
-/* Initialize resp if RES_INIT is not yet set or if res_init in some other
- thread requested re-initializing. */
-int
-__res_maybe_init (res_state resp, int preinit)
-{
- if (resp->options & RES_INIT) {
- if (__res_initstamp != resp->_u._ext.initstamp) {
- if (resp->nscount > 0) {
- __res_nclose (resp);
- for (int ns = 0; ns < MAXNS; ns++) {
- free (resp->_u._ext.nsaddrs[ns]);
- resp->_u._ext.nsaddrs[ns] = NULL;
- }
- return __res_vinit (resp, 1);
- }
- }
- return 0;
- } else if (preinit) {
- if (!resp->retrans)
- resp->retrans = RES_TIMEOUT;
- if (!resp->retry)
- resp->retry = 4;
- resp->options = RES_DEFAULT;
- if (!resp->id)
- resp->id = res_randomid ();
- return __res_vinit (resp, 1);
- } else
- return __res_ninit (resp);
-}
-libc_hidden_def (__res_maybe_init)
/* This needs to be after the use of _res in res_init, above. */
#undef _res

View File

@@ -0,0 +1,129 @@
--- sysdeps/i386/elf/start.S.orig 1969-12-31 19:00:00.000000000 -0500
+++ sysdeps/i386/elf/start.S 2004-08-08 10:07:01.718652784 -0400
@@ -0,0 +1,126 @@
+/* Startup code compliant to the ELF i386 ABI.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004
+ 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
+ point runs, most registers' values are unspecified, except for:
+
+ %edx Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ %esp The stack contains the arguments and environment:
+ 0(%esp) argc
+ 4(%esp) argv[0]
+ ...
+ (4*argc)(%esp) NULL
+ (4*(argc+1))(%esp) envp[0]
+ ...
+ NULL
+*/
+
+#include "bp-sym.h"
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+
+ /* Extract the arguments as encoded on the stack and set up
+ the arguments for `main': argc, argv. envp will be determined
+ later in __libc_start_main. */
+ popl %esi /* Pop the argument count. */
+ movl %esp, %ecx /* argv starts just at the current stack top.*/
+
+ /* Before pushing the arguments align the stack to a 16-byte
+ (SSE needs 16-byte alignment) boundary to avoid penalties from
+ misaligned accesses. Thanks to Edward Seidl <seidl@janed.com>
+ for pointing this out. */
+ andl $0xfffffff0, %esp
+ pushl %eax /* Push garbage because we allocate
+ 28 more bytes. */
+
+ /* Provide the highest stack address to the user code (for stacks
+ which grow downwards). */
+ pushl %esp
+
+ pushl %edx /* Push address of the shared library
+ termination function. */
+
+#ifdef SHARED
+ /* Load PIC register. */
+ call 1f
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+
+ /* Push address of our own entry points to .fini and .init. */
+ leal __libc_csu_fini@GOTOFF(%ebx), %eax
+ pushl %eax
+ leal __libc_csu_init@GOTOFF(%ebx), %eax
+ pushl %eax
+
+ pushl %ecx /* Push second argument: argv. */
+ pushl %esi /* Push first argument: argc. */
+
+ pushl BP_SYM (main)@GOT(%ebx)
+
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ call BP_SYM (__libc_start_main)@PLT
+#else
+ /* Push address of our own entry points to .fini and .init. */
+ pushl $__libc_csu_fini
+ pushl $__libc_csu_init
+
+ pushl %ecx /* Push second argument: argv. */
+ pushl %esi /* Push first argument: argc. */
+
+ pushl $BP_SYM (main)
+
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ call BP_SYM (__libc_start_main)
+#endif
+
+ hlt /* Crash if somehow `exit' does return. */
+
+#ifdef SHARED
+1: movl (%esp), %ebx
+ ret
+#endif
+
+/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so
+ meaningless since we don't support machines < 80386. */
+ .section .rodata
+ .globl _fp_hw
+_fp_hw: .long 3
+ .size _fp_hw, 4
+ .type _fp_hw,@object
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start

View File

@@ -0,0 +1,36 @@
diff -Nru glibc-2.3.3.old/sysdeps/unix/sysv/linux/configure glibc-2.3.3/sysdeps/unix/sysv/linux/configure
--- glibc-2.3.3.old/sysdeps/unix/sysv/linux/configure 2004-09-06 12:33:39.320387104 -0400
+++ glibc-2.3.3/sysdeps/unix/sysv/linux/configure 2004-09-06 12:34:42.575770824 -0400
@@ -224,29 +224,13 @@
# in /lib and /etc.
case "$prefix" in
/usr | /usr/)
- # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
- case $machine in
- sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
- mips/mips64/n64/* )
- libc_cv_slibdir="/lib64"
+ libc_cv_slibdir="/@GENTOO_LIBDIR@"
if test "$libdir" = '${exec_prefix}/lib'; then
- libdir='${exec_prefix}/lib64';
+ libdir='${exec_prefix}/@GENTOO_LIBDIR@'
# Locale data can be shared between 32bit and 64bit libraries
libc_cv_localedir='${exec_prefix}/lib/locale'
fi
- ;;
- mips/mips64/n32/* )
- libc_cv_slibdir="/lib32"
- if test "$libdir" = '${exec_prefix}/lib'; then
- libdir='${exec_prefix}/lib32';
- # Locale data can be shared between 32bit and 64bit libraries
- libc_cv_localedir='${exec_prefix}/lib/locale'
- fi
- ;;
- *)
- libc_cv_slibdir="/lib"
- ;;
- esac
+
# Allow the user to override the path with --sysconfdir
if test $sysconfdir = '${prefix}/etc'; then
libc_cv_sysconfdir=/etc

View File

@@ -0,0 +1,95 @@
diff -Nru glibc-2.3.3.old/elf/rtld.c glibc-2.3.3/elf/rtld.c
--- glibc-2.3.3.old/elf/rtld.c 2004-09-16 15:02:16.000000000 -0400
+++ glibc-2.3.3/elf/rtld.c 2004-09-16 15:04:58.000000000 -0400
@@ -2041,6 +2041,30 @@
GLRO(dl_profile_output)
= &"/var/tmp\0/var/profile"[INTUSE(__libc_enable_secure) ? 9 : 0];
+ /* Extra security for SUID binaries. Remove all dangerous environment
+ variables. */
+ if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
+ {
+ static const char unsecure_envvars[] =
+#ifdef EXTRA_UNSECURE_ENVVARS
+ EXTRA_UNSECURE_ENVVARS
+#endif
+ UNSECURE_ENVVARS;
+ const char *nextp;
+
+ nextp = unsecure_envvars;
+ do
+ {
+ unsetenv (nextp);
+ /* We could use rawmemchr but this need not be fast. */
+ nextp = (char *) (strchr) (nextp, '\0') + 1;
+ }
+ while (*nextp != '\0');
+
+ if (__access ("/etc/suid-debug", F_OK) != 0)
+ unsetenv ("MALLOC_CHECK_");
+ }
+
while ((envline = _dl_next_ld_env_entry (&runp)) != NULL)
{
size_t len = 0;
@@ -2188,33 +2212,10 @@
/* The caller wants this information. */
*modep = mode;
- /* Extra security for SUID binaries. Remove all dangerous environment
- variables. */
- if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
- {
- static const char unsecure_envvars[] =
-#ifdef EXTRA_UNSECURE_ENVVARS
- EXTRA_UNSECURE_ENVVARS
-#endif
- UNSECURE_ENVVARS;
- const char *nextp;
-
- nextp = unsecure_envvars;
- do
- {
- unsetenv (nextp);
- /* We could use rawmemchr but this need not be fast. */
- nextp = (char *) (strchr) (nextp, '\0') + 1;
- }
- while (*nextp != '\0');
-
- if (__access ("/etc/suid-debug", F_OK) != 0)
- unsetenv ("MALLOC_CHECK_");
- }
/* If we have to run the dynamic linker in debugging mode and the
LD_DEBUG_OUTPUT environment variable is given, we write the debug
messages to this file. */
- else if (any_debug && debug_output != NULL)
+ if (any_debug && debug_output != NULL)
{
#ifdef O_NOFOLLOW
const int flags = O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW;
diff -Nru glibc-2.3.3.old/malloc/malloc.c glibc-2.3.3/malloc/malloc.c
--- glibc-2.3.3.old/malloc/malloc.c 2004-09-16 15:03:22.000000000 -0400
+++ glibc-2.3.3/malloc/malloc.c 2004-09-16 15:04:58.000000000 -0400
@@ -321,6 +321,10 @@
#define assert(x) ((void)0)
#endif
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+#define ABORT_INSTRUCTION
+#endif
/*
INTERNAL_SIZE_T is the word-size used for internal bookkeeping
diff -Nru glibc-2.3.3.old/sysdeps/generic/unsecvars.h glibc-2.3.3/sysdeps/generic/unsecvars.h
--- glibc-2.3.3.old/sysdeps/generic/unsecvars.h 2004-09-16 15:03:11.000000000 -0400
+++ glibc-2.3.3/sysdeps/generic/unsecvars.h 2004-09-16 15:04:58.000000000 -0400
@@ -3,6 +3,8 @@
with a '\0' explicitly. */
#define UNSECURE_ENVVARS \
"LD_PRELOAD\0" \
+ "LD_DEBUG\0" \
+ "LD_TRACE_PRELINKING\0" \
"LD_LIBRARY_PATH\0" \
"LD_ORIGIN_PATH\0" \
"LD_DEBUG_OUTPUT\0" \

View File

@@ -0,0 +1,231 @@
diff -u -p -r1.83 kernel-features.h
--- sysdeps/unix/sysv/linux/kernel-features.h 26 Jan 2005 20:01:10 -0000 1.83
+++ sysdeps/unix/sysv/linux/kernel-features.h 18 Feb 2005 06:21:10 -0000
@@ -413,6 +413,11 @@
# define __ASSUME_GETDENTS32_D_TYPE 1
#endif
+/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
+#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
+# define __ASSUME_STAT64_SYSCALL 1
+#endif
+
/* Starting with version 2.5.3, the initial location returned by `brk'
after exec is always rounded up to the next page. */
#if __LINUX_KERNEL_VERSION >= 132355
diff -u -p -r1.1 fxstat.c
--- sysdeps/unix/sysv/linux/alpha/fxstat.c 11 Mar 2004 02:58:44 -0000 1.1
+++ sysdeps/unix/sysv/linux/alpha/fxstat.c 18 Feb 2005 06:21:10 -0000
@@ -1,5 +1,5 @@
/* fxstat using old-style Unix stat system call.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 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
@@ -35,27 +35,39 @@ int
__fxstat (int vers, int fd, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int result;
struct kernel_stat kbuf;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+#elif defined __NR_fstat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
+ int errno_out;
result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
if (errno_out != ENOSYS)
- goto fail;
+ {
+ __set_errno (errno_out);
+ return -1;
+ }
__libc_missing_axp_stat64 = 1;
}
+#endif
result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
-
- fail:
- __set_errno (errno_out);
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__fxstat)
diff -u -p -r1.1 lxstat.c
--- sysdeps/unix/sysv/linux/alpha/lxstat.c 11 Mar 2004 02:58:44 -0000 1.1
+++ sysdeps/unix/sysv/linux/alpha/lxstat.c 18 Feb 2005 06:21:10 -0000
@@ -1,5 +1,5 @@
/* lxstat using old-style Unix stat system call.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 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
@@ -35,27 +35,39 @@ int
__lxstat (int vers, const char *name, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int result;
struct kernel_stat kbuf;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+#elif defined __NR_lstat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
+ int errno_out;
result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
if (errno_out != ENOSYS)
- goto fail;
+ {
+ __set_errno (errno_out);
+ return -1;
+ }
__libc_missing_axp_stat64 = 1;
}
+#endif
result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
-
- fail:
- __set_errno (errno_out);
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__lxstat)
diff -u -p -r1.1 xstat.c
--- sysdeps/unix/sysv/linux/alpha/xstat.c 11 Mar 2004 02:58:44 -0000 1.1
+++ sysdeps/unix/sysv/linux/alpha/xstat.c 18 Feb 2005 06:21:10 -0000
@@ -1,5 +1,5 @@
/* xstat using old-style Unix stat system call.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 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
@@ -35,27 +35,39 @@ int
__xstat (int vers, const char *name, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int result;
struct kernel_stat kbuf;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+#elif defined __NR_stat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
+ int errno_out;
result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
if (errno_out != ENOSYS)
- goto fail;
+ {
+ __set_errno (errno_out);
+ return -1;
+ }
__libc_missing_axp_stat64 = 1;
}
+#endif
result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
-
- fail:
- __set_errno (errno_out);
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__xstat)
diff -u -p -r1.6 xstatconv.c
--- sysdeps/unix/sysv/linux/alpha/xstatconv.c 11 Mar 2004 02:58:44 -0000 1.6
+++ sysdeps/unix/sysv/linux/alpha/xstatconv.c 26 Feb 2005 13:58:07 -0000
@@ -1,5 +1,5 @@
/* Convert between the kernel's `struct stat' format, and libc's.
- Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003, 2004, 2005 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
@@ -22,9 +22,14 @@
#include <sys/stat.h>
#include <kernel_stat.h>
#include <xstatconv.h>
+#include <sys/syscall.h>
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
int __libc_missing_axp_stat64;
+# endif
+#endif
int
__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
diff -u -p -r1.1 xstatconv.h
--- sysdeps/unix/sysv/linux/alpha/xstatconv.h 11 Mar 2004 02:58:44 -0000 1.1
+++ sysdeps/unix/sysv/linux/alpha/xstatconv.h 26 Feb 2005 13:58:07 -0000
@@ -1,5 +1,5 @@
/* Convert between the kernel's `struct stat' format, and libc's.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 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
@@ -18,7 +18,12 @@
02111-1307 USA. */
#include "kernel-features.h"
+#include <sys/syscall.h>
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
extern int __libc_missing_axp_stat64 attribute_hidden;
+# endif
+#endif
extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
attribute_hidden;

View File

@@ -0,0 +1,33 @@
# /etc/host.conf:
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/2.3.4/host.conf,v 1.2 2004/11/24 05:31:58 vapier Exp $
# The file /etc/host.conf contains configuration information specific to
# the resolver library. It should contain one configuration keyword per
# line, followed by appropriate configuration information. The keywords
# recognized are order, trim, mdns, multi, nospoof, spoof, and reorder.
# This keyword specifies how host lookups are to be performed. It
# should be followed by one or more lookup methods, separated by
# commas. Valid methods are bind, hosts, and nis.
#
order hosts, bind
# Valid values are on and off. If set to on, the resolv+ library treats
# the .local top level domain as link-local domain and sends multicast
# DNS requests to the multicast address 224.0.0.251 port 5353 instead
# of normal DNS requests. If you already use the .local domain in your
# nameserver configuration you will have to switch this option off.
#
mdns off
# Valid values are on and off. If set to on, the resolv+ library
# will return all valid addresses for a host that appears in the
# /etc/hosts file, instead of only the first. This is off by
# default, as it may cause a substantial performance loss at sites
# with large hosts files.
#
multi off

View File

@@ -0,0 +1,44 @@
PIE support is broken on PARISC in this glibc so make sure we dont force
building nscd as a PIE or bad things happen.
--- nscd/Makefile
+++ nscd/Makefile
@@ -35,7 +35,7 @@
ifeq ($(have-thread-library),yes)
others := nscd_nischeck
-ifneq (yesyes,$(have-fpie)$(build-shared))
+ifneq (yes,$(build-shared))
others += nscd
endif
install-sbin := nscd nscd_nischeck
@@ -60,27 +60,10 @@
CFLAGS-nscd_getgr_r.c = -fexceptions
CFLAGS-nscd_gethst_r.c = -fexceptions
-ifeq (yesyes,$(have-fpie)$(build-shared))
-CFLAGS-nscd.c = -fpie
-CFLAGS-connections.c = -fpie
-CFLAGS-pwdcache.c = -fpie
-CFLAGS-getpwnam_r.c = -fpie
-CFLAGS-getpwuid_r.c = -fpie
-CFLAGS-grpcache.c = -fpie
-CFLAGS-getgrnam_r.c = -fpie
-CFLAGS-getgrgid_r.c = -fpie
-CFLAGS-hstcache.c = -fpie
-CFLAGS-gethstbyad_r.c = -fpie
-CFLAGS-gethstbynm2_r.c = -fpie
-CFLAGS-dbg_log.c = -fpie
-CFLAGS-nscd_conf.c = -fpie
-CFLAGS-nscd_stat.c = -fpie
-CFLAGS-cache.c = -fpie
-CFLAGS-xmalloc.c = -fpie
-CFLAGS-xstrdup.c = -fpie
+ifeq (yes,$(build-shared))
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
- $(LINK.o) -pie -Wl,-O1 \
+ $(LINK.o) -Wl,-O1 \
$(sysdep-LDFLAGS) $(config-LDFLAGS) \
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \

View File

@@ -0,0 +1,102 @@
--- config.h.in
+++ config.h.in
@@ -215,4 +215,7 @@
#undef HAVE_LIBIDN
+/* Defined if economical random device is available. */
+#undef HAVE_DEV_ERANDOM
+
/* Define if inlined system calls are available. */
#undef HAVE_INLINED_SYSCALLS
--- configure.in
+++ configure.in
@@ -264,4 +264,11 @@
AC_SUBST(all_warnings)
+dnl See whether the user wants to disable checking for /dev/erandom
+AC_ARG_ENABLE([dev-erandom],
+ AC_HELP_STRING([--disable-dev-erandom],
+ [disable testing for /dev/erandom]),
+ [try_dev_erandom=$enableval],
+ [try_dev_erandom=yes])
+
AC_CANONICAL_HOST
@@ -1974,4 +1981,19 @@
AC_SUBST(sizeof_long_double)
+dnl check whether we have an economical random device
+if test "$try_dev_erandom" = yes ; then
+ AC_CACHE_CHECK(for economical random device, ac_cv_have_dev_random,
+ [if test -r "/dev/erandom" ; then
+ ac_cv_have_dev_erandom=yes; else ac_cv_have_dev_erandom=no; fi])
+ if test "$ac_cv_have_dev_erandom" = yes; then
+ AC_DEFINE(HAVE_DEV_ERANDOM,1,
+ [defined if the system supports an economical random device])
+ fi
+else
+ AC_MSG_CHECKING(for economical random device)
+ ac_cv_have_dev_erandom=no
+ AC_MSG_RESULT(has been disabled)
+fi
+
### End of automated tests.
### Now run sysdeps configure fragments.
--- configure
+++ configure
@@ -884,6 +884,7 @@
--enable-kernel=VERSION compile for compatibility with kernel not older than
VERSION
--enable-all-warnings enable all useful warnings gcc can issue
+ --disable-dev-erandom disable testing for /dev/erandom
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1697,6 +1698,14 @@
fi;
+# Check whether --enable-dev-erandom or --disable-dev-erandom was given.
+if test "${enable_dev_erandom+set}" = set; then
+ enableval="$enable_dev_erandom"
+ try_dev_erandom=$enableval
+else
+ try_dev_erandom=yes
+fi;
+
# Make sure we can run config.sub.
$ac_config_sub sun4 >/dev/null 2>&1 ||
{ { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
@@ -7449,6 +7458,32 @@
sizeof_long_double=$ac_cv_sizeof_long_double
+if test "$try_dev_erandom" = yes ; then
+ echo "$as_me:$LINENO: checking for economical random device" >&5
+echo $ECHO_N "checking for economical random device... $ECHO_C" >&6
+if test "${ac_cv_have_dev_random+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -r "/dev/erandom" ; then
+ ac_cv_have_dev_erandom=yes; else ac_cv_have_dev_erandom=no; fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_dev_random" >&5
+echo "${ECHO_T}$ac_cv_have_dev_random" >&6
+ if test "$ac_cv_have_dev_erandom" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DEV_ERANDOM 1
+_ACEOF
+
+ fi
+else
+ echo "$as_me:$LINENO: checking for economical random device" >&5
+echo $ECHO_N "checking for economical random device... $ECHO_C" >&6
+ ac_cv_have_dev_erandom=no
+ echo "$as_me:$LINENO: result: has been disabled" >&5
+echo "${ECHO_T}has been disabled" >&6
+fi
+
### End of automated tests.
### Now run sysdeps configure fragments.

View File

@@ -0,0 +1,138 @@
The configure check for SSP is taken from glibc HEAD.
diff -ur glibc-2.3.5-orig/config.make.in glibc-2.3.5/config.make.in
--- glibc-2.3.5-orig/config.make.in 2006-01-18 00:31:17.000000000 -0500
+++ glibc-2.3.5/config.make.in 2006-01-18 00:33:25.000000000 -0500
@@ -61,6 +61,7 @@
have-selinux = @have_selinux@
have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
fno-unit-at-a-time = @fno_unit_at_a_time@
+have-ssp = @libc_cv_ssp@
bind-now = @bindnow@
static-libgcc = @libc_cv_gcc_static_libgcc@
diff -ur glibc-2.3.5-orig/configure glibc-2.3.5/configure
--- glibc-2.3.5-orig/configure 2006-01-18 00:31:17.000000000 -0500
+++ glibc-2.3.5/configure 2006-01-18 00:35:54.000000000 -0500
@@ -313,7 +313,7 @@
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -5785,6 +5785,33 @@
fi
+echo "$as_me:$LINENO: checking for -fstack-protector" >&5
+echo $ECHO_N "checking for -fstack-protector... $ECHO_C" >&6
+if test "${libc_cv_ssp+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fstack-protector
+ -o conftest conftest.c 1>&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+then
+ libc_cv_ssp=yes
+else
+ libc_cv_ssp=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_ssp" >&5
+echo "${ECHO_T}$libc_cv_ssp" >&6
+
+
if test $elf != yes; then
echo "$as_me:$LINENO: checking for .init and .fini sections" >&5
echo $ECHO_N "checking for .init and .fini sections... $ECHO_C" >&6
@@ -8424,6 +8451,7 @@
s,@libc_cv_z_execstack@,$libc_cv_z_execstack,;t t
s,@libc_cv_fpie@,$libc_cv_fpie,;t t
s,@fno_unit_at_a_time@,$fno_unit_at_a_time,;t t
+s,@libc_cv_ssp@,$libc_cv_ssp,;t t
s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t
s,@libc_cv_cpp_asm_debuginfo@,$libc_cv_cpp_asm_debuginfo,;t t
s,@no_whole_archive@,$no_whole_archive,;t t
diff -ur glibc-2.3.5-orig/configure.in glibc-2.3.5/configure.in
--- glibc-2.3.5-orig/configure.in 2006-01-18 00:31:17.000000000 -0500
+++ glibc-2.3.5/configure.in 2006-01-18 00:35:50.000000000 -0500
@@ -1500,6 +1500,21 @@
fi
AC_SUBST(fno_unit_at_a_time)
+AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
+cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fstack-protector
+ -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+ libc_cv_ssp=yes
+else
+ libc_cv_ssp=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_ssp)
+
if test $elf != yes; then
AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
[AC_TRY_COMPILE(, [asm (".section .init");
diff -ur glibc-2.3.5-orig/sysdeps/generic/libc-start.c glibc-2.3.5/sysdeps/generic/libc-start.c
--- glibc-2.3.5-orig/sysdeps/generic/libc-start.c 2006-01-18 00:31:35.000000000 -0500
+++ glibc-2.3.5/sysdeps/generic/libc-start.c 2006-01-18 00:30:39.000000000 -0500
@@ -188,6 +188,9 @@
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
#endif
+ /* call the __guard_setup to set up the random __guard value */
+ __guard_setup (); /* pappy@gentoo.org (pappy rules) */
+
#ifdef HAVE_CLEANUP_JMP_BUF
/* Memory for the cancellation buffer. */
struct pthread_unwind_buf unwind_buf;
diff -ur glibc-2.3.5-orig/sysdeps/unix/sysv/linux/Dist glibc-2.3.5/sysdeps/unix/sysv/linux/Dist
--- glibc-2.3.5-orig/sysdeps/unix/sysv/linux/Dist 2006-01-18 00:31:35.000000000 -0500
+++ glibc-2.3.5/sysdeps/unix/sysv/linux/Dist 2006-01-18 00:30:39.000000000 -0500
@@ -1,3 +1,4 @@
+ssp.c
bits/initspin.h
cmsg_nxthdr.c
dl-brk.c
diff -ur glibc-2.3.5-orig/sysdeps/unix/sysv/linux/Makefile glibc-2.3.5/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.3.5-orig/sysdeps/unix/sysv/linux/Makefile 2006-01-18 00:31:35.000000000 -0500
+++ glibc-2.3.5/sysdeps/unix/sysv/linux/Makefile 2006-01-18 00:33:03.000000000 -0500
@@ -1,5 +1,8 @@
ifeq ($(subdir),csu)
-sysdep_routines += errno-loc
+sysdep_routines += errno-loc ssp
+ifeq (yes,$(have-ssp))
+CFLAGS-ssp.c += -fno-stack-protector
+endif
endif
ifeq ($(subdir),assert)
diff -ur glibc-2.3.5-orig/sysdeps/unix/sysv/linux/Versions glibc-2.3.5/sysdeps/unix/sysv/linux/Versions
--- glibc-2.3.5-orig/sysdeps/unix/sysv/linux/Versions 2006-01-18 00:31:35.000000000 -0500
+++ glibc-2.3.5/sysdeps/unix/sysv/linux/Versions 2006-01-18 00:30:39.000000000 -0500
@@ -108,6 +108,8 @@
GLIBC_2.3.2 {
# New kernel interfaces.
epoll_create; epoll_ctl; epoll_wait;
+ # global objects and functions for the propolice patch in gcc - moved from libgcc by pappy@gentoo.org
+ __guard; __guard_setup; __stack_smash_handler;
}
GLIBC_2.3.3 {
gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;

View File

@@ -0,0 +1,155 @@
/*
* Distributed under the terms of the GNU General Public License v2
* $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/2.3.5/ssp.c,v 1.3 2005/06/07 01:38:58 vapier Exp $
*
* This is a modified version of Hiroaki Etoh's stack smashing routines
* implemented for glibc.
*
* The following people have contributed input to this code.
* Ned Ludd - <solar[@]gentoo.org>
* Alexander Gabert - <pappy[@]gentoo.org>
* The PaX Team - <pageexec[@]freemail.hu>
* Peter S. Mazinger - <ps.m[@]gmx.net>
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
* Robert Connolly - <robert[@]linuxfromscratch.org>
* Cory Visi <cory@visi.name>
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef __SSP__
# error ssp.c has to be built w/ -fno-stack-protector
#endif
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/syslog.h>
#include <sys/time.h>
#ifdef __SSP_USE_ERANDOM__
# include <sys/sysctl.h>
#endif
#ifdef __PROPOLICE_BLOCK_SEGV__
# define SSP_SIGTYPE SIGSEGV
#elif __PROPOLICE_BLOCK_KILL__
# define SSP_SIGTYPE SIGKILL
#else
# define SSP_SIGTYPE SIGABRT
#endif
unsigned long __guard = 0UL;
/* Use of __* functions from the rest of glibc here avoids
* initialisation problems for executables preloaded with
* libraries that overload the associated standard library
* functions.
*/
#ifdef __UCLIBC__
extern int __libc_open(__const char *file, int flags, ...);
extern ssize_t __libc_read(int fd, void *buf, size_t count);
extern int __libc_close(int fd);
#else
# define __libc_open(file, flags) __open(file, flags)
# define __libc_read(fd, buf, count) __read(fd, buf, count)
# define __libc_close(fd) __close(fd)
# define __libc_write(fd, buf, count) __write(fd, buf, count)
#endif
void __guard_setup(void) __attribute__ ((constructor));
void __guard_setup(void)
{
size_t size;
if (__guard != 0UL)
return;
/* Start with the "terminator canary". */
__guard = 0xFF0A0D00UL;
#ifndef __SSP_QUICK_CANARY__
# ifdef __SSP_USE_ERANDOM__
{
int mib[3];
/* Random is another depth in Linux, hence an array of 3. */
mib[0] = CTL_KERN;
mib[1] = KERN_RANDOM;
mib[2] = RANDOM_ERANDOM;
size = sizeof(unsigned long);
if (__sysctl(mib, 3, &__guard, &size, NULL, 0) != (-1))
if (__guard != 0UL)
return;
}
# endif /* ifdef __SSP_USE_ERANDOM__ */
/*
* Attempt to open kernel pseudo random device if one exists before
* opening urandom to avoid system entropy depletion.
*/
{
int fd;
# ifdef __SSP_USE_ERANDOM__
if ((fd = __libc_open("/dev/erandom", O_RDONLY)) == (-1))
# endif
fd = __libc_open("/dev/urandom", O_RDONLY);
if (fd != (-1)) {
size = __libc_read(fd, (char *) &__guard, sizeof(__guard));
__libc_close(fd);
if (size == sizeof(__guard))
return;
}
}
#endif /* ifndef __SSP_QUICK_CANARY__ */
/* Everything failed? Or we are using a weakened model of the
* terminator canary */
{
struct timeval tv;
__gettimeofday(&tv, NULL);
__guard ^= tv.tv_usec ^ tv.tv_sec;
}
}
void __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
void __stack_smash_handler(char func[], int damaged)
{
extern char *__progname;
const char message[] = ": stack smashing attack in function ";
struct sigaction sa;
sigset_t mask;
sigfillset(&mask);
sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */
sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */
/* Print error message to stderr and syslog */
#if 1 /* syslog() causes issues with glibc #94325 */
__libc_write(STDERR_FILENO, __progname, strlen(__progname));
__libc_write(STDERR_FILENO, message, strlen(message));
__libc_write(STDERR_FILENO, func, strlen(func));
__libc_write(STDERR_FILENO, "()\n", 3);
//_syscall3(int, _ssp_syslog, int, type, char *, bufp, int, len)
//_ssp_syslog(LOG_INFO,
#else
fprintf(stderr, "%s%s%s()\n", __progname, message, func);
syslog(LOG_INFO, "%s%s%s()", __progname, message, func);
#endif
/* Make the default handler associated with the signal handler */
memset(&sa, 0, sizeof(struct sigaction));
sigfillset(&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
sigaction(SSP_SIGTYPE, &sa, NULL);
(void) kill(getpid(), SSP_SIGTYPE);
_exit(127);
}

View File

@@ -0,0 +1,138 @@
The configure check for SSP was taken from glibc HEAD
diff -ur glibc-2.3.6-orig/config.make.in glibc-2.3.6/config.make.in
--- glibc-2.3.6-orig/config.make.in 2006-01-17 14:22:02.000000000 -0500
+++ glibc-2.3.6/config.make.in 2006-01-17 14:22:39.000000000 -0500
@@ -62,6 +62,7 @@
have-libaudit = @have_libaudit@
have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
fno-unit-at-a-time = @fno_unit_at_a_time@
+have-ssp = @libc_cv_ssp@
bind-now = @bindnow@
static-libgcc = @libc_cv_gcc_static_libgcc@
diff -ur glibc-2.3.6-orig/configure glibc-2.3.6/configure
--- glibc-2.3.6-orig/configure 2006-01-17 14:22:17.000000000 -0500
+++ glibc-2.3.6/configure 2006-01-17 14:18:24.000000000 -0500
@@ -313,7 +313,7 @@
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -5785,6 +5785,33 @@
fi
+echo "$as_me:$LINENO: checking for -fstack-protector" >&5
+echo $ECHO_N "checking for -fstack-protector... $ECHO_C" >&6
+if test "${libc_cv_ssp+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fstack-protector
+ -o conftest conftest.c 1>&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+then
+ libc_cv_ssp=yes
+else
+ libc_cv_ssp=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_ssp" >&5
+echo "${ECHO_T}$libc_cv_ssp" >&6
+
+
if test $elf != yes; then
echo "$as_me:$LINENO: checking for .init and .fini sections" >&5
echo $ECHO_N "checking for .init and .fini sections... $ECHO_C" >&6
@@ -8504,6 +8531,7 @@
s,@libc_cv_z_execstack@,$libc_cv_z_execstack,;t t
s,@libc_cv_fpie@,$libc_cv_fpie,;t t
s,@fno_unit_at_a_time@,$fno_unit_at_a_time,;t t
+s,@libc_cv_ssp@,$libc_cv_ssp,;t t
s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t
s,@libc_cv_cpp_asm_debuginfo@,$libc_cv_cpp_asm_debuginfo,;t t
s,@no_whole_archive@,$no_whole_archive,;t t
diff -ur glibc-2.3.6-orig/configure.in glibc-2.3.6/configure.in
--- glibc-2.3.6-orig/configure.in 2006-01-17 14:22:17.000000000 -0500
+++ glibc-2.3.6/configure.in 2006-01-17 14:18:24.000000000 -0500
@@ -1500,6 +1500,21 @@
fi
AC_SUBST(fno_unit_at_a_time)
+AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
+cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fstack-protector
+ -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+ libc_cv_ssp=yes
+else
+ libc_cv_ssp=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_ssp)
+
if test $elf != yes; then
AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
[AC_TRY_COMPILE(, [asm (".section .init");
diff -ur glibc-2.3.6-orig/sysdeps/generic/libc-start.c glibc-2.3.6/sysdeps/generic/libc-start.c
--- glibc-2.3.6-orig/sysdeps/generic/libc-start.c 2006-01-17 14:22:17.000000000 -0500
+++ glibc-2.3.6/sysdeps/generic/libc-start.c 2006-01-17 14:18:24.000000000 -0500
@@ -188,6 +188,9 @@
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
#endif
+ /* call the __guard_setup to set up the random __guard value */
+ __guard_setup (); /* pappy@gentoo.org (pappy rules) */
+
#ifdef HAVE_CLEANUP_JMP_BUF
/* Memory for the cancellation buffer. */
struct pthread_unwind_buf unwind_buf;
diff -ur glibc-2.3.6-orig/sysdeps/unix/sysv/linux/Dist glibc-2.3.6/sysdeps/unix/sysv/linux/Dist
--- glibc-2.3.6-orig/sysdeps/unix/sysv/linux/Dist 2006-01-17 14:22:17.000000000 -0500
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/Dist 2006-01-17 14:18:24.000000000 -0500
@@ -1,3 +1,4 @@
+ssp.c
bits/initspin.h
cmsg_nxthdr.c
dl-brk.c
diff -ur glibc-2.3.6-orig/sysdeps/unix/sysv/linux/Makefile glibc-2.3.6/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.3.6-orig/sysdeps/unix/sysv/linux/Makefile 2006-01-17 14:22:17.000000000 -0500
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/Makefile 2006-01-17 14:18:24.000000000 -0500
@@ -1,5 +1,8 @@
ifeq ($(subdir),csu)
-sysdep_routines += errno-loc
+sysdep_routines += errno-loc ssp
+ifeq (yes,$(have-ssp))
+CFLAGS-ssp.c += -fno-stack-protector
+endif
endif
ifeq ($(subdir),assert)
diff -ur glibc-2.3.6-orig/sysdeps/unix/sysv/linux/Versions glibc-2.3.6/sysdeps/unix/sysv/linux/Versions
--- glibc-2.3.6-orig/sysdeps/unix/sysv/linux/Versions 2006-01-17 14:22:17.000000000 -0500
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/Versions 2006-01-17 14:18:24.000000000 -0500
@@ -108,6 +108,8 @@
GLIBC_2.3.2 {
# New kernel interfaces.
epoll_create; epoll_ctl; epoll_wait;
+ # global objects and functions for the propolice patch in gcc - moved from libgcc by pappy@gentoo.org
+ __guard; __guard_setup; __stack_smash_handler;
}
GLIBC_2.3.3 {
gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;

View File

@@ -0,0 +1,24 @@
# /etc/host.conf:
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/2.3.6/host.conf,v 1.1 2006/02/21 23:35:21 vapier Exp $
# The file /etc/host.conf contains configuration information specific to
# the resolver library. It should contain one configuration keyword per
# line, followed by appropriate configuration information. The keywords
# recognized are order, trim, mdns, multi, nospoof, spoof, and reorder.
# This keyword specifies how host lookups are to be performed. It
# should be followed by one or more lookup methods, separated by
# commas. Valid methods are bind, hosts, and nis.
#
order hosts, bind
# Valid values are on and off. If set to on, the resolv+ library
# will return all valid addresses for a host that appears in the
# /etc/hosts file, instead of only the first. This is off by
# default, as it may cause a substantial performance loss at sites
# with large hosts files.
#
multi off

View File

@@ -0,0 +1,28 @@
--- glibc-2.4/sysdeps/unix/sysv/linux/configure
+++ glibc-2.4/sysdeps/unix/sysv/linux/configure
@@ -224,23 +224,12 @@
# in /lib and /etc.
case "$prefix" in
/usr | /usr/)
- # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
- # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
- # and libc_cv_localedir.
- test -n "$libc_cv_slibdir" || \
- case $machine in
- sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
- libc_cv_slibdir="/lib64"
+ libc_cv_slibdir="/@GENTOO_LIBDIR@"
if test "$libdir" = '${exec_prefix}/lib'; then
- libdir='${exec_prefix}/lib64';
+ libdir='${exec_prefix}/@GENTOO_LIBDIR@'
# Locale data can be shared between 32bit and 64bit libraries
libc_cv_localedir='${exec_prefix}/lib/locale'
fi
- ;;
- *)
- libc_cv_slibdir="/lib"
- ;;
- esac
# Allow the user to override the path with --sysconfdir
if test $sysconfdir = '${prefix}/etc'; then
libc_cv_sysconfdir=/etc

View File

@@ -0,0 +1,25 @@
/*
* Just do:
* # gcc -fno-stack-protector -s -shared -fPIC ssp_simple.c -o /lib/libssp_simple.so
* # echo '/lib/libssp_simple.so' > /etc/ld.so.preload
* # emerge glibc
* # rm -f /lib/libssp_simple.so /etc/ld.so.preload
*/
#include <syslog.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/sysctl.h>
unsigned long __guard = 0UL; static void __guard_setup(void) __attribute__ ((constructor));
void __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
static void __guard_setup(void) { if (__guard != 0UL) return; __guard = 0xFF0A0D00UL; }
void __stack_smash_handler(char func[], int damaged) {
syslog(LOG_CRIT, "stack overflow in function %s(); %s=%p __guard_setup=%p __guard=%p " \
"PPID=%d PID=%d UID=%d EUID=%d GID=%d EGID=%d",
func, func, __guard_setup, __guard,
getppid(), getpid(), getuid(), geteuid(), getgid(), getegid());
_exit(127);
}

View File

@@ -0,0 +1,311 @@
/* Copyright (C) 2005 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
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Copyright (C) 2006 Gentoo Foundation Inc.
* License terms as above.
*
* Hardened Gentoo SSP handler
*
* An SSP failure handler that does not use functions from the rest of
* glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
* no possibility of recursion into the handler.
*
* Direct all bug reports to http://bugs.gentoo.org/
*
* Re-written from the glibc-2.3 Hardened Gentoo SSP handler
* by Kevin F. Quinn - <kevquinn[@]gentoo.org>
*
* The following people contributed to the glibc-2.3 Hardened
* Gentoo SSP handler, from which this implementation draws much:
*
* Ned Ludd - <solar[@]gentoo.org>
* Alexander Gabert - <pappy[@]gentoo.org>
* The PaX Team - <pageexec[@]freemail.hu>
* Peter S. Mazinger - <ps.m[@]gmx.net>
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
* Robert Connolly - <robert[@]linuxfromscratch.org>
* Cory Visi <cory[@]visi.name>
* Mike Frysinger <vapier[@]gentoo.org>
*/
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sysdep-cancel.h>
#include <sys/syscall.h>
#include <bp-checks.h>
#include <kernel-features.h>
#include <alloca.h>
/* from sysdeps */
#include <socketcall.h>
/* for the stuff in bits/socket.h */
#include <sys/socket.h>
#include <sys/un.h>
/* Sanity check on SYSCALL macro names - force compilation
* failure if the names used here do not exist
*/
#if !defined __NR_socketcall && !defined __NR_socket
# error Cannot do syscall socket or socketcall
#endif
#if !defined __NR_socketcall && !defined __NR_connect
# error Cannot do syscall connect or socketcall
#endif
#ifndef __NR_write
# error Cannot do syscall write
#endif
#ifndef __NR_close
# error Cannot do syscall close
#endif
#ifndef __NR_getpid
# error Cannot do syscall getpid
#endif
#ifndef __NR_kill
# error Cannot do syscall kill
#endif
#ifndef __NR_exit
# error Cannot do syscall exit
#endif
#ifdef SSP_SMASH_DUMPS_CORE
# if !defined _KERNEL_NSIG && !defined _NSIG
# error No _NSIG or _KERNEL_NSIG for rt_sigaction
# endif
# if !defined __NR_sigation && !defined __NR_rt_sigaction
# error Cannot do syscall sigaction or rt_sigaction
# endif
#endif
/* Define DO_SOCKET/DO_CONNECT macros to deal with socketcall vs socket/connect */
#ifdef __NR_socketcall
# define DO_SOCKET(result,domain,type,protocol) \
{socketargs[0] = domain; \
socketargs[1] = type; \
socketargs[2] = protocol; \
socketargs[3] = 0; \
result = INLINE_SYSCALL(socketcall,2,SOCKOP_socket,socketargs);}
# define DO_CONNECT(result,sockfd,serv_addr,addrlen) \
{socketargs[0] = sockfd; \
socketargs[1] = (unsigned long int)serv_addr; \
socketargs[2] = addrlen; \
socketargs[3] = 0; \
result = INLINE_SYSCALL(socketcall,2,SOCKOP_connect,socketargs);}
#else
# define DO_SOCKET(result,domain,type,protocol) \
{result = INLINE_SYSCALL(socket,3,domain,type,protocol);}
# define DO_CONNECT(result,sockfd,serv_addr,addrlen) \
{result = INLINE_SYSCALL(connect,3,sockfd,serv_addr,addrlen);}
#endif
/* __NR_socketcall */
#ifndef _PATH_LOG
# define _PATH_LOG "/dev/log"
#endif
static const char path_log[]=_PATH_LOG;
/* For building glibc with SSP switched on, define __progname to a
* constant if building for the run-time loader, to avoid pulling
* in more of libc.so into ld.so
*/
#ifdef IS_IN_rtld
static char *__progname = "<rtld>";
#else
extern char *__progname;
#endif
/* Common handler code, used by stack_chk_fail and __stack_smash_handler
* Inlined to ensure no self-references to the handler within itself.
* Data static to avoid putting more than necessary on the stack,
* to aid core debugging.
*/
static inline void
__attribute__ ((__noreturn__ , __always_inline__))
__hardened_gentoo_stack_chk_fail (char func[], int damaged)
{
#define MESSAGE_BUFSIZ 256
static pid_t pid;
static int plen, i;
static char message[MESSAGE_BUFSIZ];
static const char msg_ssa[]=": stack smashing attack";
static const char msg_inf[]=" in function ";
static const char msg_ssd[]="*** stack smashing detected ***: ";
static const char msg_terminated[]=" - terminated\n";
static const char msg_report[]="Report to http://bugs.gentoo.org/\n";
static const char msg_unknown[]="<unknown>";
#ifdef SSP_SMASH_DUMPS_CORE
static struct sigaction default_abort_act;
#endif
static int log_socket, connect_result;
static struct sockaddr_un sock;
#ifdef __NR_socketcall
static unsigned long int socketargs[4];
#endif
/* Build socket address
*/
sock.sun_family = AF_UNIX;
i=0;
while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1)))
{
sock.sun_path[i]=path_log[i];
i++;
}
sock.sun_path[i]='\0';
/* Try SOCK_DGRAM connection to syslog */
connect_result=-1;
DO_SOCKET(log_socket,AF_UNIX,SOCK_DGRAM,0);
if (log_socket != -1)
DO_CONNECT(connect_result,log_socket,(&sock),(sizeof(sock)));
if (connect_result == -1)
{
if (log_socket != -1)
INLINE_SYSCALL(close,1,log_socket);
/* Try SOCK_STREAM connection to syslog */
DO_SOCKET(log_socket,AF_UNIX,SOCK_STREAM,0);
if (log_socket != -1)
DO_CONNECT(connect_result,log_socket,(&sock),(sizeof(sock)));
}
/* Build message. Messages are generated both in the old style and new style,
* so that log watchers that are configured for the old-style message continue
* to work.
*/
#define strconcat(str) \
{i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
{\
message[plen+i]=str[i];\
i++;\
}\
plen+=i;}
/* R.Henderson post-gcc-4 style message */
plen=0;
strconcat(msg_ssd);
if (__progname != (char *)0)
strconcat(__progname)
else
strconcat(msg_unknown);
strconcat(msg_terminated);
/* Write out error message to STDERR, to syslog if open */
INLINE_SYSCALL(write,3,STDERR_FILENO,message,plen);
if (connect_result != -1)
INLINE_SYSCALL(write,3,log_socket,message,plen);
/* Dr. Etoh pre-gcc-4 style message */
plen=0;
if (__progname != (char *)0)
strconcat(__progname)
else
strconcat(msg_unknown);
strconcat(msg_ssa);
strconcat(msg_inf);
if (func!=NULL)
strconcat(func)
else
strconcat(msg_unknown);
strconcat(msg_terminated);
/* Write out error message to STDERR, to syslog if open */
INLINE_SYSCALL(write,3,STDERR_FILENO,message,plen);
if (connect_result != -1)
INLINE_SYSCALL(write,3,log_socket,message,plen);
/* Direct reports to bugs.gentoo.org */
plen=0;
strconcat(msg_report);
message[plen++]='\0';
/* Write out error message to STDERR, to syslog if open */
INLINE_SYSCALL(write,3,STDERR_FILENO,message,plen);
if (connect_result != -1)
INLINE_SYSCALL(write,3,log_socket,message,plen);
if (log_socket != -1)
INLINE_SYSCALL(close,1,log_socket);
/* Suicide */
pid=INLINE_SYSCALL(getpid,0);
#ifdef SSP_SMASH_DUMPS_CORE
/* Remove any user-supplied handler for SIGABRT, before using it */
default_abort_act.sa_handler = SIG_DFL;
default_abort_act.sa_sigaction = NULL;
__sigfillset(&default_abort_act.sa_mask);
default_abort_act.sa_flags = 0;
/* sigaction doesn't exist on amd64; however rt_sigaction seems to
* exist everywhere. rt_sigaction has an extra parameter - the
* size of sigset_t.
*/
# ifdef __NR_sigation
if (INLINE_SYSCALL(sigaction,3,SIGABRT,&default_abort_act,NULL) == 0)
# else
/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
* of the _kernel_ sigset_t which is not the same as the user sigset_t.
* Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
* some reason.
*/
# ifdef _KERNEL_NSIG
if (INLINE_SYSCALL(rt_sigaction,4,SIGABRT,&default_abort_act,NULL,_KERNEL_NSIG/8) == 0)
# else
if (INLINE_SYSCALL(rt_sigaction,4,SIGABRT,&default_abort_act,NULL,_NSIG/8) == 0)
# endif
# endif
INLINE_SYSCALL(kill,2,pid,SIGABRT);
#endif
/* Note; actions cannot be added to SIGKILL */
INLINE_SYSCALL(kill,2,pid,SIGKILL);
/* In case the kill didn't work, exit anyway
* The loop prevents gcc thinking this routine returns
*/
while (1) INLINE_SYSCALL(exit,0);
}
void
__attribute__ ((__noreturn__))
__stack_chk_fail (void)
{
__hardened_gentoo_stack_chk_fail(NULL,0);
}
#ifdef ENABLE_OLD_SSP_COMPAT
void
__attribute__ ((__noreturn__))
__stack_smash_handler(char func[], int damaged)
{
__hardened_gentoo_stack_chk_fail(func,damaged);
}
#endif

View File

@@ -0,0 +1,29 @@
Prevent default-fPIE from confusing configure into thinking
PIC code is default. This causes glibc to build both PIC and
non-PIC code as normal, which on the hardened compiler generates
PIC and PIE.
Patch by Kevin F. Quinn <kevquinn@gentoo.org>
--- configure.in
+++ configure.in
@@ -2145,7 +2145,7 @@
# error PIC is default.
#endif
EOF
-if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
+if eval "${CC-cc} -fno-PIE -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
pic_default=no
fi
rm -f conftest.*])
--- configure
+++ configure
@@ -7698,7 +7698,7 @@
# error PIC is default.
#endif
EOF
-if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
+if eval "${CC-cc} -fno-PIE -S conftest.c 2>&5 1>&5"; then
pic_default=no
fi
rm -f conftest.*

View File

@@ -0,0 +1,283 @@
When building glibc PIE (which is not something upstream support),
several modifications are necessary to the glibc build process.
First, any syscalls in PIEs must be of the PIC variant, otherwise
textrels ensue. Then, any syscalls made before the initialisation
of the TLS will fail on i386, as the sysenter variant on i386 uses
the TLS, giving rise to a chicken-and-egg situation. This patch
defines a PIC syscall variant that doesn't use sysenter, even when the sysenter
version is normally used, and uses the non-sysenter version for the brk
syscall that is performed by the TLS initialisation. Further, the TLS
initialisation is moved in this case prior to the initialisation of
dl_osversion, as that requires further syscalls.
csu/libc-start.c: Move initial TLS initialization to before the
initialisation of dl_osversion, when INTERNAL_SYSCALL_NOSYSENTER is defined
csu/libc-tls.c: Use the no-sysenter version of sbrk when
INTERNAL_SYSCALL_NOSYSENTER is defined.
misc/sbrk.c: Define a no-sysenter version of sbrk, using the no-sysenter
version of brk - if INTERNAL_SYSCALL_NOSYSENTER is defined.
misc/brk.c: Define a no-sysenter version of brk if
INTERNAL_SYSCALL_NOSYSENTER is defined.
sysdeps/unix/sysv/linux/i386/sysdep.h: Define INTERNAL_SYSCALL_NOSYSENTER
Make INTERNAL_SYSCALL always use the PIC variant, even if not SHARED.
Patch by Kevin F. Quinn <kevquinn@gentoo.org>
--- csu/libc-start.c.orig 2007-01-21 11:51:06.000000000 +0100
+++ csu/libc-start.c 2007-01-21 11:55:57.000000000 +0100
@@ -28,6 +28,7 @@
extern int __libc_multiple_libcs;
#include <tls.h>
+#include <sysdep.h>
#ifndef SHARED
# include <dl-osinfo.h>
extern void __pthread_initialize_minimal (void)
@@ -133,6 +134,14 @@
# endif
_dl_aux_init (auxvec);
# endif
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
+ /* Do the initial TLS initialization before _dl_osversion,
+ since the latter uses the uname syscall. */
+# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
+ if (__pthread_initialize_minimal)
+# endif
+ __pthread_initialize_minimal ();
+# endif
# ifdef DL_SYSDEP_OSCHECK
if (!__libc_multiple_libcs)
{
@@ -142,15 +151,17 @@
}
# endif
+# ifndef INTERNAL_SYSCALL_NOSYSENTER
/* Initialize the thread library at least a bit since the libgcc
functions are using thread functions if these are available and
we need to setup errno. If there is no thread library and we
handle TLS the function is defined in the libc to initialized the
TLS handling. */
-# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
+# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
if (__pthread_initialize_minimal)
-# endif
+# endif
__pthread_initialize_minimal ();
+# endif
#endif
# ifndef SHARED
--- csu/libc-tls.c.orig 2007-01-21 11:37:02.000000000 +0100
+++ csu/libc-tls.c 2007-01-21 12:09:33.000000000 +0100
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/param.h>
+#include <sysdep.h>
#ifdef SHARED
@@ -30,6 +31,9 @@
#endif
#ifdef USE_TLS
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
+extern void *__sbrk_nosysenter (intptr_t __delta);
+# endif
extern ElfW(Phdr) *_dl_phdr;
extern size_t _dl_phnum;
@@ -142,14 +146,26 @@
The initialized value of _dl_tls_static_size is provided by dl-open.c
to request some surplus that permits dynamic loading of modules with
- IE-model TLS. */
+ IE-model TLS.
+
+ Where the normal sbrk would use a syscall that needs the TLS (i386)
+ use the special non-sysenter version instead. */
# if TLS_TCB_AT_TP
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
+ tlsblock = __sbrk_nosysenter (tcb_offset + tcbsize + max_align);
+# else
tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
+# endif
# elif TLS_DTV_AT_TP
tcb_offset = roundup (tcbsize, align ?: 1);
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
+ tlsblock = __sbrk_nosysenter (tcb_offset + memsz + max_align
+ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
+# else
tlsblock = __sbrk (tcb_offset + memsz + max_align
+ TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
+# endif
tlsblock += TLS_PRE_TCB_SIZE;
# else
/* In case a model with a different layout for the TCB and DTV
--- misc/sbrk.c.orig 2007-01-21 11:38:27.000000000 +0100
+++ misc/sbrk.c 2007-01-21 12:07:29.000000000 +0100
@@ -18,6 +18,7 @@
#include <unistd.h>
#include <errno.h>
+#include <sysdep.h>
/* Defined in brk.c. */
extern void *__curbrk;
@@ -29,6 +30,35 @@
/* Extend the process's data space by INCREMENT.
If INCREMENT is negative, shrink data space by - INCREMENT.
Return start of new space allocated, or -1 for errors. */
+#ifdef INTERNAL_SYSCALL_NOSYSENTER
+/* This version is used by csu/libc-tls.c whem initialising the TLS
+ if the SYSENTER version requires the TLS (which it does on i386).
+ Obviously using the TLS before it is initialised is broken. */
+extern int __brk_nosysenter (void *addr);
+void *
+__sbrk_nosysenter (intptr_t increment)
+{
+ void *oldbrk;
+
+ /* If this is not part of the dynamic library or the library is used
+ via dynamic loading in a statically linked program update
+ __curbrk from the kernel's brk value. That way two separate
+ instances of __brk and __sbrk can share the heap, returning
+ interleaved pieces of it. */
+ if (__curbrk == NULL || __libc_multiple_libcs)
+ if (__brk_nosysenter (0) < 0) /* Initialize the break. */
+ return (void *) -1;
+
+ if (increment == 0)
+ return __curbrk;
+
+ oldbrk = __curbrk;
+ if (__brk_nosysenter (oldbrk + increment) < 0)
+ return (void *) -1;
+
+ return oldbrk;
+}
+#endif
void *
__sbrk (intptr_t increment)
{
--- sysdeps/unix/sysv/linux/i386/brk.c.orig 2007-01-21 11:39:16.000000000 +0100
+++ sysdeps/unix/sysv/linux/i386/brk.c 2007-01-21 11:44:01.000000000 +0100
@@ -31,6 +31,30 @@
linker. */
weak_alias (__curbrk, ___brk_addr)
+#ifdef INTERNAL_SYSCALL_NOSYSENTER
+/* This version is used by csu/libc-tls.c whem initialising the TLS
+ * if the SYSENTER version requires the TLS (which it does on i386).
+ * Obviously using the TLS before it is initialised is broken. */
+int
+__brk_nosysenter (void *addr)
+{
+ void *__unbounded newbrk;
+
+ INTERNAL_SYSCALL_DECL (err);
+ newbrk = (void *__unbounded) INTERNAL_SYSCALL_NOSYSENTER (brk, err, 1,
+ __ptrvalue (addr));
+
+ __curbrk = newbrk;
+
+ if (newbrk < addr)
+ {
+ __set_errno (ENOMEM);
+ return -1;
+ }
+
+ return 0;
+}
+#endif
int
__brk (void *addr)
{
--- sysdeps/unix/sysv/linux/i386/sysdep.h.orig 2007-01-21 13:08:00.000000000 +0100
+++ sysdeps/unix/sysv/linux/i386/sysdep.h 2007-01-21 13:19:10.000000000 +0100
@@ -187,7 +187,7 @@
/* The original calling convention for system calls on Linux/i386 is
to use int $0x80. */
#ifdef I386_USE_SYSENTER
-# ifdef SHARED
+# if defined SHARED || defined __PIC__
# define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
# else
# define ENTER_KERNEL call *_dl_sysinfo
@@ -358,7 +358,7 @@
possible to use more than four parameters. */
#undef INTERNAL_SYSCALL
#ifdef I386_USE_SYSENTER
-# ifdef SHARED
+# if defined SHARED || defined __PIC__
# define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
@@ -384,6 +384,18 @@
: "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
+# define INTERNAL_SYSCALL_NOSYSENTER(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+ EXTRAVAR_##nr \
+ asm volatile ( \
+ LOADARGS_NOSYSENTER_##nr \
+ "movl %1, %%eax\n\t" \
+ "int $0x80\n\t" \
+ RESTOREARGS_NOSYSENTER_##nr \
+ : "=a" (resultvar) \
+ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
# else
# define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \
@@ -447,12 +459,20 @@
#define LOADARGS_0
#ifdef __PIC__
-# if defined I386_USE_SYSENTER && defined SHARED
+# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
# define LOADARGS_1 \
"bpushl .L__X'%k3, %k3\n\t"
# define LOADARGS_5 \
"movl %%ebx, %4\n\t" \
"movl %3, %%ebx\n\t"
+# define LOADARGS_NOSYSENTER_1 \
+ "bpushl .L__X'%k2, %k2\n\t"
+# define LOADARGS_NOSYSENTER_2 LOADARGS_NOSYSENTER_1
+# define LOADARGS_NOSYSENTER_3 LOADARGS_3
+# define LOADARGS_NOSYSENTER_4 LOADARGS_3
+# define LOADARGS_NOSYSENTER_5 \
+ "movl %%ebx, %3\n\t" \
+ "movl %2, %%ebx\n\t"
# else
# define LOADARGS_1 \
"bpushl .L__X'%k2, %k2\n\t"
@@ -474,11 +495,18 @@
#define RESTOREARGS_0
#ifdef __PIC__
-# if defined I386_USE_SYSENTER && defined SHARED
+# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
# define RESTOREARGS_1 \
"bpopl .L__X'%k3, %k3\n\t"
# define RESTOREARGS_5 \
"movl %4, %%ebx"
+# define RESTOREARGS_NOSYSENTER_1 \
+ "bpopl .L__X'%k2, %k2\n\t"
+# define RESTOREARGS_NOSYSENTER_2 RESTOREARGS_NOSYSENTER_1
+# define RESTOREARGS_NOSYSENTER_3 RESTOREARGS_3
+# define RESTOREARGS_NOSYSENTER_4 RESTOREARGS_3
+# define RESTOREARGS_NOSYSENTER_5 \
+ "movl %3, %%ebx"
# else
# define RESTOREARGS_1 \
"bpopl .L__X'%k2, %k2\n\t"

Some files were not shown because too many files have changed in this diff Show More