CVS commit: src/share/man/man9
Module Name:src Committed By: jruoho Date: Fri Apr 8 06:55:14 UTC 2011 Modified Files: src/share/man/man9: roundup.9 Log Message: Put back the example (removed in the revision 1.3). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/roundup.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/roundup.9 diff -u src/share/man/man9/roundup.9:1.4 src/share/man/man9/roundup.9:1.5 --- src/share/man/man9/roundup.9:1.4 Mon Jan 24 10:22:15 2011 +++ src/share/man/man9/roundup.9 Fri Apr 8 06:55:14 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: roundup.9,v 1.4 2011/01/24 10:22:15 enami Exp $ +.\" $NetBSD: roundup.9,v 1.5 2011/04/08 06:55:14 jruoho Exp $ .\" .\" Copyright (c) 2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 8, 2010 +.Dd April 8, 2011 .Dt ROUNDUP 9 .Os .Sh NAME @@ -82,6 +82,17 @@ The behavior is undefined if .Fa size is 0. +.Sh EXAMPLES +The following example rounds the variable +.Va x +to a 32-bit boundary: +.Bd -literal -offset indent +uint16_t rx; + +\&... + +rx = roundup2(rx, sizeof(uint32_t)); +.Ed .Sh SEE ALSO .Xr ilog2 3 , .Xr imax 9
CVS commit: src
Module Name:src Committed By: jruoho Date: Fri Apr 8 06:49:21 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi src/tests/lib/libm: Makefile Added Files: src/tests/lib/libm: t_round.c Removed Files: src/tests/lib/libm: t_libm.c Log Message: Move the round(3) checks from 't_libm' to their own 't_round' for consistency. Add -Wfloat-equal and fix comparisons. To generate a diff of this commit: cvs rdiff -u -r1.299 -r1.300 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libm/Makefile cvs rdiff -u -r1.1 -r0 src/tests/lib/libm/t_libm.c cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_round.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.299 src/distrib/sets/lists/tests/mi:1.300 --- src/distrib/sets/lists/tests/mi:1.299 Thu Apr 7 17:38:02 2011 +++ src/distrib/sets/lists/tests/mi Fri Apr 8 06:49:20 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.299 2011/04/07 17:38:02 jruoho Exp $ +# $NetBSD: mi,v 1.300 2011/04/08 06:49:20 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -459,7 +459,8 @@ ./usr/libdata/debug/usr/tests/lib/libm tests-lib-debug ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libm/t_floor.debug tests-lib-debug debug,atf -./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug tests-lib-debug debug,atf +./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug tests-obsolete obsolete +./usr/libdata/debug/usr/tests/lib/libm/t_round.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libm/t_tanh.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libobjctests-lib-debug ./usr/libdata/debug/usr/tests/lib/libobjc/t_threads.debug tests-lib-debug debug,atf @@ -1942,7 +1943,8 @@ ./usr/tests/lib/libm/Atffile tests-lib-tests atf ./usr/tests/lib/libm/t_ceil tests-lib-tests atf ./usr/tests/lib/libm/t_floor tests-lib-tests atf -./usr/tests/lib/libm/t_libm tests-lib-tests atf +./usr/tests/lib/libm/t_libm tests-obsolete obsolete +./usr/tests/lib/libm/t_round tests-lib-tests atf ./usr/tests/lib/libm/t_tanh tests-lib-tests atf ./usr/tests/lib/libobjctests-lib-tests atf ./usr/tests/lib/libobjc/Atffile tests-lib-tests atf Index: src/tests/lib/libm/Makefile diff -u src/tests/lib/libm/Makefile:1.3 src/tests/lib/libm/Makefile:1.4 --- src/tests/lib/libm/Makefile:1.3 Wed Apr 6 09:35:49 2011 +++ src/tests/lib/libm/Makefile Fri Apr 8 06:49:21 2011 @@ -1,11 +1,12 @@ -# $NetBSD: Makefile,v 1.3 2011/04/06 09:35:49 jruoho Exp $ +# $NetBSD: Makefile,v 1.4 2011/04/08 06:49:21 jruoho Exp $ .include TESTSDIR= ${TESTSBASE}/lib/libm -TESTS_C+= t_ceil t_floor t_libm t_tanh +TESTS_C+= t_ceil t_floor t_round t_tanh LDADD+=-lm +COPTS+= -Wfloat-equal .include Added files: Index: src/tests/lib/libm/t_round.c diff -u /dev/null src/tests/lib/libm/t_round.c:1.1 --- /dev/null Fri Apr 8 06:49:21 2011 +++ src/tests/lib/libm/t_round.c Fri Apr 8 06:49:21 2011 @@ -0,0 +1,46 @@ +/* $NetBSD: t_round.c,v 1.1 2011/04/08 06:49:21 jruoho Exp $ */ + +#include +#include + +/* + * This tests for a bug in the initial implementation where + * precision was lost in an internal substraction, leading to + * rounding into the wrong direction. + */ + +/* 0.5 - EPSILON */ +#define VAL 0x0.7cp0 +#define VALF 0x0.7f8p0 + +ATF_TC(round_dir); +ATF_TC_HEAD(round_dir, tc) +{ + atf_tc_set_md_var(tc, "descr","Check for rounding in wrong direction"); +} + +ATF_TC_BODY(round_dir, tc) +{ + double a = VAL, b, c; + float af = VALF, bf, cf; + + b = round(a); + bf = roundf(af); + + ATF_REQUIRE(fabs(b) < 1.0e-40); + ATF_REQUIRE(fabsf(bf) < 1.0e-40); + + c = round(-a); + cf = roundf(-af); + + ATF_REQUIRE(fabs(c) < 1.0e-40); + ATF_REQUIRE(fabsf(cf) < 1.0e-40); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, round_dir); + + return atf_no_error(); +}
CVS commit: src/tests/lib
Module Name:src Committed By: jruoho Date: Fri Apr 8 06:37:51 UTC 2011 Modified Files: src/tests/lib/libc/stdlib: t_strtod.c src/tests/lib/libm: t_tanh.c Log Message: Fix build failure on VAX. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/stdlib/t_strtod.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libm/t_tanh.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/stdlib/t_strtod.c diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.3 src/tests/lib/libc/stdlib/t_strtod.c:1.4 --- src/tests/lib/libc/stdlib/t_strtod.c:1.3 Wed Apr 6 07:25:34 2011 +++ src/tests/lib/libc/stdlib/t_strtod.c Fri Apr 8 06:37:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_strtod.c,v 1.3 2011/04/06 07:25:34 jruoho Exp $ */ +/* $NetBSD: t_strtod.c,v 1.4 2011/04/08 06:37:51 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ /* Public domain, Otto Moerbeek , 2006. */ #include -__RCSID("$NetBSD: t_strtod.c,v 1.3 2011/04/06 07:25:34 jruoho Exp $"); +__RCSID("$NetBSD: t_strtod.c,v 1.4 2011/04/08 06:37:51 jruoho Exp $"); #include #include @@ -106,6 +106,12 @@ double d; float f; + d = 0.0; + f = 0.0; + ld = 0.0; + +#ifndef __vax__ + atf_tc_expect_fail("PR lib/33262"); d = strtod("INF", NULL); @@ -116,6 +122,7 @@ ld = strtold("INF", NULL); ATF_REQUIRE(isinf(ld) != 0); +#endif } ATF_TC(strtod_underflow); Index: src/tests/lib/libm/t_tanh.c diff -u src/tests/lib/libm/t_tanh.c:1.1 src/tests/lib/libm/t_tanh.c:1.2 --- src/tests/lib/libm/t_tanh.c:1.1 Wed Apr 6 09:35:49 2011 +++ src/tests/lib/libm/t_tanh.c Fri Apr 8 06:37:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tanh.c,v 1.1 2011/04/06 09:35:49 jruoho Exp $ */ +/* $NetBSD: t_tanh.c,v 1.2 2011/04/08 06:37:50 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_tanh.c,v 1.1 2011/04/06 09:35:49 jruoho Exp $"); +__RCSID("$NetBSD: t_tanh.c,v 1.2 2011/04/08 06:37:50 jruoho Exp $"); #include @@ -46,6 +46,10 @@ double d; float f; + d = 0.0; + f = 0.0; + +#ifndef __vax__ /* * PR lib/44057. */ @@ -54,6 +58,7 @@ ATF_REQUIRE(signbit(d) != 0); ATF_REQUIRE(signbit(f) != 0); +#endif } ATF_TP_ADD_TCS(tp)
CVS commit: src/tests/lib/libc
Module Name:src Committed By: jruoho Date: Thu Apr 7 18:14:10 UTC 2011 Modified Files: src/tests/lib/libc/gen: t_dir.c t_ldexp.c t_rbstress.c src/tests/lib/libc/ieeefp: t_subnormal.c src/tests/lib/libc/net: h_protoent.c h_servent.c src/tests/lib/libc/string: t_memcpy.c src/tests/lib/libc/time: t_mktime.c Log Message: Remove the following (literal) text in the TNF copyrights: * This code is derived from software contributed to The NetBSD Foundation * by * XXX: If these originated from you and you want your name to be mentioned, please add it. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/gen/t_dir.c \ src/tests/lib/libc/gen/t_rbstress.c cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/t_ldexp.c cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/ieeefp/t_subnormal.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/h_protoent.c \ src/tests/lib/libc/net/h_servent.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/string/t_memcpy.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/time/t_mktime.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/gen/t_dir.c diff -u src/tests/lib/libc/gen/t_dir.c:1.1 src/tests/lib/libc/gen/t_dir.c:1.2 --- src/tests/lib/libc/gen/t_dir.c:1.1 Tue Dec 28 12:46:15 2010 +++ src/tests/lib/libc/gen/t_dir.c Thu Apr 7 18:14:08 2011 @@ -1,12 +1,9 @@ -/* $NetBSD: t_dir.c,v 1.1 2010/12/28 12:46:15 pgoyette Exp $ */ +/* $NetBSD: t_dir.c,v 1.2 2011/04/07 18:14:08 jruoho Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Index: src/tests/lib/libc/gen/t_rbstress.c diff -u src/tests/lib/libc/gen/t_rbstress.c:1.1 src/tests/lib/libc/gen/t_rbstress.c:1.2 --- src/tests/lib/libc/gen/t_rbstress.c:1.1 Tue Dec 28 12:46:15 2010 +++ src/tests/lib/libc/gen/t_rbstress.c Thu Apr 7 18:14:08 2011 @@ -1,12 +1,9 @@ -/* $NetBSD: t_rbstress.c,v 1.1 2010/12/28 12:46:15 pgoyette Exp $ */ +/* $NetBSD: t_rbstress.c,v 1.2 2011/04/07 18:14:08 jruoho Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Index: src/tests/lib/libc/gen/t_ldexp.c diff -u src/tests/lib/libc/gen/t_ldexp.c:1.4 src/tests/lib/libc/gen/t_ldexp.c:1.5 --- src/tests/lib/libc/gen/t_ldexp.c:1.4 Sun Feb 20 20:57:46 2011 +++ src/tests/lib/libc/gen/t_ldexp.c Thu Apr 7 18:14:08 2011 @@ -1,12 +1,9 @@ -/* $NetBSD: t_ldexp.c,v 1.4 2011/02/20 20:57:46 jmmv Exp $ */ +/* $NetBSD: t_ldexp.c,v 1.5 2011/04/07 18:14:08 jruoho Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Index: src/tests/lib/libc/ieeefp/t_subnormal.c diff -u src/tests/lib/libc/ieeefp/t_subnormal.c:1.2 src/tests/lib/libc/ieeefp/t_subnormal.c:1.3 --- src/tests/lib/libc/ieeefp/t_subnormal.c:1.2 Tue Jan 4 22:30:41 2011 +++ src/tests/lib/libc/ieeefp/t_subnormal.c Thu Apr 7 18:14:09 2011 @@ -1,12 +1,9 @@ -/* $NetBSD: t_subnormal.c,v 1.2 2011/01/04 22:30:41 pgoyette Exp $ */ +/* $NetBSD: t_subnormal.c,v 1.3 2011/04/07 18:14:09 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Index: src/tests/lib/libc/net/h_protoent.c diff -u src/tests/lib/libc/net/h_protoent.c:1.1 src/tests/lib/libc/net/h_protoent.c:1.2 --- src/tests/lib/libc/net/h_protoent.c:1.1 Wed Jan 12 17:32:27 2011 +++ src/tests/lib/libc/net/h_protoent.c Thu Apr 7 18:14:09 2011 @@ -1,12 +1,9 @@ -/* $NetBSD: h_protoent.c,v 1.1 2011/01/12 17:32:27 pgoyette Exp $ */ +/* $NetBSD: h_protoent.c,v 1.2 2011/04/07 18:14:09 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Index: src/tests/lib/libc/net/h_servent.c diff -u sr
CVS commit: src
Module Name:src Committed By: jruoho Date: Thu Apr 7 17:38:02 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi src/tests/syscall: Makefile Added Files: src/tests/syscall: t_msync.c Log Message: Add few naive test cases for msync(2). To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.20 -r1.21 src/tests/syscall/Makefile cvs rdiff -u -r0 -r1.1 src/tests/syscall/t_msync.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.298 src/distrib/sets/lists/tests/mi:1.299 --- src/distrib/sets/lists/tests/mi:1.298 Thu Apr 7 06:24:07 2011 +++ src/distrib/sets/lists/tests/mi Thu Apr 7 17:38:02 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.298 2011/04/07 06:24:07 plunky Exp $ +# $NetBSD: mi,v 1.299 2011/04/07 17:38:02 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -583,6 +583,7 @@ ./usr/libdata/debug/usr/tests/syscall/t_getsid.debug tests-syscall-debug debug,atf ./usr/libdata/debug/usr/tests/syscall/t_mmap.debug tests-syscall-debug debug,atf ./usr/libdata/debug/usr/tests/syscall/t_mprotect.debug tests-syscall-debug debug,atf +./usr/libdata/debug/usr/tests/syscall/t_msync.debug tests-syscall-debug debug,atf ./usr/libdata/debug/usr/tests/syscall/t_setrlimit.debug tests-syscall-debug debug,atf ./usr/libdata/debug/usr/tests/syscall/t_setuid.debug tests-syscall-debug debug,atf ./usr/libdata/debug/usr/tests/syscall/t_timer.debug tests-syscall-debug debug,atf @@ -2140,6 +2141,7 @@ ./usr/tests/syscall/t_getsid tests-syscall-tests atf ./usr/tests/syscall/t_mmap tests-syscall-tests atf ./usr/tests/syscall/t_mprotect tests-syscall-tests atf +./usr/tests/syscall/t_msync tests-syscall-tests atf ./usr/tests/syscall/t_setrlimit tests-syscall-tests atf ./usr/tests/syscall/t_setuid tests-syscall-tests atf ./usr/tests/syscall/t_timer tests-syscall-tests atf Index: src/tests/syscall/Makefile diff -u src/tests/syscall/Makefile:1.20 src/tests/syscall/Makefile:1.21 --- src/tests/syscall/Makefile:1.20 Wed Apr 6 05:53:17 2011 +++ src/tests/syscall/Makefile Thu Apr 7 17:38:02 2011 @@ -1,11 +1,13 @@ -# $NetBSD: Makefile,v 1.20 2011/04/06 05:53:17 jruoho Exp $ +# $NetBSD: Makefile,v 1.21 2011/04/07 17:38:02 jruoho Exp $ .include TESTSDIR= ${TESTSBASE}/syscall -TESTS_C+= t_access t_cmsg t_dup t_fsync t_getpid t_getrusage t_getsid -TESTS_C+= t_mmap t_mprotect t_setrlimit t_setuid t_timer t_umask +TESTS_C+= t_access t_cmsg t_dup t_fsync +TESTS_C+= t_getpid t_getrusage t_getsid +TESTS_C+= t_mmap t_mprotect t_msync +TESTS_C+= t_setrlimit t_setuid t_timer t_umask LDADD.t_getpid+= -lpthread LDADD.t_timer+= -lpthread Added files: Index: src/tests/syscall/t_msync.c diff -u /dev/null src/tests/syscall/t_msync.c:1.1 --- /dev/null Thu Apr 7 17:38:02 2011 +++ src/tests/syscall/t_msync.c Thu Apr 7 17:38:02 2011 @@ -0,0 +1,225 @@ +/* $NetBSD: t_msync.c,v 1.1 2011/04/07 17:38:02 jruoho Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jukka Ruohonen. + * + * 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 +__RCSID("$NetBSD: t_msync.c,v 1.1 2011/04/07 17:38:02 jruoho Exp $"); + +#include + +#include +#include +#include +#include +#include +#include +#include + +static long page = 0; +static const off_t off = 512; +static const char path[] = "/tmp/msync"; + +static const char *msync_sync(con
CVS commit: [netbsd-4] src/doc
Module Name:src Committed By: riz Date: Thu Apr 7 17:34:14 UTC 2011 Modified Files: src/doc [netbsd-4]: CHANGES-4.1 Log Message: Ticket 1427. To generate a diff of this commit: cvs rdiff -u -r1.1.2.221 -r1.1.2.222 src/doc/CHANGES-4.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-4.1 diff -u src/doc/CHANGES-4.1:1.1.2.221 src/doc/CHANGES-4.1:1.1.2.222 --- src/doc/CHANGES-4.1:1.1.2.221 Thu Apr 7 06:33:50 2011 +++ src/doc/CHANGES-4.1 Thu Apr 7 17:34:14 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-4.1,v 1.1.2.221 2011/04/07 06:33:50 snj Exp $ +# $NetBSD: CHANGES-4.1,v 1.1.2.222 2011/04/07 17:34:14 riz Exp $ A complete list of changes from the NetBSD 4.0 release to the NetBSD 4.1 release: @@ -4422,3 +4422,9 @@ Fix CVE-2011-0465. [mrg, ticket #1426] +dist/dhcp/client/dhclient.c 1.21 + + CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP + response values. + [christos, ticket #1427] +
CVS commit: [netbsd-4] src/dist/dhcp/client
Module Name:src Committed By: riz Date: Thu Apr 7 17:33:55 UTC 2011 Modified Files: src/dist/dhcp/client [netbsd-4]: dhclient.c Log Message: Pull up following revision(s) (requested by christos in ticket #1427): dist/dhcp/client/dhclient.c: revision 1.21 CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP response values. Apply patch by hand from the 3.1-ESV-R1 release. To generate a diff of this commit: cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/dist/dhcp/client/dhclient.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/dhcp/client/dhclient.c diff -u src/dist/dhcp/client/dhclient.c:1.18.2.1 src/dist/dhcp/client/dhclient.c:1.18.2.2 --- src/dist/dhcp/client/dhclient.c:1.18.2.1 Tue Jul 14 19:55:44 2009 +++ src/dist/dhcp/client/dhclient.c Thu Apr 7 17:33:54 2011 @@ -32,7 +32,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.18.2.1 2009/07/14 19:55:44 snj Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.18.2.2 2011/04/07 17:33:54 riz Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,6 +79,11 @@ static void usage PROTO ((void)); static void limit_interval PROTO((struct client_state *)); +static int check_domain_name(const char *ptr, size_t len, int dots); +static int check_domain_name_list(const char *ptr, size_t len, int dots); +static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + void do_release(struct client_state *); #if !defined (SMALL) @@ -2476,12 +2481,23 @@ char name [256]; if (dhcp_option_ev_name (name, sizeof name, oc -> option)) { -client_envadd (es -> client, es -> prefix, - name, "%s", - (pretty_print_option - (oc -> option, - data.data, data.len, - 0, 0))); +const char *value; +value = pretty_print_option(oc->option, + data.data, + data.len, 0, 0); +size_t length = strlen(value); + +if (check_option_values(oc->option->universe, + oc->option->code, + value, length) == 0) { + client_envadd(es->client, es->prefix, + name, "%s", value); +} else { + log_error("suspect value in %s " + "option - discarded", + name); +} + data_string_forget (&data, MDL); } } @@ -2554,13 +2570,31 @@ data_string_forget (&data, MDL); } - if (lease -> filename) - client_envadd (client, - prefix, "filename", "%s", lease -> filename); - if (lease -> server_name) - client_envadd (client, prefix, "server_name", - "%s", lease -> server_name); + if (lease->filename) { + if (check_option_values(NULL, DHO_ROOT_PATH, + lease->filename, + strlen(lease->filename)) == 0) { + client_envadd(client, prefix, "filename", + "%s", lease->filename); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->filename); + } + } + if (lease->server_name) { + if (check_option_values(NULL, DHO_HOST_NAME, + lease->server_name, + strlen(lease->server_name)) == 0 ) { + client_envadd (client, prefix, "server_name", + "%s", lease->server_name); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->server_name); + } + } for (i = 0; i < lease -> options -> universe_count; i++) { option_space_foreach ((struct packet *)0, (struct lease *)0, client, (struct option_state *)0, @@ -3185,3 +3219,115 @@ #endif return rcode; } + +/* + * The following routines are used to check that certain + * strings are reasonable before we pass them to the scripts. + * This avoids some problems with scripts treating the strings + * as commands - see ticket 23722 + * The domain checking code should be done as part of assembling + * the string but we are doing it here for now due to time + * constraints. + */ + +static int check_domain_name(const char *ptr, size_t len, int dots) +{ + const char *p; + + /* not empty or complete length not over 255 characters */ + if ((len == 0) || (len > 256)) + return(-1); + + /* consists of [[:alnum:]-]+ labels separated by [.] */ + /* a [_] is against RFC but seems to be "widely used"... */ + for (p=ptr; (*p != 0) && (len-- > 0); p++) { + if ((*p == '-') || (*p == '_')) { + /* not allowed at begin or end of a label */ + if (((p - ptr) == 0) || (len == 0) || (p[1] == '.')) +return(-1); + } else if (*p == '.') { + /* each label has to be 1-63 characters; + we allow [.] at the end ('foo.bar.') */ + size_t d = p - ptr; + if ((d <= 0) || (d >= 64)) +return(-1); + ptr = p + 1; /* jump to the next label*/ + if ((dots > 0) && (len > 0)) +dots--; + } else if (isalnum((unsigned char)*p) == 0) { + /* also number
CVS commit: [netbsd-4-0] src/doc
Module Name:src Committed By: riz Date: Thu Apr 7 17:33:43 UTC 2011 Modified Files: src/doc [netbsd-4-0]: CHANGES-4.0.2 Log Message: Ticket 1427. To generate a diff of this commit: cvs rdiff -u -r1.1.2.84 -r1.1.2.85 src/doc/CHANGES-4.0.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-4.0.2 diff -u src/doc/CHANGES-4.0.2:1.1.2.84 src/doc/CHANGES-4.0.2:1.1.2.85 --- src/doc/CHANGES-4.0.2:1.1.2.84 Thu Apr 7 06:35:30 2011 +++ src/doc/CHANGES-4.0.2 Thu Apr 7 17:33:43 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-4.0.2,v 1.1.2.84 2011/04/07 06:35:30 snj Exp $ +# $NetBSD: CHANGES-4.0.2,v 1.1.2.85 2011/04/07 17:33:43 riz Exp $ A complete list of changes from the NetBSD 4.0.1 release to the NetBSD 4.0.2 release: @@ -1205,3 +1205,9 @@ Fix CVE-2011-0465 [mrg, ticket #1426] +dist/dhcp/client/dhclient.c 1.21 + + CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP + response values. + [christos, ticket #1427] +
CVS commit: [netbsd-4-0] src/dist/dhcp/client
Module Name:src Committed By: riz Date: Thu Apr 7 17:33:17 UTC 2011 Modified Files: src/dist/dhcp/client [netbsd-4-0]: dhclient.c Log Message: Pull up following revision(s) (requested by christos in ticket #1427): dist/dhcp/client/dhclient.c: revision 1.21 CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP response values. Apply patch by hand from the 3.1-ESV-R1 release. To generate a diff of this commit: cvs rdiff -u -r1.18.12.1 -r1.18.12.2 src/dist/dhcp/client/dhclient.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/dhcp/client/dhclient.c diff -u src/dist/dhcp/client/dhclient.c:1.18.12.1 src/dist/dhcp/client/dhclient.c:1.18.12.2 --- src/dist/dhcp/client/dhclient.c:1.18.12.1 Tue Jul 14 19:57:00 2009 +++ src/dist/dhcp/client/dhclient.c Thu Apr 7 17:33:17 2011 @@ -32,7 +32,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.18.12.1 2009/07/14 19:57:00 snj Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.18.12.2 2011/04/07 17:33:17 riz Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,6 +79,11 @@ static void usage PROTO ((void)); static void limit_interval PROTO((struct client_state *)); +static int check_domain_name(const char *ptr, size_t len, int dots); +static int check_domain_name_list(const char *ptr, size_t len, int dots); +static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + void do_release(struct client_state *); #if !defined (SMALL) @@ -2476,12 +2481,23 @@ char name [256]; if (dhcp_option_ev_name (name, sizeof name, oc -> option)) { -client_envadd (es -> client, es -> prefix, - name, "%s", - (pretty_print_option - (oc -> option, - data.data, data.len, - 0, 0))); +const char *value; +value = pretty_print_option(oc->option, + data.data, + data.len, 0, 0); +size_t length = strlen(value); + +if (check_option_values(oc->option->universe, + oc->option->code, + value, length) == 0) { + client_envadd(es->client, es->prefix, + name, "%s", value); +} else { + log_error("suspect value in %s " + "option - discarded", + name); +} + data_string_forget (&data, MDL); } } @@ -2554,13 +2570,31 @@ data_string_forget (&data, MDL); } - if (lease -> filename) - client_envadd (client, - prefix, "filename", "%s", lease -> filename); - if (lease -> server_name) - client_envadd (client, prefix, "server_name", - "%s", lease -> server_name); + if (lease->filename) { + if (check_option_values(NULL, DHO_ROOT_PATH, + lease->filename, + strlen(lease->filename)) == 0) { + client_envadd(client, prefix, "filename", + "%s", lease->filename); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->filename); + } + } + if (lease->server_name) { + if (check_option_values(NULL, DHO_HOST_NAME, + lease->server_name, + strlen(lease->server_name)) == 0 ) { + client_envadd (client, prefix, "server_name", + "%s", lease->server_name); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->server_name); + } + } for (i = 0; i < lease -> options -> universe_count; i++) { option_space_foreach ((struct packet *)0, (struct lease *)0, client, (struct option_state *)0, @@ -3185,3 +3219,115 @@ #endif return rcode; } + +/* + * The following routines are used to check that certain + * strings are reasonable before we pass them to the scripts. + * This avoids some problems with scripts treating the strings + * as commands - see ticket 23722 + * The domain checking code should be done as part of assembling + * the string but we are doing it here for now due to time + * constraints. + */ + +static int check_domain_name(const char *ptr, size_t len, int dots) +{ + const char *p; + + /* not empty or complete length not over 255 characters */ + if ((len == 0) || (len > 256)) + return(-1); + + /* consists of [[:alnum:]-]+ labels separated by [.] */ + /* a [_] is against RFC but seems to be "widely used"... */ + for (p=ptr; (*p != 0) && (len-- > 0); p++) { + if ((*p == '-') || (*p == '_')) { + /* not allowed at begin or end of a label */ + if (((p - ptr) == 0) || (len == 0) || (p[1] == '.')) +return(-1); + } else if (*p == '.') { + /* each label has to be 1-63 characters; + we allow [.] at the end ('foo.bar.') */ + size_t d = p - ptr; + if ((d <= 0) || (d >= 64)) +return(-1); + ptr = p + 1; /* jump to the next label*/ + if ((dots > 0) && (len > 0)) +dots--; + } else if (isalnum((unsigned char)*p) == 0) { + /* al
CVS commit: src/tests/syscall
Module Name:src Committed By: jruoho Date: Thu Apr 7 17:33:12 UTC 2011 Modified Files: src/tests/syscall: t_getrusage.c Log Message: Improve the test further so that it might trigger more often. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/syscall/t_getrusage.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/syscall/t_getrusage.c diff -u src/tests/syscall/t_getrusage.c:1.4 src/tests/syscall/t_getrusage.c:1.5 --- src/tests/syscall/t_getrusage.c:1.4 Wed Apr 6 19:09:16 2011 +++ src/tests/syscall/t_getrusage.c Thu Apr 7 17:33:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_getrusage.c,v 1.4 2011/04/06 19:09:16 jruoho Exp $ */ +/* $NetBSD: t_getrusage.c,v 1.5 2011/04/07 17:33:11 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_getrusage.c,v 1.4 2011/04/06 19:09:16 jruoho Exp $"); +__RCSID("$NetBSD: t_getrusage.c,v 1.5 2011/04/07 17:33:11 jruoho Exp $"); #include #include @@ -40,8 +40,10 @@ #include #include -static void work(void); -static void sighandler(int); +static void work(void); +static void sighandler(int); + +static const size_t maxiter = 2000; static void sighandler(int signo) @@ -52,7 +54,7 @@ static void work(void) { - size_t n = UINT16_MAX * 100; + size_t n = UINT16_MAX * 10; while (n > 0) { asm volatile("nop"); /* Do something. */ @@ -117,14 +119,14 @@ ATF_TC_BODY(getrusage_utime_back, tc) { struct rusage ru1, ru2; - size_t i, n = 100; + size_t i; /* * Test that two consecutive calls are sane. */ atf_tc_expect_fail("PR kern/30115"); - for (i = 0; i < n; i++) { + for (i = 0; i < maxiter; i++) { (void)memset(&ru1, 0, sizeof(struct rusage)); (void)memset(&ru2, 0, sizeof(struct rusage)); @@ -151,21 +153,25 @@ ATF_TC_BODY(getrusage_utime_zero, tc) { struct rusage ru; + size_t i; /* * Test that getrusage(2) does not return * zero user time for the calling process. */ - atf_tc_expect_fail("PR port-amd64/41734"); + for (i = 0; i < maxiter; i++) { - work(); + atf_tc_expect_fail("PR port-amd64/41734"); - (void)memset(&ru, 0, sizeof(struct rusage)); + work(); - ATF_REQUIRE(getrusage(RUSAGE_SELF, &ru) == 0); + (void)memset(&ru, 0, sizeof(struct rusage)); + + ATF_REQUIRE(getrusage(RUSAGE_SELF, &ru) == 0); - if (ru.ru_utime.tv_sec == 0 && ru.ru_utime.tv_usec == 0) - atf_tc_fail("zero user time from getrusage(2)"); + if (ru.ru_utime.tv_sec == 0 && ru.ru_utime.tv_usec == 0) + atf_tc_fail("zero user time from getrusage(2)"); + } } ATF_TP_ADD_TCS(tp)
CVS commit: [netbsd-5] src/doc
Module Name:src Committed By: riz Date: Thu Apr 7 17:26:31 UTC 2011 Modified Files: src/doc [netbsd-5]: CHANGES-5.2 Log Message: Ticket 1595. To generate a diff of this commit: cvs rdiff -u -r1.1.2.73 -r1.1.2.74 src/doc/CHANGES-5.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.2 diff -u src/doc/CHANGES-5.2:1.1.2.73 src/doc/CHANGES-5.2:1.1.2.74 --- src/doc/CHANGES-5.2:1.1.2.73 Thu Apr 7 16:31:07 2011 +++ src/doc/CHANGES-5.2 Thu Apr 7 17:26:31 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.2,v 1.1.2.73 2011/04/07 16:31:07 snj Exp $ +# $NetBSD: CHANGES-5.2,v 1.1.2.74 2011/04/07 17:26:31 riz Exp $ A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.2 release: @@ -4994,3 +4994,9 @@ Fix CVE-2011-0465 [mrg, ticket #1594] +dist/dhcp/client/dhclient.c 1.21 + + CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP + response values. + [spz, ticket #1595] +
CVS commit: [netbsd-5] src/dist/dhcp/client
Module Name:src Committed By: riz Date: Thu Apr 7 17:26:07 UTC 2011 Modified Files: src/dist/dhcp/client [netbsd-5]: dhclient.c Log Message: Pull up following revision(s) (requested by spz in ticket #1595): dist/dhcp/client/dhclient.c: revision 1.21 CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP response values. Apply patch by hand from the 3.1-ESV-R1 release. To generate a diff of this commit: cvs rdiff -u -r1.19.8.1 -r1.19.8.2 src/dist/dhcp/client/dhclient.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/dhcp/client/dhclient.c diff -u src/dist/dhcp/client/dhclient.c:1.19.8.1 src/dist/dhcp/client/dhclient.c:1.19.8.2 --- src/dist/dhcp/client/dhclient.c:1.19.8.1 Tue Jul 14 19:50:21 2009 +++ src/dist/dhcp/client/dhclient.c Thu Apr 7 17:26:07 2011 @@ -32,7 +32,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.19.8.1 2009/07/14 19:50:21 snj Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.19.8.2 2011/04/07 17:26:07 riz Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,6 +79,11 @@ static void usage PROTO ((void)); static void limit_interval PROTO((struct client_state *)); +static int check_domain_name(const char *ptr, size_t len, int dots); +static int check_domain_name_list(const char *ptr, size_t len, int dots); +static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + void do_release(struct client_state *); #if !defined (SMALL) @@ -2475,12 +2480,23 @@ char name [256]; if (dhcp_option_ev_name (name, sizeof name, oc -> option)) { -client_envadd (es -> client, es -> prefix, - name, "%s", - (pretty_print_option - (oc -> option, - data.data, data.len, - 0, 0))); +const char *value; +value = pretty_print_option(oc->option, + data.data, + data.len, 0, 0); +size_t length = strlen(value); + +if (check_option_values(oc->option->universe, + oc->option->code, + value, length) == 0) { + client_envadd(es->client, es->prefix, + name, "%s", value); +} else { + log_error("suspect value in %s " + "option - discarded", + name); +} + data_string_forget (&data, MDL); } } @@ -2553,13 +2569,31 @@ data_string_forget (&data, MDL); } - if (lease -> filename) - client_envadd (client, - prefix, "filename", "%s", lease -> filename); - if (lease -> server_name) - client_envadd (client, prefix, "server_name", - "%s", lease -> server_name); + if (lease->filename) { + if (check_option_values(NULL, DHO_ROOT_PATH, + lease->filename, + strlen(lease->filename)) == 0) { + client_envadd(client, prefix, "filename", + "%s", lease->filename); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->filename); + } + } + if (lease->server_name) { + if (check_option_values(NULL, DHO_HOST_NAME, + lease->server_name, + strlen(lease->server_name)) == 0 ) { + client_envadd (client, prefix, "server_name", + "%s", lease->server_name); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->server_name); + } + } for (i = 0; i < lease -> options -> universe_count; i++) { option_space_foreach ((struct packet *)0, (struct lease *)0, client, (struct option_state *)0, @@ -3184,3 +3218,115 @@ #endif return rcode; } + +/* + * The following routines are used to check that certain + * strings are reasonable before we pass them to the scripts. + * This avoids some problems with scripts treating the strings + * as commands - see ticket 23722 + * The domain checking code should be done as part of assembling + * the string but we are doing it here for now due to time + * constraints. + */ + +static int check_domain_name(const char *ptr, size_t len, int dots) +{ + const char *p; + + /* not empty or complete length not over 255 characters */ + if ((len == 0) || (len > 256)) + return(-1); + + /* consists of [[:alnum:]-]+ labels separated by [.] */ + /* a [_] is against RFC but seems to be "widely used"... */ + for (p=ptr; (*p != 0) && (len-- > 0); p++) { + if ((*p == '-') || (*p == '_')) { + /* not allowed at begin or end of a label */ + if (((p - ptr) == 0) || (len == 0) || (p[1] == '.')) +return(-1); + } else if (*p == '.') { + /* each label has to be 1-63 characters; + we allow [.] at the end ('foo.bar.') */ + size_t d = p - ptr; + if ((d <= 0) || (d >= 64)) +return(-1); + ptr = p + 1; /* jump to the next label*/ + if ((dots > 0) && (len > 0)) +dots--; + } else if (isalnum((unsigned char)*p) == 0) { + /* also numbers at
CVS commit: [netbsd-5-0] src/doc
Module Name:src Committed By: riz Date: Thu Apr 7 17:25:47 UTC 2011 Modified Files: src/doc [netbsd-5-0]: CHANGES-5.0.3 Log Message: Ticket 1595. To generate a diff of this commit: cvs rdiff -u -r1.1.2.37 -r1.1.2.38 src/doc/CHANGES-5.0.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.0.3 diff -u src/doc/CHANGES-5.0.3:1.1.2.37 src/doc/CHANGES-5.0.3:1.1.2.38 --- src/doc/CHANGES-5.0.3:1.1.2.37 Thu Apr 7 16:27:11 2011 +++ src/doc/CHANGES-5.0.3 Thu Apr 7 17:25:47 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.0.3,v 1.1.2.37 2011/04/07 16:27:11 snj Exp $ +# $NetBSD: CHANGES-5.0.3,v 1.1.2.38 2011/04/07 17:25:47 riz Exp $ A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3 release: @@ -2717,3 +2717,9 @@ Fix CVE-2011-0465 [mrg, ticket #1594] +dist/dhcp/client/dhclient.c 1.21 + + CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP + response values. + [spz, ticket #1595] +
CVS commit: [netbsd-5-0] src/dist/dhcp/client
Module Name:src Committed By: riz Date: Thu Apr 7 17:25:02 UTC 2011 Modified Files: src/dist/dhcp/client [netbsd-5-0]: dhclient.c Log Message: Pull up following revision(s) (requested by spz in ticket #1595): dist/dhcp/client/dhclient.c: revision 1.21 CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP response values. Apply patch by hand from the 3.1-ESV-R1 release. To generate a diff of this commit: cvs rdiff -u -r1.19.12.1 -r1.19.12.2 src/dist/dhcp/client/dhclient.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/dhcp/client/dhclient.c diff -u src/dist/dhcp/client/dhclient.c:1.19.12.1 src/dist/dhcp/client/dhclient.c:1.19.12.2 --- src/dist/dhcp/client/dhclient.c:1.19.12.1 Tue Jul 14 19:53:05 2009 +++ src/dist/dhcp/client/dhclient.c Thu Apr 7 17:25:02 2011 @@ -32,7 +32,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.19.12.1 2009/07/14 19:53:05 snj Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.19.12.2 2011/04/07 17:25:02 riz Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,6 +79,11 @@ static void usage PROTO ((void)); static void limit_interval PROTO((struct client_state *)); +static int check_domain_name(const char *ptr, size_t len, int dots); +static int check_domain_name_list(const char *ptr, size_t len, int dots); +static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + void do_release(struct client_state *); #if !defined (SMALL) @@ -2475,12 +2480,23 @@ char name [256]; if (dhcp_option_ev_name (name, sizeof name, oc -> option)) { -client_envadd (es -> client, es -> prefix, - name, "%s", - (pretty_print_option - (oc -> option, - data.data, data.len, - 0, 0))); +const char *value; +value = pretty_print_option(oc->option, + data.data, + data.len, 0, 0); +size_t length = strlen(value); + +if (check_option_values(oc->option->universe, + oc->option->code, + value, length) == 0) { + client_envadd(es->client, es->prefix, + name, "%s", value); +} else { + log_error("suspect value in %s " + "option - discarded", + name); +} + data_string_forget (&data, MDL); } } @@ -2553,13 +2569,31 @@ data_string_forget (&data, MDL); } - if (lease -> filename) - client_envadd (client, - prefix, "filename", "%s", lease -> filename); - if (lease -> server_name) - client_envadd (client, prefix, "server_name", - "%s", lease -> server_name); + if (lease->filename) { + if (check_option_values(NULL, DHO_ROOT_PATH, + lease->filename, + strlen(lease->filename)) == 0) { + client_envadd(client, prefix, "filename", + "%s", lease->filename); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->filename); + } + } + if (lease->server_name) { + if (check_option_values(NULL, DHO_HOST_NAME, + lease->server_name, + strlen(lease->server_name)) == 0 ) { + client_envadd (client, prefix, "server_name", + "%s", lease->server_name); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->server_name); + } + } for (i = 0; i < lease -> options -> universe_count; i++) { option_space_foreach ((struct packet *)0, (struct lease *)0, client, (struct option_state *)0, @@ -3184,3 +3218,115 @@ #endif return rcode; } + +/* + * The following routines are used to check that certain + * strings are reasonable before we pass them to the scripts. + * This avoids some problems with scripts treating the strings + * as commands - see ticket 23722 + * The domain checking code should be done as part of assembling + * the string but we are doing it here for now due to time + * constraints. + */ + +static int check_domain_name(const char *ptr, size_t len, int dots) +{ + const char *p; + + /* not empty or complete length not over 255 characters */ + if ((len == 0) || (len > 256)) + return(-1); + + /* consists of [[:alnum:]-]+ labels separated by [.] */ + /* a [_] is against RFC but seems to be "widely used"... */ + for (p=ptr; (*p != 0) && (len-- > 0); p++) { + if ((*p == '-') || (*p == '_')) { + /* not allowed at begin or end of a label */ + if (((p - ptr) == 0) || (len == 0) || (p[1] == '.')) +return(-1); + } else if (*p == '.') { + /* each label has to be 1-63 characters; + we allow [.] at the end ('foo.bar.') */ + size_t d = p - ptr; + if ((d <= 0) || (d >= 64)) +return(-1); + ptr = p + 1; /* jump to the next label*/ + if ((dots > 0) && (len > 0)) +dots--; + } else if (isalnum((unsigned char)*p) == 0) { + /* also nu
CVS commit: [netbsd-5-1] src/doc
Module Name:src Committed By: riz Date: Thu Apr 7 17:24:48 UTC 2011 Modified Files: src/doc [netbsd-5-1]: CHANGES-5.1.1 Log Message: Ticket 1595. To generate a diff of this commit: cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/doc/CHANGES-5.1.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.1.1 diff -u src/doc/CHANGES-5.1.1:1.1.2.22 src/doc/CHANGES-5.1.1:1.1.2.23 --- src/doc/CHANGES-5.1.1:1.1.2.22 Thu Apr 7 16:29:15 2011 +++ src/doc/CHANGES-5.1.1 Thu Apr 7 17:24:48 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.1.1,v 1.1.2.22 2011/04/07 16:29:15 snj Exp $ +# $NetBSD: CHANGES-5.1.1,v 1.1.2.23 2011/04/07 17:24:48 riz Exp $ A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.1.1 release: @@ -2390,3 +2390,9 @@ Fix CVE-2011-0465 [mrg, ticket #1594] +dist/dhcp/client/dhclient.c 1.21 + + CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP + response values. + [spz, ticket #1595] +
CVS commit: [netbsd-5-1] src/dist/dhcp/client
Module Name:src Committed By: riz Date: Thu Apr 7 17:24:23 UTC 2011 Modified Files: src/dist/dhcp/client [netbsd-5-1]: dhclient.c Log Message: Pull up following revision(s) (requested by spz in ticket #1595): dist/dhcp/client/dhclient.c: revision 1.21 CVE-2011-0997 dhclient: insufficient sanitization of certain DHCP response values. Apply patch by hand from the 3.1-ESV-R1 release. To generate a diff of this commit: cvs rdiff -u -r1.19.8.1 -r1.19.8.1.2.1 src/dist/dhcp/client/dhclient.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/dhcp/client/dhclient.c diff -u src/dist/dhcp/client/dhclient.c:1.19.8.1 src/dist/dhcp/client/dhclient.c:1.19.8.1.2.1 --- src/dist/dhcp/client/dhclient.c:1.19.8.1 Tue Jul 14 19:50:21 2009 +++ src/dist/dhcp/client/dhclient.c Thu Apr 7 17:24:22 2011 @@ -32,7 +32,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.19.8.1 2009/07/14 19:50:21 snj Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.19.8.1.2.1 2011/04/07 17:24:22 riz Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,6 +79,11 @@ static void usage PROTO ((void)); static void limit_interval PROTO((struct client_state *)); +static int check_domain_name(const char *ptr, size_t len, int dots); +static int check_domain_name_list(const char *ptr, size_t len, int dots); +static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + void do_release(struct client_state *); #if !defined (SMALL) @@ -2475,12 +2480,23 @@ char name [256]; if (dhcp_option_ev_name (name, sizeof name, oc -> option)) { -client_envadd (es -> client, es -> prefix, - name, "%s", - (pretty_print_option - (oc -> option, - data.data, data.len, - 0, 0))); +const char *value; +value = pretty_print_option(oc->option, + data.data, + data.len, 0, 0); +size_t length = strlen(value); + +if (check_option_values(oc->option->universe, + oc->option->code, + value, length) == 0) { + client_envadd(es->client, es->prefix, + name, "%s", value); +} else { + log_error("suspect value in %s " + "option - discarded", + name); +} + data_string_forget (&data, MDL); } } @@ -2553,13 +2569,31 @@ data_string_forget (&data, MDL); } - if (lease -> filename) - client_envadd (client, - prefix, "filename", "%s", lease -> filename); - if (lease -> server_name) - client_envadd (client, prefix, "server_name", - "%s", lease -> server_name); + if (lease->filename) { + if (check_option_values(NULL, DHO_ROOT_PATH, + lease->filename, + strlen(lease->filename)) == 0) { + client_envadd(client, prefix, "filename", + "%s", lease->filename); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->filename); + } + } + if (lease->server_name) { + if (check_option_values(NULL, DHO_HOST_NAME, + lease->server_name, + strlen(lease->server_name)) == 0 ) { + client_envadd (client, prefix, "server_name", + "%s", lease->server_name); + } else { + log_error("suspect value in %s " + "option - discarded", + lease->server_name); + } + } for (i = 0; i < lease -> options -> universe_count; i++) { option_space_foreach ((struct packet *)0, (struct lease *)0, client, (struct option_state *)0, @@ -3184,3 +3218,115 @@ #endif return rcode; } + +/* + * The following routines are used to check that certain + * strings are reasonable before we pass them to the scripts. + * This avoids some problems with scripts treating the strings + * as commands - see ticket 23722 + * The domain checking code should be done as part of assembling + * the string but we are doing it here for now due to time + * constraints. + */ + +static int check_domain_name(const char *ptr, size_t len, int dots) +{ + const char *p; + + /* not empty or complete length not over 255 characters */ + if ((len == 0) || (len > 256)) + return(-1); + + /* consists of [[:alnum:]-]+ labels separated by [.] */ + /* a [_] is against RFC but seems to be "widely used"... */ + for (p=ptr; (*p != 0) && (len-- > 0); p++) { + if ((*p == '-') || (*p == '_')) { + /* not allowed at begin or end of a label */ + if (((p - ptr) == 0) || (len == 0) || (p[1] == '.')) +return(-1); + } else if (*p == '.') { + /* each label has to be 1-63 characters; + we allow [.] at the end ('foo.bar.') */ + size_t d = p - ptr; + if ((d <= 0) || (d >= 64)) +return(-1); + ptr = p + 1; /* jump to the next label*/ + if ((dots > 0) && (len > 0)) +dots--; + } else if (isalnum((unsigned char)*p) == 0) { + /* al
CVS commit: [netbsd-5] src/doc
Module Name:src Committed By: snj Date: Thu Apr 7 16:31:07 UTC 2011 Modified Files: src/doc [netbsd-5]: CHANGES-5.2 Log Message: update 1594 To generate a diff of this commit: cvs rdiff -u -r1.1.2.72 -r1.1.2.73 src/doc/CHANGES-5.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.2 diff -u src/doc/CHANGES-5.2:1.1.2.72 src/doc/CHANGES-5.2:1.1.2.73 --- src/doc/CHANGES-5.2:1.1.2.72 Thu Apr 7 06:48:18 2011 +++ src/doc/CHANGES-5.2 Thu Apr 7 16:31:07 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.2,v 1.1.2.72 2011/04/07 06:48:18 snj Exp $ +# $NetBSD: CHANGES-5.2,v 1.1.2.73 2011/04/07 16:31:07 snj Exp $ A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.2 release: @@ -4973,6 +4973,7 @@ xsrc/external/mit/xrdb/dist/Makefile.am patch xsrc/external/mit/xrdb/dist/Makefile.in patch xsrc/external/mit/xrdb/dist/README patch +xsrc/external/mit/xrdb/dist/NEWS remove xsrc/external/mit/xrdb/dist/aclocal.m4 patch xsrc/external/mit/xrdb/dist/config.guess patch xsrc/external/mit/xrdb/dist/config.h.in patch @@ -4983,7 +4984,7 @@ xsrc/external/mit/xrdb/dist/install-sh patch xsrc/external/mit/xrdb/dist/missing patch xsrc/external/mit/xrdb/dist/xrdb.c patch -xsrc/external/mit/xrdb/dist/xrdb.man patch +xsrc/external/mit/xrdb/dist/xrdb.man remove xsrc/external/mit/xrdb/dist/man/Makefile.am patch xsrc/external/mit/xrdb/dist/man/Makefile.in patch xsrc/external/mit/xrdb/dist/man/xrdb.man patch
CVS commit: [netbsd-5] xsrc/external/mit/xrdb/dist
Module Name:xsrc Committed By: snj Date: Thu Apr 7 16:30:26 UTC 2011 Removed Files: xsrc/external/mit/xrdb/dist [netbsd-5]: NEWS xrdb.man Log Message: Remove these two files. Missed in ticket 1594. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r0 xsrc/external/mit/xrdb/dist/NEWS cvs rdiff -u -r1.1.1.1.2.1 -r0 xsrc/external/mit/xrdb/dist/xrdb.man Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-5-1] src/doc
Module Name:src Committed By: snj Date: Thu Apr 7 16:29:15 UTC 2011 Modified Files: src/doc [netbsd-5-1]: CHANGES-5.1.1 Log Message: update 1594 To generate a diff of this commit: cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/doc/CHANGES-5.1.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.1.1 diff -u src/doc/CHANGES-5.1.1:1.1.2.21 src/doc/CHANGES-5.1.1:1.1.2.22 --- src/doc/CHANGES-5.1.1:1.1.2.21 Thu Apr 7 07:01:23 2011 +++ src/doc/CHANGES-5.1.1 Thu Apr 7 16:29:15 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.1.1,v 1.1.2.21 2011/04/07 07:01:23 snj Exp $ +# $NetBSD: CHANGES-5.1.1,v 1.1.2.22 2011/04/07 16:29:15 snj Exp $ A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.1.1 release: @@ -2369,6 +2369,7 @@ xsrc/external/mit/xrdb/dist/Makefile.am patch xsrc/external/mit/xrdb/dist/Makefile.in patch xsrc/external/mit/xrdb/dist/README patch +xsrc/external/mit/xrdb/dist/NEWS remove xsrc/external/mit/xrdb/dist/aclocal.m4 patch xsrc/external/mit/xrdb/dist/config.guess patch xsrc/external/mit/xrdb/dist/config.h.in patch @@ -2379,7 +2380,7 @@ xsrc/external/mit/xrdb/dist/install-sh patch xsrc/external/mit/xrdb/dist/missing patch xsrc/external/mit/xrdb/dist/xrdb.c patch -xsrc/external/mit/xrdb/dist/xrdb.man patch +xsrc/external/mit/xrdb/dist/xrdb.man remove xsrc/external/mit/xrdb/dist/man/Makefile.am patch xsrc/external/mit/xrdb/dist/man/Makefile.in patch xsrc/external/mit/xrdb/dist/man/xrdb.man patch
CVS commit: [netbsd-5-1] xsrc/external/mit/xrdb/dist
Module Name:xsrc Committed By: snj Date: Thu Apr 7 16:28:20 UTC 2011 Removed Files: xsrc/external/mit/xrdb/dist [netbsd-5-1]: NEWS xrdb.man Log Message: Remove these two files. Missed in ticket 1594. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r0 xsrc/external/mit/xrdb/dist/NEWS cvs rdiff -u -r1.1.1.1.6.1 -r0 xsrc/external/mit/xrdb/dist/xrdb.man Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-5-0] src/doc
Module Name:src Committed By: snj Date: Thu Apr 7 16:27:12 UTC 2011 Modified Files: src/doc [netbsd-5-0]: CHANGES-5.0.3 Log Message: update 1594 To generate a diff of this commit: cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/doc/CHANGES-5.0.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.0.3 diff -u src/doc/CHANGES-5.0.3:1.1.2.36 src/doc/CHANGES-5.0.3:1.1.2.37 --- src/doc/CHANGES-5.0.3:1.1.2.36 Thu Apr 7 06:56:25 2011 +++ src/doc/CHANGES-5.0.3 Thu Apr 7 16:27:11 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.0.3,v 1.1.2.36 2011/04/07 06:56:25 snj Exp $ +# $NetBSD: CHANGES-5.0.3,v 1.1.2.37 2011/04/07 16:27:11 snj Exp $ A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3 release: @@ -2696,6 +2696,7 @@ xsrc/external/mit/xrdb/dist/Makefile.am patch xsrc/external/mit/xrdb/dist/Makefile.in patch xsrc/external/mit/xrdb/dist/README patch +xsrc/external/mit/xrdb/dist/NEWS remove xsrc/external/mit/xrdb/dist/aclocal.m4 patch xsrc/external/mit/xrdb/dist/config.guess patch xsrc/external/mit/xrdb/dist/config.h.in patch @@ -2706,7 +2707,7 @@ xsrc/external/mit/xrdb/dist/install-sh patch xsrc/external/mit/xrdb/dist/missing patch xsrc/external/mit/xrdb/dist/xrdb.c patch -xsrc/external/mit/xrdb/dist/xrdb.man patch +xsrc/external/mit/xrdb/dist/xrdb.man remove xsrc/external/mit/xrdb/dist/man/Makefile.am patch xsrc/external/mit/xrdb/dist/man/Makefile.in patch xsrc/external/mit/xrdb/dist/man/xrdb.man patch
CVS commit: [netbsd-5-0] xsrc/external/mit/xrdb/dist
Module Name:xsrc Committed By: snj Date: Thu Apr 7 16:24:57 UTC 2011 Removed Files: xsrc/external/mit/xrdb/dist [netbsd-5-0]: NEWS xrdb.man Log Message: Remove these two files. Missed in ticket 1594. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r0 xsrc/external/mit/xrdb/dist/NEWS cvs rdiff -u -r1.1.1.1.4.1 -r0 xsrc/external/mit/xrdb/dist/xrdb.man Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/stand/libsa
Module Name:src Committed By: isaki Date: Thu Apr 7 13:38:21 UTC 2011 Modified Files: src/sys/arch/x68k/stand/libsa: chdsk.c Log Message: Poll the next medium on both drive of #0 and #1. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x68k/stand/libsa/chdsk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/libsa/chdsk.c diff -u src/sys/arch/x68k/stand/libsa/chdsk.c:1.2 src/sys/arch/x68k/stand/libsa/chdsk.c:1.3 --- src/sys/arch/x68k/stand/libsa/chdsk.c:1.2 Mon Jan 12 07:56:31 2009 +++ src/sys/arch/x68k/stand/libsa/chdsk.c Thu Apr 7 13:38:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: chdsk.c,v 1.2 2009/01/12 07:56:31 tsutsui Exp $ */ +/* $NetBSD: chdsk.c,v 1.3 2011/04/07 13:38:21 isaki Exp $ */ /* * Copyright (c) 2001 MINOURA Makoto. @@ -38,20 +38,36 @@ { if (strcmp(f->f_dev->dv_name, "fd") == 0) { struct fd_softc *sc = f->f_devdata; - int unit = (0x90 + sc->unit) << 8; + int drive[2]; - /* unlock */ - IOCS_B_DRVCHK(unit, 3); - /* eject */ - IOCS_B_DRVCHK(unit, 1); + drive[0] = 0x90 << 8; + drive[1] = 0x91 << 8; + + /* unlock current unit */ + IOCS_B_DRVCHK(drive[sc->unit], 3); + /* eject current */ + IOCS_B_DRVCHK(drive[sc->unit], 1); awaitkey_1sec(); - /* prompt */ - IOCS_B_DRVCHK(unit, 4); + /* prompt both */ + IOCS_B_DRVCHK(drive[0], 4); + IOCS_B_DRVCHK(drive[1], 4); /* poll for medium */ - while ((IOCS_B_DRVCHK(unit, 0) & 2) == 0) + for (;;) { + if ((IOCS_B_DRVCHK(drive[0], 0) & 2)) { +sc->unit = 0; +break; + } + if ((IOCS_B_DRVCHK(drive[1], 0) & 2)) { +sc->unit = 1; +break; + } awaitkey_1sec(); - /* lock */ - IOCS_B_DRVCHK(unit, 2); + } + /* prompt off */ + IOCS_B_DRVCHK(drive[0], 5); + IOCS_B_DRVCHK(drive[1], 5); + /* lock new unit */ + IOCS_B_DRVCHK(drive[sc->unit], 2); } return 0;
CVS commit: src/sys/arch/arm/arm
Module Name:src Committed By: matt Date: Thu Apr 7 11:02:24 UTC 2011 Modified Files: src/sys/arch/arm/arm: undefined.c Log Message: Add a cp15 trapper to emulate the mrc/mcr instructions for the thread id registers. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/arm/undefined.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm/undefined.c diff -u src/sys/arch/arm/arm/undefined.c:1.40 src/sys/arch/arm/arm/undefined.c:1.41 --- src/sys/arch/arm/arm/undefined.c:1.40 Mon Dec 20 00:25:26 2010 +++ src/sys/arch/arm/arm/undefined.c Thu Apr 7 11:02:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: undefined.c,v 1.40 2010/12/20 00:25:26 matt Exp $ */ +/* $NetBSD: undefined.c,v 1.41 2011/04/07 11:02:24 matt Exp $ */ /* * Copyright (c) 2001 Ben Harris. @@ -54,7 +54,7 @@ #include #endif -__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.40 2010/12/20 00:25:26 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.41 2011/04/07 11:02:24 matt Exp $"); #include #include @@ -122,12 +122,57 @@ free(uh, M_TEMP); } +static int +cp15_trapper(u_int addr, u_int insn, struct trapframe *frame, int code) +{ + struct lwp * const l = curlwp; + +#ifdef THUMB_CODE + if (frame->tf_spsr & PSR_T_bit) + return 1; +#endif + if (code != FAULT_USER) + return 1; + + /* + * Don't overwrite sp, pc, etc. + */ + const u_int regno = (insn >> 12) & 15; + if (regno > 12) + return 1; + + /* + * Get a pointer to the register used in the instruction to be emulated. + */ + register_t * const regp = &frame->tf_r0 + regno; + + /* + * Handle MRC p15, 0, , c13, c0, 3 (Read User read-only thread id) + */ + if ((insn & 0x0fff) == 0xee1d0f70) { + *regp = (uintptr_t)l->l_private; + return 0; + } + + /* + * Handle {MRC,MCR} p15, 0, , c13, c0, 2 (User read/write thread id) + */ + if ((insn & 0xffef0fff) == 0xee0d0f50) { + struct pcb * const pcb = lwp_getpcb(l); + if (insn & 0x0010) + *regp = pcb->pcb_user_pid_rw; + else + pcb->pcb_user_pid_rw = *regp; + return 0; + } + + return 1; +} static int gdb_trapper(u_int addr, u_int insn, struct trapframe *frame, int code) { - struct lwp *l; - l = curlwp; + struct lwp * const l = curlwp; #ifdef THUMB_CODE if (frame->tf_spsr & PSR_T_bit) { @@ -160,6 +205,7 @@ return 1; } +static struct undefined_handler cp15_uh; static struct undefined_handler gdb_uh; #ifdef THUMB_CODE static struct undefined_handler gdb_uh_thumb; @@ -174,6 +220,10 @@ for (loop = 0; loop < NUM_UNKNOWN_HANDLERS; ++loop) LIST_INIT(&undefined_handlers[loop]); + /* Install handler for CP15 emulation */ + cp15_uh.uh_handler = cp15_trapper; + install_coproc_handler_static(SYSTEM_COPROC, &cp15_uh); + /* Install handler for GDB breakpoints */ gdb_uh.uh_handler = gdb_trapper; install_coproc_handler_static(CORE_UNKNOWN_HANDLER, &gdb_uh);
CVS commit: src/sys/arch/arm/include
Module Name:src Committed By: matt Date: Thu Apr 7 11:01:49 UTC 2011 Modified Files: src/sys/arch/arm/include: pcb.h Log Message: Add a define for pcb_user_pid_rw To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/include/pcb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/include/pcb.h diff -u src/sys/arch/arm/include/pcb.h:1.19 src/sys/arch/arm/include/pcb.h:1.20 --- src/sys/arch/arm/include/pcb.h:1.19 Sun Apr 27 18:58:44 2008 +++ src/sys/arch/arm/include/pcb.h Thu Apr 7 11:01:49 2011 @@ -71,6 +71,7 @@ #define pcb_l1vec pcb_un.un_32.pcb32_l1vec #define pcb_dacr pcb_un.un_32.pcb32_dacr #define pcb_cstate pcb_un.un_32.pcb32_cstate +#define pcb_user_pid_rw pcb_un.un_32.pcb32_user_pid_rw struct pcb_arm26 { struct switchframe *pcb26_sf;
CVS commit: src/sys/arch/arm/include
Module Name:src Committed By: matt Date: Thu Apr 7 10:20:29 UTC 2011 Modified Files: src/sys/arch/arm/include: mcontext.h types.h Log Message: Add __lwp_getprivate_fast To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/include/mcontext.h cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/include/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/include/mcontext.h diff -u src/sys/arch/arm/include/mcontext.h:1.8 src/sys/arch/arm/include/mcontext.h:1.9 --- src/sys/arch/arm/include/mcontext.h:1.8 Thu Feb 24 04:28:45 2011 +++ src/sys/arch/arm/include/mcontext.h Thu Apr 7 10:20:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mcontext.h,v 1.8 2011/02/24 04:28:45 joerg Exp $ */ +/* $NetBSD: mcontext.h,v 1.9 2011/04/07 10:20:29 matt Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -109,4 +109,12 @@ #define __UCONTEXT_SIZE 256 +static __inline void * +__lwp_getprivate_fast(void) +{ + void *rv; + __asm("mrc p15, 0, %0, c13, c0, 3" : "=r"(rv)); + return rv; +} + #endif /* !_ARM_MCONTEXT_H_ */ Index: src/sys/arch/arm/include/types.h diff -u src/sys/arch/arm/include/types.h:1.18 src/sys/arch/arm/include/types.h:1.19 --- src/sys/arch/arm/include/types.h:1.18 Wed Dec 22 01:04:23 2010 +++ src/sys/arch/arm/include/types.h Thu Apr 7 10:20:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.18 2010/12/22 01:04:23 matt Exp $ */ +/* $NetBSD: types.h,v 1.19 2011/04/07 10:20:29 matt Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -84,6 +84,7 @@ #define __HAVE_SYSCALL_INTERN #define __HAVE_MINIMAL_EMUL #define __HAVE_CPU_DATA_FIRST +#define __HAVE___LWP_GETPRIVATE_FAST #if defined(_KERNEL) #define __HAVE_RAS
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: matt Date: Thu Apr 7 10:07:11 UTC 2011 Modified Files: src/sys/arch/arm/arm32: sys_machdep.c Log Message: Don't use the pcb anymore since the user read-only thread and process id value is now grabbed from l_private. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/arm32/sys_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/sys_machdep.c diff -u src/sys/arch/arm/arm32/sys_machdep.c:1.11 src/sys/arch/arm/arm32/sys_machdep.c:1.12 --- src/sys/arch/arm/arm32/sys_machdep.c:1.11 Wed Jul 7 01:20:49 2010 +++ src/sys/arch/arm/arm32/sys_machdep.c Thu Apr 7 10:07:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.11 2010/07/07 01:20:49 chs Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.12 2011/04/07 10:07:11 matt Exp $ */ /* * Copyright (c) 1995-1997 Mark Brinicombe. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.11 2010/07/07 01:20:49 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.12 2011/04/07 10:07:11 matt Exp $"); #include #include @@ -115,14 +115,11 @@ cpu_lwp_setprivate(lwp_t *l, void *addr) { #ifdef _ARM_ARCH_6 - struct pcb *pcb; - - pcb = lwp_getpcb(l); - kpreempt_disable(); - pcb->pcb_un.un_32.pcb32_user_pid_ro = (u_int)addr; - if (l == curlwp) + if (l == curlwp) { + kpreempt_disable(); __asm("mcr p15, 0, %0, c13, c0, 3" : : "r" (addr)); - kpreempt_enable(); + kpreempt_enable(); + } return 0; #else return ENOSYS;
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: matt Date: Thu Apr 7 10:03:47 UTC 2011 Modified Files: src/sys/arch/arm/arm32: cpuswitch.S genassym.cf Log Message: Fetch user read-only thread and process id from l->l_private, not the pcb. (need to g/c the pcb field formerly used for this). To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/arm/arm32/cpuswitch.S cvs rdiff -u -r1.45 -r1.46 src/sys/arch/arm/arm32/genassym.cf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/cpuswitch.S diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.62 src/sys/arch/arm/arm32/cpuswitch.S:1.63 --- src/sys/arch/arm/arm32/cpuswitch.S:1.62 Tue Feb 1 01:20:14 2011 +++ src/sys/arch/arm/arm32/cpuswitch.S Thu Apr 7 10:03:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuswitch.S,v 1.62 2011/02/01 01:20:14 matt Exp $ */ +/* $NetBSD: cpuswitch.S,v 1.63 2011/04/07 10:03:47 matt Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -89,7 +89,7 @@ #include #include - RCSID("$NetBSD: cpuswitch.S,v 1.62 2011/02/01 01:20:14 matt Exp $") + RCSID("$NetBSD: cpuswitch.S,v 1.63 2011/04/07 10:03:47 matt Exp $") /* LINTSTUB: include */ @@ -258,7 +258,7 @@ */ ldr r0, [r7, #(PCB_USER_PID_RW)] mcr p15, 0, r0, c13, c0, 2 - ldr r0, [r7, #(PCB_USER_PID_RO)] + ldr r0, [r6, #(L_PRIVATE)] mcr p15, 0, r0, c13, c0, 3 #endif Index: src/sys/arch/arm/arm32/genassym.cf diff -u src/sys/arch/arm/arm32/genassym.cf:1.45 src/sys/arch/arm/arm32/genassym.cf:1.46 --- src/sys/arch/arm/arm32/genassym.cf:1.45 Mon Jan 31 06:26:54 2011 +++ src/sys/arch/arm/arm32/genassym.cf Thu Apr 7 10:03:47 2011 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.45 2011/01/31 06:26:54 matt Exp $ +# $NetBSD: genassym.cf,v 1.46 2011/04/07 10:03:47 matt Exp $ # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -108,6 +108,7 @@ define L_STAT offsetof(struct lwp, l_stat) define L_PROC offsetof(struct lwp, l_proc) define L_CTXSWTCH offsetof(struct lwp, l_ctxswtch) +define L_PRIVATE offsetof(struct lwp, l_private) define P_RASLIST offsetof(struct proc, p_raslist) define PCB_TF offsetof(struct pcb, pcb_tf) @@ -121,7 +122,6 @@ define PCB_LR offsetof(struct pcb, pcb_un.un_32.pcb32_lr) define PCB_PC offsetof(struct pcb, pcb_un.un_32.pcb32_pc) define PCB_USER_PID_RW offsetof(struct pcb, pcb_un.un_32.pcb32_user_pid_rw) -define PCB_USER_PID_RO offsetof(struct pcb, pcb_un.un_32.pcb32_user_pid_ro) define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) define PCB_NOALIGNFLT PCB_NOALIGNFLT
CVS commit: src/tests/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Apr 7 08:29:51 UTC 2011 Modified Files: src/tests/lib/libbluetooth: t_bluetooth.c t_sdp_data.c t_sdp_get.c t_sdp_match.c t_sdp_put.c t_sdp_set.c Log Message: whitespace police To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libbluetooth/t_bluetooth.c \ src/tests/lib/libbluetooth/t_sdp_data.c \ src/tests/lib/libbluetooth/t_sdp_get.c \ src/tests/lib/libbluetooth/t_sdp_match.c \ src/tests/lib/libbluetooth/t_sdp_put.c \ src/tests/lib/libbluetooth/t_sdp_set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libbluetooth/t_bluetooth.c diff -u src/tests/lib/libbluetooth/t_bluetooth.c:1.1 src/tests/lib/libbluetooth/t_bluetooth.c:1.2 --- src/tests/lib/libbluetooth/t_bluetooth.c:1.1 Thu Apr 7 06:21:57 2011 +++ src/tests/lib/libbluetooth/t_bluetooth.c Thu Apr 7 08:29:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_bluetooth.c,v 1.1 2011/04/07 06:21:57 plunky Exp $ */ +/* $NetBSD: t_bluetooth.c,v 1.2 2011/04/07 08:29:50 plunky Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,10 +38,10 @@ ATF_TC_HEAD(check_bt_aton, tc) { - + atf_tc_set_md_var(tc, "descr", "Test bt_aton results"); } - + ATF_TC_BODY(check_bt_aton, tc) { bdaddr_t bdaddr; @@ -66,10 +66,10 @@ ATF_TC_HEAD(check_bt_ntoa, tc) { - + atf_tc_set_md_var(tc, "descr", "Test bt_ntoa results"); } - + ATF_TC_BODY(check_bt_ntoa, tc) { bdaddr_t bdaddr = { { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 } }; Index: src/tests/lib/libbluetooth/t_sdp_data.c diff -u src/tests/lib/libbluetooth/t_sdp_data.c:1.1 src/tests/lib/libbluetooth/t_sdp_data.c:1.2 --- src/tests/lib/libbluetooth/t_sdp_data.c:1.1 Thu Apr 7 06:21:57 2011 +++ src/tests/lib/libbluetooth/t_sdp_data.c Thu Apr 7 08:29:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_sdp_data.c,v 1.1 2011/04/07 06:21:57 plunky Exp $ */ +/* $NetBSD: t_sdp_data.c,v 1.2 2011/04/07 08:29:50 plunky Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,10 +37,10 @@ ATF_TC_HEAD(check_sdp_data_type, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_data_type results"); } - + ATF_TC_BODY(check_sdp_data_type, tc) { uint8_t data[] = { @@ -63,10 +63,10 @@ ATF_TC_HEAD(check_sdp_data_size, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_data_size results"); } - + ATF_TC_BODY(check_sdp_data_size, tc) { uint8_t data[] = { Index: src/tests/lib/libbluetooth/t_sdp_get.c diff -u src/tests/lib/libbluetooth/t_sdp_get.c:1.1 src/tests/lib/libbluetooth/t_sdp_get.c:1.2 --- src/tests/lib/libbluetooth/t_sdp_get.c:1.1 Thu Apr 7 06:21:57 2011 +++ src/tests/lib/libbluetooth/t_sdp_get.c Thu Apr 7 08:29:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_sdp_get.c,v 1.1 2011/04/07 06:21:57 plunky Exp $ */ +/* $NetBSD: t_sdp_get.c,v 1.2 2011/04/07 08:29:50 plunky Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -39,10 +39,10 @@ ATF_TC_HEAD(check_sdp_get_data, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_data results"); } - + ATF_TC_BODY(check_sdp_get_data, tc) { uint8_t data[] = { @@ -87,10 +87,10 @@ ATF_TC_HEAD(check_sdp_get_attr, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_attr results"); } - + ATF_TC_BODY(check_sdp_get_attr, tc) { uint8_t data[] = { @@ -132,10 +132,10 @@ ATF_TC_HEAD(check_sdp_get_uuid, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_uuid results"); } - + ATF_TC_BODY(check_sdp_get_uuid, tc) { uint8_t data[] = { @@ -201,10 +201,10 @@ ATF_TC_HEAD(check_sdp_get_bool, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_bool results"); } - + ATF_TC_BODY(check_sdp_get_bool, tc) { uint8_t data[] = { @@ -237,10 +237,10 @@ ATF_TC_HEAD(check_sdp_get_uint, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_uint results"); } - + ATF_TC_BODY(check_sdp_get_uint, tc) { uint8_t data[] = { @@ -330,10 +330,10 @@ ATF_TC_HEAD(check_sdp_get_int, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_int results"); } - + ATF_TC_BODY(check_sdp_get_int, tc) { uint8_t data[] = { @@ -459,10 +459,10 @@ ATF_TC_HEAD(check_sdp_get_seq, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_seq results"); } - + ATF_TC_BODY(check_sdp_get_seq, tc) { uint8_t data[] = { @@ -499,10 +499,10 @@ ATF_TC_HEAD(check_sdp_get_alt, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_alt results"); } - + ATF_TC_BODY(check_sdp_get_alt, tc) { uint8_t data[] = { @@ -539,10 +539,10 @@ ATF_TC_HEAD(check_sdp_get_str, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_str results"); } - + ATF_TC_BODY(check_sdp_get_str, tc) { uint8_t data[] = { @@ -584,10 +584,10 @@ ATF_TC_HEAD(check_sdp_get_url, tc) { - + atf_tc_set_md_var(tc, "descr", "Test sdp_get_url results"); } - + ATF_TC_BODY(check_sdp_get_url, t
CVS commit: [netbsd-5-1] src/doc
Module Name:src Committed By: snj Date: Thu Apr 7 07:01:23 UTC 2011 Modified Files: src/doc [netbsd-5-1]: CHANGES-5.1.1 Log Message: 1594 To generate a diff of this commit: cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/CHANGES-5.1.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-5.1.1 diff -u src/doc/CHANGES-5.1.1:1.1.2.20 src/doc/CHANGES-5.1.1:1.1.2.21 --- src/doc/CHANGES-5.1.1:1.1.2.20 Tue Apr 5 06:23:45 2011 +++ src/doc/CHANGES-5.1.1 Thu Apr 7 07:01:23 2011 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-5.1.1,v 1.1.2.20 2011/04/05 06:23:45 riz Exp $ +# $NetBSD: CHANGES-5.1.1,v 1.1.2.21 2011/04/07 07:01:23 snj Exp $ A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.1.1 release: @@ -2364,3 +2364,28 @@ Protect against stack smashes. [christos, ticket #1593] +xsrc/external/mit/xrdb/dist/COPYING patch +xsrc/external/mit/xrdb/dist/ChangeLog patch +xsrc/external/mit/xrdb/dist/Makefile.am patch +xsrc/external/mit/xrdb/dist/Makefile.in patch +xsrc/external/mit/xrdb/dist/README patch +xsrc/external/mit/xrdb/dist/aclocal.m4 patch +xsrc/external/mit/xrdb/dist/config.guess patch +xsrc/external/mit/xrdb/dist/config.h.in patch +xsrc/external/mit/xrdb/dist/config.sub patch +xsrc/external/mit/xrdb/dist/configure patch +xsrc/external/mit/xrdb/dist/configure.ac patch +xsrc/external/mit/xrdb/dist/depcomp patch +xsrc/external/mit/xrdb/dist/install-sh patch +xsrc/external/mit/xrdb/dist/missing patch +xsrc/external/mit/xrdb/dist/xrdb.c patch +xsrc/external/mit/xrdb/dist/xrdb.man patch +xsrc/external/mit/xrdb/dist/man/Makefile.am patch +xsrc/external/mit/xrdb/dist/man/Makefile.in patch +xsrc/external/mit/xrdb/dist/man/xrdb.man patch +xsrc/xfree/xc/programs/xrdb/xrdb.c patch +external/mit/xorg/bin/xrdb/Makefile patch + + Fix CVE-2011-0465 + [mrg, ticket #1594] +