Author: vangyzen
Date: Wed Nov 28 16:20:04 2018
New Revision: 341149
URL: https://svnweb.freebsd.org/changeset/base/341149

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

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

Modified: releng/12.0/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- releng/12.0/sys/amd64/ia32/ia32_signal.c    Wed Nov 28 16:00:52 2018        
(r341148)
+++ releng/12.0/sys/amd64/ia32/ia32_signal.c    Wed Nov 28 16:20:04 2018        
(r341149)
@@ -261,6 +261,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;
@@ -301,6 +302,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: releng/12.0/sys/mips/mips/freebsd32_machdep.c
==============================================================================
--- releng/12.0/sys/mips/mips/freebsd32_machdep.c       Wed Nov 28 16:00:52 
2018        (r341148)
+++ releng/12.0/sys/mips/mips/freebsd32_machdep.c       Wed Nov 28 16:20:04 
2018        (r341149)
@@ -294,6 +294,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;
@@ -333,6 +334,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: releng/12.0/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- releng/12.0/sys/powerpc/powerpc/exec_machdep.c      Wed Nov 28 16:00:52 
2018        (r341148)
+++ releng/12.0/sys/powerpc/powerpc/exec_machdep.c      Wed Nov 28 16:20:04 
2018        (r341149)
@@ -783,6 +783,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;
@@ -822,6 +823,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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to