Author: gordon
Date: Thu Sep 27 18:39:54 2018
New Revision: 338982
URL: https://svnweb.freebsd.org/changeset/base/338982

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

Modified:
  head/sys/kern/kern_context.c

Modified: head/sys/kern/kern_context.c
==============================================================================
--- head/sys/kern/kern_context.c        Thu Sep 27 18:36:30 2018        
(r338981)
+++ head/sys/kern/kern_context.c        Thu Sep 27 18:39:54 2018        
(r338982)
@@ -70,6 +70,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;
@@ -110,6 +111,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);
_______________________________________________
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