Module Name: src Committed By: snj Date: Thu Dec 10 23:12:18 UTC 2009
Modified Files: src/sys/kern [netbsd-5-0]: kern_time.c Log Message: Pull up following revision(s) (requested by drochner in ticket #1189): sys/kern/kern_time.c: revision 1.163 If a struct sigevent with SIGEV_SIGNAL is passed to timer_create(2), check the signal number to be in the allowed range. An invalid signal number could crash the kernel by overflowing the sigset_t array. More checks would be good, and SIGEV_THREAD shouldn't be dropped silently, but this fixes at least the local DOS vulnerability. To generate a diff of this commit: cvs rdiff -u -r1.155.4.2 -r1.155.4.2.2.1 src/sys/kern/kern_time.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/kern/kern_time.c diff -u src/sys/kern/kern_time.c:1.155.4.2 src/sys/kern/kern_time.c:1.155.4.2.2.1 --- src/sys/kern/kern_time.c:1.155.4.2 Sun Feb 8 20:38:49 2009 +++ src/sys/kern/kern_time.c Thu Dec 10 23:12:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.155.4.2 2009/02/08 20:38:49 snj Exp $ */ +/* $NetBSD: kern_time.c,v 1.155.4.2.2.1 2009/12/10 23:12:18 snj Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.155.4.2 2009/02/08 20:38:49 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.155.4.2.2.1 2009/12/10 23:12:18 snj Exp $"); #include <sys/param.h> #include <sys/resourcevar.h> @@ -536,7 +536,10 @@ if (((error = (*fetch_event)(evp, &pt->pt_ev, sizeof(pt->pt_ev))) != 0) || ((pt->pt_ev.sigev_notify < SIGEV_NONE) || - (pt->pt_ev.sigev_notify > SIGEV_SA))) { + (pt->pt_ev.sigev_notify > SIGEV_SA)) || + (pt->pt_ev.sigev_notify == SIGEV_SIGNAL && + (pt->pt_ev.sigev_signo <= 0 || + pt->pt_ev.sigev_signo >= NSIG))) { pool_put(&ptimer_pool, pt); return (error ? error : EINVAL); }