svn commit: r325643 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Fri Nov 10 12:31:59 UTC 2017


Author: kib
Date: Fri Nov 10 12:31:58 2017
New Revision: 325643
URL: https://svnweb.freebsd.org/changeset/base/325643

Log:
  MFC r325567:
  Zero whole struct ptrace_lwpinfo to not leak kernel stack data.
  
  Security:	CVE-2017-1086

Modified:
  stable/10/sys/kern/sys_process.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/sys_process.c
==============================================================================
--- stable/10/sys/kern/sys_process.c	Fri Nov 10 12:28:43 2017	(r325642)
+++ stable/10/sys/kern/sys_process.c	Fri Nov 10 12:31:58 2017	(r325643)
@@ -474,6 +474,7 @@ ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl,
     struct ptrace_lwpinfo32 *pl32)
 {
 
+	bzero(pl32, sizeof(*pl32));
 	pl32->pl_lwpid = pl->pl_lwpid;
 	pl32->pl_event = pl->pl_event;
 	pl32->pl_flags = pl->pl_flags;
@@ -1276,6 +1277,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi
 		} else
 #endif
 		pl = addr;
+		bzero(pl, sizeof(*pl));
 		pl->pl_lwpid = td2->td_tid;
 		pl->pl_event = PL_EVENT_NONE;
 		pl->pl_flags = 0;
@@ -1296,8 +1298,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi
 				pl->pl_siginfo = td2->td_dbgksi.ksi_info;
 			}
 		}
-		if ((pl->pl_flags & PL_FLAG_SI) == 0)
-			bzero(&pl->pl_siginfo, sizeof(pl->pl_siginfo));
 		if (td2->td_dbgflags & TDB_SCE)
 			pl->pl_flags |= PL_FLAG_SCE;
 		else if (td2->td_dbgflags & TDB_SCX)


More information about the svn-src-all mailing list