Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Avoid negating the minimum size of pid_t (this over...
details: https://anonhg.NetBSD.org/src/rev/e7c22fe202f0
branches: trunk
changeset: 958112:e7c22fe202f0
user: nia <nia%NetBSD.org@localhost>
date: Thu Dec 24 12:14:50 2020 +0000
description:
Avoid negating the minimum size of pid_t (this overflows).
Reported-by: syzbot+e2eb02f9dfaf4f2e6626%syzkaller.appspotmail.com@localhost
diffstat:
sys/kern/kern_descrip.c | 7 +++++--
sys/kern/kern_proc.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diffs (56 lines):
diff -r 255cbbcc1bab -r e7c22fe202f0 sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c Thu Dec 24 10:37:47 2020 +0000
+++ b/sys/kern/kern_descrip.c Thu Dec 24 12:14:50 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_descrip.c,v 1.249 2020/08/28 10:20:14 christos Exp $ */
+/* $NetBSD: kern_descrip.c,v 1.250 2020/12/24 12:14:50 nia Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.249 2020/08/28 10:20:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.250 2020/12/24 12:14:50 nia Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1767,6 +1767,9 @@
pid_t id = *(const pid_t *)data;
int error;
+ if (id == INT_MIN)
+ return EINVAL;
+
switch (cmd) {
case TIOCSPGRP:
if (id < 0)
diff -r 255cbbcc1bab -r e7c22fe202f0 sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c Thu Dec 24 10:37:47 2020 +0000
+++ b/sys/kern/kern_proc.c Thu Dec 24 12:14:50 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_proc.c,v 1.261 2020/09/17 11:37:35 martin Exp $ */
+/* $NetBSD: kern_proc.c,v 1.262 2020/12/24 12:14:50 nia Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.261 2020/09/17 11:37:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.262 2020/12/24 12:14:50 nia Exp $");
#ifdef _KERNEL_OPT
#include "opt_kstack.h"
@@ -619,6 +619,9 @@
struct session *session;
int error;
+ if (pg_id == INT_MIN)
+ return EINVAL;
+
mutex_enter(&proc_lock);
if (pg_id < 0) {
struct proc *p1 = proc_find(-pg_id);
Home |
Main Index |
Thread Index |
Old Index