Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern void duplicate definition on statically linking lib...
details: https://anonhg.NetBSD.org/src/rev/3fb5c1f583b2
branches: trunk
changeset: 349312:3fb5c1f583b2
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 06 02:55:42 2016 +0000
description:
void duplicate definition on statically linking libc+ssp and rumpkern+ssp.
diffstat:
sys/kern/kern_ssp.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diffs (59 lines):
diff -r f4298f6795e9 -r 3fb5c1f583b2 sys/kern/kern_ssp.c
--- a/sys/kern/kern_ssp.c Tue Dec 06 01:23:01 2016 +0000
+++ b/sys/kern/kern_ssp.c Tue Dec 06 02:55:42 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ssp.c,v 1.6 2011/11/19 22:51:25 tls Exp $ */
+/* $NetBSD: kern_ssp.c,v 1.7 2016/12/06 02:55:42 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ssp.c,v 1.6 2011/11/19 22:51:25 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ssp.c,v 1.7 2016/12/06 02:55:42 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -35,11 +35,21 @@
#include <sys/cprng.h>
#if defined(__SSP__) || defined(__SSP_ALL__)
-long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
-void __stack_chk_fail(void);
+# ifdef _RUMPKERNEL
+__weak_alias(__stack_chk_guard, stack_chk_guard)
+__weak_alias(__stack_chk_fail, stack_chk_fail)
+# define SSP_STATIC static __used
+# else
+# define stack_chk_guard __stack_chk_guard
+# define stack_chk_fail __stack_chk_fail
+# define SSP_STATIC
+#endif
-void
-__stack_chk_fail(void)
+SSP_STATIC long stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0,};
+SSP_STATIC void stack_chk_fail(void);
+
+SSP_STATIC void
+stack_chk_fail(void)
{
panic("stack overflow detected; terminated");
}
@@ -56,12 +66,12 @@
* 2. without calling a function
*/
size_t i;
- long guard[__arraycount(__stack_chk_guard)];
+ long guard[__arraycount(stack_chk_guard)];
cprng_fast(guard, sizeof(guard));
s = splhigh();
for (i = 0; i < __arraycount(guard); i++)
- __stack_chk_guard[i] = guard[i];
+ stack_chk_guard[i] = guard[i];
splx(s);
for (i = 0; i < __arraycount(guard); i++)
aprint_debug("%lx ", guard[i]);
Home |
Main Index |
Thread Index |
Old Index