Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src reinstate ssp:raw test, slightly differently.. this one is b...
details: https://anonhg.NetBSD.org/src/rev/7e584fd58644
branches: trunk
changeset: 766003:7e584fd58644
user: plunky <plunky%NetBSD.org@localhost>
date: Sun Jun 12 21:12:46 2011 +0000
description:
reinstate ssp:raw test, slightly differently.. this one is built
with -fstack-protector-all and tests that the compiler built in
stack protection works, by poking directly outside the buffer
diffstat:
distrib/sets/lists/tests/mi | 6 ++--
tests/lib/libc/ssp/Makefile | 5 +++-
tests/lib/libc/ssp/h_raw.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
tests/lib/libc/ssp/t_ssp.sh | 16 +++++++++++++-
4 files changed, 71 insertions(+), 5 deletions(-)
diffs (143 lines):
diff -r 32f88b6db2d3 -r 7e584fd58644 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Jun 12 20:38:10 2011 +0000
+++ b/distrib/sets/lists/tests/mi Sun Jun 12 21:12:46 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.349 2011/06/09 05:26:01 spz Exp $
+# $NetBSD: mi,v 1.350 2011/06/12 21:12:46 plunky Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -416,7 +416,7 @@
./usr/libdata/debug/usr/tests/lib/libc/ssp/h_memcpy.debug tests-lib-debug debug,atf,ssp
./usr/libdata/debug/usr/tests/lib/libc/ssp/h_memmove.debug tests-lib-debug debug,atf,ssp
./usr/libdata/debug/usr/tests/lib/libc/ssp/h_memset.debug tests-lib-debug debug,atf,ssp
-./usr/libdata/debug/usr/tests/lib/libc/ssp/h_raw.debug tests-obsolete obsolete
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_raw.debug tests-lib-debug debug,atf,ssp
./usr/libdata/debug/usr/tests/lib/libc/ssp/h_read.debug tests-lib-debug debug,atf,ssp
./usr/libdata/debug/usr/tests/lib/libc/ssp/h_readlink.debug tests-lib-debug debug,atf,ssp
./usr/libdata/debug/usr/tests/lib/libc/ssp/h_snprintf.debug tests-lib-debug debug,atf,ssp
@@ -1930,7 +1930,7 @@
./usr/tests/lib/libc/ssp/h_memcpy tests-lib-tests atf,ssp
./usr/tests/lib/libc/ssp/h_memmove tests-lib-tests atf,ssp
./usr/tests/lib/libc/ssp/h_memset tests-lib-tests atf,ssp
-./usr/tests/lib/libc/ssp/h_raw tests-obsolete obsolete
+./usr/tests/lib/libc/ssp/h_raw tests-lib-tests atf,ssp
./usr/tests/lib/libc/ssp/h_read tests-lib-tests atf,ssp
./usr/tests/lib/libc/ssp/h_readlink tests-lib-tests atf,ssp
./usr/tests/lib/libc/ssp/h_snprintf tests-lib-tests atf,ssp
diff -r 32f88b6db2d3 -r 7e584fd58644 tests/lib/libc/ssp/Makefile
--- a/tests/lib/libc/ssp/Makefile Sun Jun 12 20:38:10 2011 +0000
+++ b/tests/lib/libc/ssp/Makefile Sun Jun 12 21:12:46 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2011/06/12 19:22:01 plunky Exp $
+# $NetBSD: Makefile,v 1.4 2011/06/12 21:12:46 plunky Exp $
NOMAN= # defined
@@ -8,6 +8,8 @@
CPPFLAGS+= -D_FORTIFY_SOURCE=2
+COPTS.h_raw.c= -fstack-protector-all -Wstack-protector --param=ssp-buffer-size=1
+
# Bootstrap hack
.ifmake !clean && !obj && !cleandir
@@ -30,6 +32,7 @@
PROGS+= h_memcpy
PROGS+= h_memmove
PROGS+= h_memset
+PROGS+= h_raw
PROGS+= h_read
PROGS+= h_readlink
PROGS+= h_snprintf
diff -r 32f88b6db2d3 -r 7e584fd58644 tests/lib/libc/ssp/h_raw.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/ssp/h_raw.c Sun Jun 12 21:12:46 2011 +0000
@@ -0,0 +1,49 @@
+/* $NetBSD: h_raw.c,v 1.3 2011/06/12 21:12:46 plunky Exp $ */
+
+/*
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2011\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_raw.c,v 1.3 2011/06/12 21:12:46 plunky Exp $");
+
+#include <stdlib.h>
+
+static void
+poke(char *b, size_t index)
+{
+ b[index] = 'A';
+}
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+
+ poke(b, atoi(argv[1]));
+ return 0;
+}
diff -r 32f88b6db2d3 -r 7e584fd58644 tests/lib/libc/ssp/t_ssp.sh
--- a/tests/lib/libc/ssp/t_ssp.sh Sun Jun 12 20:38:10 2011 +0000
+++ b/tests/lib/libc/ssp/t_ssp.sh Sun Jun 12 21:12:46 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ssp.sh,v 1.4 2011/02/26 02:41:33 pgoyette Exp $
+# $NetBSD: t_ssp.sh,v 1.5 2011/06/12 21:12:46 plunky Exp $
#
# Copyright (c) 2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -206,6 +206,19 @@
h_fail "$prog 9"
}
+atf_test_case raw
+raw_head()
+{
+ atf_set "descr" "Checks raw array overflow"
+}
+raw_body()
+{
+ prog="$(atf_get_srcdir)/h_raw"
+
+ h_pass "$prog 9"
+ h_fail "$prog 10"
+}
+
atf_test_case read
read_head()
{
@@ -260,6 +273,7 @@
atf_add_test_case strcpy
atf_add_test_case strncat
atf_add_test_case strncpy
+ atf_add_test_case raw
atf_add_test_case read
atf_add_test_case readlink
atf_add_test_case getcwd
Home |
Main Index |
Thread Index |
Old Index