Module Name: src Committed By: drochner Date: Thu Dec 10 12:39:12 UTC 2009
Modified Files: src/sys/kern: kern_time.c Log Message: 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.162 -r1.163 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.162 src/sys/kern/kern_time.c:1.163 --- src/sys/kern/kern_time.c:1.162 Sat Oct 3 20:48:42 2009 +++ src/sys/kern/kern_time.c Thu Dec 10 12:39:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.162 2009/10/03 20:48:42 elad Exp $ */ +/* $NetBSD: kern_time.c,v 1.163 2009/12/10 12:39:12 drochner 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.162 2009/10/03 20:48:42 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.163 2009/12/10 12:39:12 drochner Exp $"); #include <sys/param.h> #include <sys/resourcevar.h> @@ -531,7 +531,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); }