Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpkern Follow the syscall() logic and mas...



details:   https://anonhg.NetBSD.org/src/rev/df1c17fc1cfc
branches:  trunk
changeset: 934385:df1c17fc1cfc
user:      kamil <kamil%NetBSD.org@localhost>
date:      Thu Jun 11 00:33:30 2020 +0000

description:
Follow the syscall() logic and mask unsupported syscall ranges in rump

Avoids invalid pointer dereference from too large syscall numbers.

diffstat:

 sys/rump/librump/rumpkern/rump.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 450cbfc891bb -r df1c17fc1cfc sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Wed Jun 10 22:45:15 2020 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Thu Jun 11 00:33:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.348 2020/05/23 23:42:44 ad Exp $    */
+/*     $NetBSD: rump.c,v 1.349 2020/06/11 00:33:30 kamil Exp $ */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.348 2020/05/23 23:42:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.349 2020/06/11 00:33:30 kamil Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -756,7 +756,9 @@
        p = curproc;
        e = p->p_emul;
 #ifndef __HAVE_MINIMAL_EMUL
-       KASSERT(num > 0 && num < e->e_nsysent);
+       num &= e->e_nsysent - 1;
+#else
+       num &= SYS_NSYSENT - 1;
 #endif
        callp = e->e_sysent + num;
 



Home | Main Index | Thread Index | Old Index