Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Nov 2018 21:19:59 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@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: r341165 - in stable/11/sys: amd64/ia32 mips/mips powerpc/powerpc
Message-ID:  <201811282119.wASLJxuY033505@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Wed Nov 28 21:19:58 2018
New Revision: 341165
URL: https://svnweb.freebsd.org/changeset/base/341165

Log:
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Security:	FreeBSD-EN-18:12.mem
  Security:	CVE-2018-17155
  Sponsored by:	Dell EMC Isilon

Modified:
  stable/11/sys/amd64/ia32/ia32_signal.c
  stable/11/sys/mips/mips/freebsd32_machdep.c
  stable/11/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- stable/11/sys/amd64/ia32/ia32_signal.c	Wed Nov 28 20:03:53 2018	(r341164)
+++ stable/11/sys/amd64/ia32/ia32_signal.c	Wed Nov 28 21:19:58 2018	(r341165)
@@ -260,6 +260,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
 	if (uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(uc));
 		ia32_get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
@@ -300,6 +301,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
 	if (uap->oucp == NULL || uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(uc));
 		ia32_get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;

Modified: stable/11/sys/mips/mips/freebsd32_machdep.c
==============================================================================
--- stable/11/sys/mips/mips/freebsd32_machdep.c	Wed Nov 28 20:03:53 2018	(r341164)
+++ stable/11/sys/mips/mips/freebsd32_machdep.c	Wed Nov 28 21:19:58 2018	(r341165)
@@ -290,6 +290,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
 	if (uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(uc));
 		get_mcontext32(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
@@ -329,6 +330,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
 	if (uap->oucp == NULL || uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(uc));
 		get_mcontext32(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;

Modified: stable/11/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- stable/11/sys/powerpc/powerpc/exec_machdep.c	Wed Nov 28 20:03:53 2018	(r341164)
+++ stable/11/sys/powerpc/powerpc/exec_machdep.c	Wed Nov 28 21:19:58 2018	(r341165)
@@ -801,6 +801,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
 	if (uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(uc));
 		get_mcontext32(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
@@ -840,6 +841,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
 	if (uap->oucp == NULL || uap->ucp == NULL)
 		ret = EINVAL;
 	else {
+		bzero(&uc, sizeof(uc));
 		get_mcontext32(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;



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