Module Name:    src
Committed By:   kamil
Date:           Sat Feb 11 19:32:41 UTC 2017

Modified Files:
        src/sys/kern: sys_ptrace_common.c

Log Message:
Be paranoid about PT_SET_SIGINFO and PT_GET_SIGINFO in ptrace(2)

Currently a tracer is prohibited to read and write memory of a tracee.
Prohibit reading and faking signal information.

Sponsored by <The NetBSD Foundation>


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.12 src/sys/kern/sys_ptrace_common.c:1.13
--- src/sys/kern/sys_ptrace_common.c:1.12	Thu Jan 26 03:54:01 2017
+++ src/sys/kern/sys_ptrace_common.c	Sat Feb 11 19:32:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.12 2017/01/26 03:54:01 christos Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.13 2017/02/11 19:32:41 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.12 2017/01/26 03:54:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.13 2017/02/11 19:32:41 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -404,6 +404,8 @@ do_ptrace(struct ptrace_methods *ptm, st
 	case  PT_WRITE_I:
 	case  PT_WRITE_D:
 	case  PT_IO:
+	case  PT_SET_SIGINFO:
+	case  PT_GET_SIGINFO:
 #ifdef PT_GETREGS
 	case  PT_GETREGS:
 #endif
@@ -451,8 +453,6 @@ do_ptrace(struct ptrace_methods *ptm, st
 	case  PT_SET_EVENT_MASK:
 	case  PT_GET_EVENT_MASK:
 	case  PT_GET_PROCESS_STATE:
-	case  PT_SET_SIGINFO:
-	case  PT_GET_SIGINFO:
 		/*
 		 * You can't do what you want to the process if:
 		 *	(1) It's not being traced at all,

Reply via email to