Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Sep 2018 18:42:41 +0000 (UTC)
From:      Gordon Tetlow <gordon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r338983 - stable/11/sys/kern
Message-ID:  <201809271842.w8RIgfvm079366@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gordon
Date: Thu Sep 27 18:42:40 2018
New Revision: 338983
URL: https://svnweb.freebsd.org/changeset/base/338983

Log:
  MFC r338982.
  
  Clear stack allocated data structure to prevent kernel memory leak.
  
  Reported by:	Thomas Barabosch, Fraunhofer FKIE
  Reviewed by:	wes@
  Approved by:	so
  Security:	FreeBSD-EN-18:12.mem
  Security:	CVE-2018-17155

Modified:
  stable/11/sys/kern/kern_context.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_context.c
==============================================================================
--- stable/11/sys/kern/kern_context.c	Thu Sep 27 18:39:54 2018	(r338982)
+++ stable/11/sys/kern/kern_context.c	Thu Sep 27 18:42:40 2018	(r338983)
@@ -68,6 +68,7 @@ sys_getcontext(struct thread *td, struct getcontext_ar
 	if (uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(ucontext_t));
 		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
@@ -108,6 +109,7 @@ sys_swapcontext(struct thread *td, struct swapcontext_
 	if (uap->oucp == NULL || uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(ucontext_t));
 		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		bzero(uc.__spare__, sizeof(uc.__spare__));
 		PROC_LOCK(td->td_proc);



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