svn commit: r325567 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Nov 8 23:32:57 UTC 2017


Author: kib
Date: Wed Nov  8 23:32:56 2017
New Revision: 325567
URL: https://svnweb.freebsd.org/changeset/base/325567

Log:
  Zero whole struct ptrace_lwpinfo to not leak kernel stack data.
  
  Reported by:	Ilja Van Sprundel <ivansprundel at ioactive.com>
  Discussed with:	secteam
  Reviewed by:	jhb
  Sponsored by:	The FreeBSD Foundation
  MFC after:	3 days
  Differential revision:	https://reviews.freebsd.org/D12796

Modified:
  head/sys/kern/sys_process.c

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Wed Nov  8 23:25:05 2017	(r325566)
+++ head/sys/kern/sys_process.c	Wed Nov  8 23:32:56 2017	(r325567)
@@ -504,6 +504,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;
@@ -1323,6 +1324,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;
@@ -1343,8 +1345,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi
 				pl->pl_siginfo = td2->td_si;
 			}
 		}
-		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-head mailing list