aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2011-03-09 04:13:11 -0600
committerWilliam Pitcock <nenolod@dereferenced.org>2011-03-09 04:13:53 -0600
commita8123f02490a781c48183875ba84fb4b080cb0dd (patch)
treec34e0a9aa493627cf77c9523e3646f132944a304
parent59c4f7e78005a85f98da8b3ec2ef2bb27b4ea9f1 (diff)
downloadaports-a8123f02490a781c48183875ba84fb4b080cb0dd.tar.bz2
aports-a8123f02490a781c48183875ba84fb4b080cb0dd.tar.xz
main/libc0.9.32: import git revision 82098ab9b853c33ee8ade61c9510b295cc696de1
-rw-r--r--main/libc0.9.32/APKBUILD6
-rw-r--r--main/libc0.9.32/config-has-fortify.patch125
-rw-r--r--main/libc0.9.32/ssp.patch27
3 files changed, 128 insertions, 30 deletions
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
index 7e5d8d82a3..2593caa31b 100644
--- a/main/libc0.9.32/APKBUILD
+++ b/main/libc0.9.32/APKBUILD
@@ -4,7 +4,7 @@ pkgname=libc$_abiver
_gitver=
pkgver=0.9.32_rc2
_ver=${pkgver/_/-}
-pkgrel=2
+pkgrel=3
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@@ -20,7 +20,7 @@ _snapurl="http://git.uclibc.org/uClibc/snapshot/master.tar.bz2"
_snapfile="$pkgname-$pkgver.tar.bz2"
source="http://uclibc.org/downloads/uClibc-${_ver}.tar.bz2
compat-stack-guard.patch
- ssp.patch
+ config-has-fortify.patch
pthread.patch
0001-libm-x86_64-implement-fesetround.patch
arm-nptl-tls.patch
@@ -120,7 +120,7 @@ libthread_db() {
md5sums="c8d2cd2c4dbcf5218b6db843cf66ac0f uClibc-0.9.32-rc2.tar.bz2
4d408f72142ce55a0754948cc9cfe447 compat-stack-guard.patch
-6401044fb02f80c5e50a568d2948a5d7 ssp.patch
+fb349592e75c25aa03461740a7929ee5 config-has-fortify.patch
c92ab246b4f92487c98938a297208829 pthread.patch
e0c901502602f7e9e002d910d0f32ab9 0001-libm-x86_64-implement-fesetround.patch
2b4e27207b15e2d4b3e9b853513634f6 arm-nptl-tls.patch
diff --git a/main/libc0.9.32/config-has-fortify.patch b/main/libc0.9.32/config-has-fortify.patch
new file mode 100644
index 0000000000..01e26e7e12
--- /dev/null
+++ b/main/libc0.9.32/config-has-fortify.patch
@@ -0,0 +1,125 @@
+From 82098ab9b853c33ee8ade61c9510b295cc696de1 Mon Sep 17 00:00:00 2001
+From: Peter S. Mazinger <ps.m@gmx.net>
+Date: Wed, 09 Mar 2011 08:23:48 +0000
+Subject: guard *_chk() related stuff with UCLIBC_HAS_FORTIFY
+
+Guard x86_64 memset_chk/memcpy_chk be guarded by UCLIBC_HAS_FORTIFY.
+Compile ssp.c if one of SSP/FORTIFY is defined.
+Guard __chk_fail() with UCLIBC_HAS_FORTIFY and move its prototype to libc-internal.h.
+Disable _FORTIFY_SOURCE if UCLIBC_HAS_FORTIFY is not set.
+
+The config option itself is omitted on purpose,
+headers need to be reviewed and generic *_chk() functions need to be first provided.
+
+Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
+---
+diff --git a/include/features.h b/include/features.h
+index f4d70d7..41e83a9 100644
+--- a/include/features.h
++++ b/include/features.h
+@@ -198,9 +198,12 @@
+ # define __OPTIMIZE_SIZE__ 1
+
+ /* disable unsupported features */
+-# undef _FORTIFY_SOURCE
+ # undef __LDBL_COMPAT
+
++# ifndef __UCLIBC_HAS_FORTIFY__
++# undef _FORTIFY_SOURCE
++# endif
++
+ # ifndef __UCLIBC_HAS_THREADS__
+ # if defined _REENTRANT || defined _THREAD_SAFE
+ # warning requested reentrant code, but thread support was disabled
+diff --git a/include/libc-internal.h b/include/libc-internal.h
+index 443b1fc..3ac0b05 100644
+--- a/include/libc-internal.h
++++ b/include/libc-internal.h
+@@ -65,6 +65,11 @@ libc_hidden_proto(__glibc_strerror_r)
+ /* internal access to program name */
+ extern const char *__uclibc_progname attribute_hidden;
+
++# ifdef __UCLIBC_HAS_FORTIFY__
++extern void __chk_fail(void) attribute_noreturn;
++libc_hidden_proto(__chk_fail)
++# endif
++
+ # endif /* IS_IN_libc */
+
+ #endif /* __ASSEMBLER__ */
+diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S
+index 6d941e0..9c8169b 100644
+--- a/libc/string/x86_64/memcpy.S
++++ b/libc/string/x86_64/memcpy.S
+@@ -26,12 +26,10 @@
+ #define MEMPCPY_P (defined memcpy)
+
+ .text
+-#if defined __PIC__ && !defined NOT_IN_libc
++#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__
+ ENTRY (__memcpy_chk)
+ cmpq %rdx, %rcx
+-#if defined __UCLIBC_HAS_SSP__
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+-#endif
+ END (__memcpy_chk)
+ #endif
+ ENTRY (BP_SYM (memcpy))
+diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S
+index df265f3..6b758ce 100644
+--- a/libc/string/x86_64/memset.S
++++ b/libc/string/x86_64/memset.S
+@@ -29,12 +29,10 @@
+ #define LARGE $120000
+
+ .text
+-#if defined __PIC__ && !defined NOT_IN_libc
++#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__
+ ENTRY (__memset_chk)
+ cmpq %rdx, %rcx
+-#if defined __UCLIBC_HAS_SSP__
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+-#endif
+ END (__memset_chk)
+ #endif
+ ENTRY (memset)
+@@ -144,6 +142,6 @@ END (memset)
+ libc_hidden_def(memset)
+ #endif
+
+-#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc
++#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__
+ strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
+ #endif
+diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
+index d81c706..df242cc 100644
+--- a/libc/sysdeps/linux/common/ssp.c
++++ b/libc/sysdeps/linux/common/ssp.c
+@@ -87,6 +87,7 @@ void __stack_smash_handler(char func[], int damaged)
+ }
+ #endif
+
++#ifdef __UCLIBC_HAS_SSP__
+ void __stack_chk_fail(void) attribute_noreturn __cold;
+ void __stack_chk_fail(void)
+ {
+@@ -101,8 +102,9 @@ void __stack_chk_fail(void)
+ while(1)
+ terminate();
+ }
++#endif
+
+-void __chk_fail(void) attribute_noreturn;
++#ifdef __UCLIBC_HAS_FORTIFY__
+ void __chk_fail(void)
+ {
+ static const char msg1[] = "buffer overflow detected: ";
+@@ -116,4 +119,6 @@ void __chk_fail(void)
+ while(1)
+ terminate();
+ }
++libc_hidden_def(__chk_fail)
++#endif
+
+--
+cgit v0.8.2.1
diff --git a/main/libc0.9.32/ssp.patch b/main/libc0.9.32/ssp.patch
deleted file mode 100644
index f0f75a7d85..0000000000
--- a/main/libc0.9.32/ssp.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- uClibc-0.9.32-rc2/libc/sysdeps/linux/common/ssp.c
-+++ uClibc-0.9.32-rc2.mod/libc/sysdeps/linux/common/ssp.c
-@@ -86,6 +86,7 @@
- }
-
- void __stack_chk_fail(void) attribute_noreturn __cold;
-+libc_hidden_proto(__stack_chk_fail)
- void __stack_chk_fail(void)
- {
- static const char msg1[] = "stack smashing detected: ";
-@@ -99,8 +100,10 @@
- while(1)
- terminate();
- }
-+libc_hidden_def(__stack_chk_fail)
-
- void __chk_fail(void) attribute_noreturn;
-+libc_hidden_proto(__chk_fail)
- void __chk_fail(void)
- {
- static const char msg1[] = "buffer overflow detected: ";
-@@ -114,4 +117,5 @@
- while(1)
- terminate();
- }
-+libc_hidden_def(__chk_fail)
-