Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Nov 2017 23:32:56 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325567 - head/sys/kern
Message-ID:  <201711082332.vA8NWuur038050@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711082332.vA8NWuur038050>