diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2009-05-16 22:38:22 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2009-05-16 22:38:22 +0000 |
commit | 8394b52f4259c85b39e1114e6f239599f50fbcc2 (patch) | |
tree | 502ea02891b8fad16d4bdfe18d8fd803acfc33c6 /ports/sysdeps | |
parent | 5b818e69bce954be61aeebb12d111006ce13c0eb (diff) | |
download | eglibc2-8394b52f4259c85b39e1114e6f239599f50fbcc2.tar.gz |
Merge changes between r8459 and r8463 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8464 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'ports/sysdeps')
-rw-r--r-- | ports/sysdeps/arm/____longjmp_chk.S | 55 | ||||
-rw-r--r-- | ports/sysdeps/arm/__longjmp.S | 6 | ||||
-rw-r--r-- | ports/sysdeps/arm/eabi/__longjmp.S | 6 | ||||
-rw-r--r-- | ports/sysdeps/mips/____longjmp_chk.c | 22 | ||||
-rw-r--r-- | ports/sysdeps/mips/__longjmp.c | 9 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/__longjmp.c | 9 | ||||
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/arm/kernel-features.h | 2 | ||||
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/m68k/Versions | 3 | ||||
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c | 34 | ||||
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c | 34 | ||||
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c | 1 | ||||
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c | 1 |
12 files changed, 172 insertions, 10 deletions
diff --git a/ports/sysdeps/arm/____longjmp_chk.S b/ports/sysdeps/arm/____longjmp_chk.S new file mode 100644 index 000000000..9b65c368a --- /dev/null +++ b/ports/sysdeps/arm/____longjmp_chk.S @@ -0,0 +1,55 @@ +/* Copyright (C) 2009 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 General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + + + .section .rodata.str1.1,"aMS",%progbits,1 + .type longjmp_msg,%object +longjmp_msg: + .string "longjmp causes uninitialized stack frame" + .size longjmp_msg, .-longjmp_msg + .text + +#define __longjmp ____longjmp_chk + +#ifdef PIC +# define CALL_FAIL \ + ldr sl, .L_GOT; \ +.L_GOT_OFF: \ + add sl, pc, sl; \ + ldr r0, .Lstr; \ + add r0, sl, r0; \ + B PLTJMP(HIDDEN_JUMPTARGET(__fortify_fail)); \ +.L_GOT: \ + .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8); \ +.Lstr: \ + .word longjmp_msg(GOTOFF); +#else +# define CALL_FAIL \ + ldr r0, .Lstr; \ + B HIDDEN_JUMPTARGET(__fortify_fail); \ +.Lstr: \ + .word longjmp_msg; +#endif + +#define CHECK_SP(reg) \ + cmp sp, reg; \ + ble .Lok; \ + CALL_FAIL \ +.Lok: + +#include <__longjmp.S> diff --git a/ports/sysdeps/arm/__longjmp.S b/ports/sysdeps/arm/__longjmp.S index 7b3016004..c834e7860 100644 --- a/ports/sysdeps/arm/__longjmp.S +++ b/ports/sysdeps/arm/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for ARM. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2009 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 @@ -29,5 +29,9 @@ ENTRY (__longjmp) movs r0, r1 /* get the return value in place */ moveq r0, #1 /* can't let setjmp() return zero! */ +#ifdef CHECK_SP + ldr r1, [ip, #32] + CHECK_SP (r1) +#endif LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc}) END (__longjmp) diff --git a/ports/sysdeps/arm/eabi/__longjmp.S b/ports/sysdeps/arm/eabi/__longjmp.S index fff25cd94..1f3f79156 100644 --- a/ports/sysdeps/arm/eabi/__longjmp.S +++ b/ports/sysdeps/arm/eabi/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for ARM. - Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2005, 2006, 2009 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 @@ -30,6 +30,10 @@ ENTRY (__longjmp) movs r0, r1 /* get the return value in place */ moveq r0, #1 /* can't let setjmp() return zero! */ +#ifdef CHECK_SP + ldr r1, [ip, #32] + CHECK_SP (r1) +#endif LOADREGS(ia, ip!, {v1-v6, sl, fp, sp, lr}) #ifdef IS_IN_rtld diff --git a/ports/sysdeps/mips/____longjmp_chk.c b/ports/sysdeps/mips/____longjmp_chk.c new file mode 100644 index 000000000..a46ed150d --- /dev/null +++ b/ports/sysdeps/mips/____longjmp_chk.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2009 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 <stdio.h> +#define __longjmp ____longjmp_chk +#define CHECK_SP +#include <__longjmp.c> diff --git a/ports/sysdeps/mips/__longjmp.c b/ports/sysdeps/mips/__longjmp.c index 386c05625..340485de8 100644 --- a/ports/sysdeps/mips/__longjmp.c +++ b/ports/sysdeps/mips/__longjmp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1997, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1997, 2000, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). @@ -20,8 +20,6 @@ #include <setjmp.h> #include <stdlib.h> -#undef __longjmp - #ifndef __GNUC__ #error This file uses GNU C extensions; you must compile with GCC. #endif @@ -36,6 +34,11 @@ __longjmp (env, val_arg) Without this it saves $a1 in a register which gets clobbered along the way. */ register int val asm ("a1"); +#ifdef CHECK_SP + register long sp asm ("$29"); + if ((long) (env[0].__sp) < sp) + __fortify_fail ("longjmp causes uninitialized stack frame"); +#endif #ifdef __mips_hard_float /* Pull back the floating point callee-saved registers. */ diff --git a/ports/sysdeps/mips/mips64/__longjmp.c b/ports/sysdeps/mips/mips64/__longjmp.c index 973b078ae..d7e36ff68 100644 --- a/ports/sysdeps/mips/mips64/__longjmp.c +++ b/ports/sysdeps/mips/mips64/__longjmp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1997, 2000, 2003, 2004 +/* Copyright (C) 1992, 1995, 1997, 2000, 2003, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). @@ -22,8 +22,6 @@ #include <sgidefs.h> #include <stdlib.h> -#undef __longjmp - #ifndef __GNUC__ #error This file uses GNU C extensions; you must compile with GCC. #endif @@ -38,6 +36,11 @@ __longjmp (env, val_arg) Without this it saves $a1 in a register which gets clobbered along the way. */ register int val asm ("a1"); +#ifdef CHECK_SP + register long long sp asm ("$29"); + if ((long long) (env[0].__sp) < sp) + __fortify_fail ("longjmp causes uninitialized stack frame"); +#endif #ifdef __mips_hard_float /* Pull back the floating point callee-saved registers. */ diff --git a/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h b/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h index b33c96865..ea439d5a0 100644 --- a/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h +++ b/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h @@ -56,5 +56,3 @@ /* These syscalls are not implemented yet for ARM. */ #undef __ASSUME_PSELECT #undef __ASSUME_PPOLL -#undef __ASSUME_PREADV -#undef __ASSUME_PWRITEV diff --git a/ports/sysdeps/unix/sysv/linux/m68k/Versions b/ports/sysdeps/unix/sysv/linux/m68k/Versions index 0799bf310..5650f7f77 100644 --- a/ports/sysdeps/unix/sysv/linux/m68k/Versions +++ b/ports/sysdeps/unix/sysv/linux/m68k/Versions @@ -29,4 +29,7 @@ libc { # v* versionsort64; } + GLIBC_2.11 { + fallocate64; + } } diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c new file mode 100644 index 000000000..f973250de --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2007, 2009 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> + + +/* Reserve storage for the data of the file associated with FD. */ +int +fallocate (int fd, int mode, __off_t offset, __off_t len) +{ +#ifdef __NR_fallocate + return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len); +#else + __set_errno (ENOSYS); + return -1; +#endif +} diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c new file mode 100644 index 000000000..1f37f9121 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2007, 2009 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> + + +/* Reserve storage for the data of the file associated with FD. */ +int +fallocate64 (int fd, int mode, __off64_t offset, __off64_t len) +{ +#ifdef __NR_fallocate + return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len); +#else + __set_errno (ENOSYS); + return -1; +#endif +} diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c new file mode 100644 index 000000000..d3b72183c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/wordsize-64/fallocate.c> diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c new file mode 100644 index 000000000..fb2b6813a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c @@ -0,0 +1 @@ +/* fallocate64 is in fallocate.c */ |