Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Sanitize the pid and lid arguments passed to do_sch...
details: https://anonhg.NetBSD.org/src/rev/f1ca3abee9b9
branches: trunk
changeset: 1009624:f1ca3abee9b9
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Apr 29 01:53:48 2020 +0000
description:
Sanitize the pid and lid arguments passed to do_sched_getparam()
and sys__sched_getaffinity() now that -1 as the pid argument to
lwp_find2() means "wildcard proc".
diffstat:
sys/kern/sys_sched.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (38 lines):
diff -r de2912b05484 -r f1ca3abee9b9 sys/kern/sys_sched.c
--- a/sys/kern/sys_sched.c Wed Apr 29 01:52:26 2020 +0000
+++ b/sys/kern/sys_sched.c Wed Apr 29 01:53:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_sched.c,v 1.47 2020/01/27 22:05:10 ad Exp $ */
+/* $NetBSD: sys_sched.c,v 1.48 2020/04/29 01:53:48 thorpej Exp $ */
/*
* Copyright (c) 2008, 2011 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_sched.c,v 1.47 2020/01/27 22:05:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_sched.c,v 1.48 2020/04/29 01:53:48 thorpej Exp $");
#include <sys/param.h>
@@ -231,6 +231,9 @@
struct lwp *t;
int error, lpolicy;
+ if (pid < 0 || lid < 0)
+ return EINVAL;
+
t = lwp_find2(pid, lid); /* acquire p_lock */
if (t == NULL)
return ESRCH;
@@ -498,6 +501,9 @@
kcpuset_t *kcset;
int error;
+ if (SCARG(uap, pid) < 0 || SCARG(uap, lid) < 0)
+ return EINVAL;
+
error = genkcpuset(&kcset, SCARG(uap, cpuset), SCARG(uap, size));
if (error)
return error;
Home |
Main Index |
Thread Index |
Old Index