stack_protector.c (195152) | stack_protector.c (195697) |
---|---|
1/* $FreeBSD: head/lib/libc/sys/stack_protector.c 195152 2009-06-29 01:33:59Z kan $ */ | 1/* $FreeBSD: head/lib/libc/sys/stack_protector.c 195697 2009-07-14 21:19:13Z kan $ */ |
2/* $NetBSD: stack_protector.c,v 1.4 2006/11/22 17:23:25 christos Exp $ */ 3/* $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $ */ 4/* 5 * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 14 unchanged lines hidden (view full) --- 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 31#include <sys/cdefs.h> | 2/* $NetBSD: stack_protector.c,v 1.4 2006/11/22 17:23:25 christos Exp $ */ 3/* $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $ */ 4/* 5 * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 14 unchanged lines hidden (view full) --- 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/lib/libc/sys/stack_protector.c 195152 2009-06-29 01:33:59Z kan $"); | 32__FBSDID("$FreeBSD: head/lib/libc/sys/stack_protector.c 195697 2009-07-14 21:19:13Z kan $"); |
33 34#include <sys/param.h> 35#include <sys/sysctl.h> 36#include <sys/types.h> 37#include <signal.h> 38#include <string.h> 39#include <syslog.h> 40#include <unistd.h> 41 42extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, 43 void *newp, size_t newlen); 44 45long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; 46static void __guard_setup(void) __attribute__((__constructor__, __used__)); 47static void __fail(const char *); 48void __stack_chk_fail(void); 49void __chk_fail(void); | 33 34#include <sys/param.h> 35#include <sys/sysctl.h> 36#include <sys/types.h> 37#include <signal.h> 38#include <string.h> 39#include <syslog.h> 40#include <unistd.h> 41 42extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, 43 void *newp, size_t newlen); 44 45long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; 46static void __guard_setup(void) __attribute__((__constructor__, __used__)); 47static void __fail(const char *); 48void __stack_chk_fail(void); 49void __chk_fail(void); |
50void __stack_chk_fail_local(void); | |
51 52/*LINTED used*/ 53static void 54__guard_setup(void) 55{ 56 int mib[2]; 57 size_t len; 58 --- 45 unchanged lines hidden (view full) --- 104} 105 106void 107__chk_fail(void) 108{ 109 __fail("buffer overflow detected; terminated"); 110} 111 | 50 51/*LINTED used*/ 52static void 53__guard_setup(void) 54{ 55 int mib[2]; 56 size_t len; 57 --- 45 unchanged lines hidden (view full) --- 103} 104 105void 106__chk_fail(void) 107{ 108 __fail("buffer overflow detected; terminated"); 109} 110 |
112void 113__stack_chk_fail_local(void) 114{ 115 __stack_chk_fail(); 116} | 111__sym_compat(__stack_chk_fail_local, __stack_chk_fail, FBSD_1.0); |