Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern If a struct sigevent with SIGEV_SIGNAL is passed to...



details:   https://anonhg.NetBSD.org/src/rev/00b182702cec
branches:  trunk
changeset: 749824:00b182702cec
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Dec 10 12:39:12 2009 +0000

description:
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.

diffstat:

 sys/kern/kern_time.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r d787cdebeb39 -r 00b182702cec sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Thu Dec 10 12:29:44 2009 +0000
+++ b/sys/kern/kern_time.c      Thu Dec 10 12:39:12 2009 +0000
@@ -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);
                }



Home | Main Index | Thread Index | Old Index