Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Apr 2011 01:47:40 +0200
From:      Oliver Pinter <oliver.pntr@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   Re: svn commit: r218836 - in stable/8/sys: amd64/amd64 amd64/ia32 i386/i386 kern
Message-ID:  <BANLkTimcsG38oVAXCMbMi25nXDxhC2GWyw@mail.gmail.com>
In-Reply-To: <20110416221915.GR48734@deviant.kiev.zoral.com.ua>
References:  <201102190739.p1J7dFjO087910@svn.freebsd.org> <BANLkTimOC-KrWNyDttZ_-iz4S0FH73p43Q@mail.gmail.com> <20110416221915.GR48734@deviant.kiev.zoral.com.ua>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
tested on: FreeBSD pandora-d 7.4-STABLE FreeBSD 7.4-STABLE #77
r220609+b221718: Sun Apr 17 01:00:01 CEST 2011
root@pandora-d:/usr/obj/usr/src/sys/stable  amd64



On 4/17/11, Kostik Belousov <kostikbel@gmail.com> wrote:
> On Sat, Apr 16, 2011 at 11:04:38PM +0200, Oliver Pinter wrote:
>> MFC this for 7-STABLE?
> I do not reject the proposal, but I am quite curious why ?

I think, it is not bad, when cleaning out some generated section after not used.
(~ ITSec)

>
> I do not have any machine running 7, so please test the patch below.
> It compiled for me on amd64.
>
> Property changes on: .
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys:r218327
>
> Index: kern/kern_context.c
> ===================================================================
> --- kern/kern_context.c	(revision 220730)
> +++ kern/kern_context.c	(working copy)
> @@ -71,6 +71,7 @@
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> +		bzero(uc.__spare__, sizeof(uc.__spare__));
>  		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
>  	}
>  	return (ret);
> @@ -109,6 +110,7 @@
>  		ret = EINVAL;
>  	else {
>  		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
> +		bzero(uc.__spare__, sizeof(uc.__spare__));
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> Index: i386/i386/machdep.c
> ===================================================================
> --- i386/i386/machdep.c	(revision 220730)
> +++ i386/i386/machdep.c	(working copy)
> @@ -342,12 +342,14 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
> +	bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
>  		sf.sf_siginfo.si_signo = sig;
>  		sf.sf_siginfo.si_code = ksi->ksi_code;
>  		sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher;
> +		sf.sf_addr = 0;
>  	} else {
>  		/* Old FreeBSD-style arguments. */
>  		sf.sf_arg2 = ksi->ksi_code;
> @@ -461,6 +463,11 @@
>  	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
>  	sf.sf_uc.uc_mcontext.mc_gs = rgs();
>  	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
> +	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
> +	bzero(sf.sf_uc.uc_mcontext.__spare__,
> +	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -480,6 +487,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (register_t)&sfp->sf_si;
> @@ -596,6 +604,11 @@
>  	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
>  	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
>  	fpstate_drop(td);
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -617,6 +630,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (register_t)&sfp->sf_si;
> @@ -2716,6 +2730,8 @@
>  	mcp->mc_ss = tp->tf_ss;
>  	mcp->mc_len = sizeof(*mcp);
>  	get_fpcontext(td, mcp);
> +	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
> +	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
>  	return (0);
>  }
>
> @@ -2763,6 +2779,7 @@
>  #ifndef DEV_NPX
>  	mcp->mc_fpformat = _MC_FPFMT_NODEV;
>  	mcp->mc_ownedfp = _MC_FPOWNED_NONE;
> +	bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
>  #else
>  	union savefpu *addr;
>
>
> Property changes on: contrib/pf
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys/contrib/pf:r218327
>
>
> Property changes on: contrib/dev/acpica
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys/contrib/dev/acpica:r218327
>
>
> Property changes on: cddl/contrib/opensolaris
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys/cddl/contrib/opensolaris:r218327
>
> Index: amd64/amd64/machdep.c
> ===================================================================
> --- amd64/amd64/machdep.c	(revision 220730)
> +++ amd64/amd64/machdep.c	(working copy)
> @@ -306,6 +306,9 @@
>  	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
>  	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
>  	fpstate_drop(td);
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -327,6 +330,7 @@
>  	/* Build the argument list for the signal handler. */
>  	regs->tf_rdi = sig;			/* arg 1 in %rdi */
>  	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		regs->tf_rsi = (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
> @@ -1653,6 +1657,7 @@
>  	mcp->mc_ss = tp->tf_ss;
>  	mcp->mc_len = sizeof(*mcp);
>  	get_fpcontext(td, mcp);
> +	bzero(mcp->mc_spare, sizeof(mcp->mc_spare));
>  	return (0);
>  }
>
> Index: amd64/ia32/ia32_signal.c
> ===================================================================
> --- amd64/ia32/ia32_signal.c	(revision 220730)
> +++ amd64/ia32/ia32_signal.c	(working copy)
> @@ -158,6 +158,8 @@
>  	mcp->mc_ss = tp->tf_ss;
>  	mcp->mc_len = sizeof(*mcp);
>  	ia32_get_fpcontext(td, mcp);
> +	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
> +	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
>  	return (0);
>  }
>
> @@ -226,6 +228,7 @@
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> +		bzero(&uc.__spare__, sizeof(uc.__spare__));
>  		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
>  	}
>  	return (ret);
> @@ -345,6 +348,11 @@
>  	sf.sf_uc.uc_mcontext.mc_eflags = regs->tf_rflags;
>  	sf.sf_uc.uc_mcontext.mc_esp = regs->tf_rsp;
>  	sf.sf_uc.uc_mcontext.mc_ss = regs->tf_ss;
> +	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
> +	bzero(sf.sf_uc.uc_mcontext.__spare__,
> +	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -362,6 +370,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
> @@ -463,6 +472,7 @@
>  	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
>  	ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext);
>  	fpstate_drop(td);
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -482,6 +492,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
>

[-- Attachment #2 --]
From b221718bdf2522a31b7e9c891260833cc13a860e Mon Sep 17 00:00:00 2001
From: Kostik Belousov <kostikbel@gmail.com>
Date: Sun, 17 Apr 2011 01:19:15 +0300
Subject: [PATCH] svn commit: r218836 - in stable/8/sys: amd64/amd64 amd64/ia32 i386/i386 kern

On Sat, Apr 16, 2011 at 11:04:38PM +0200, Oliver Pinter wrote:
> MFC this for 7-STABLE?
I do not reject the proposal, but I am quite curious why ?

I do not have any machine running 7, so please test the patch below.
It compiled for me on amd64.

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /head/sys:r218327

Tested-by: Oliver Pinter <oliver.pntr@gmail.com>
---
 sys/amd64/amd64/machdep.c    |    5 +++++
 sys/amd64/ia32/ia32_signal.c |   11 +++++++++++
 sys/i386/i386/machdep.c      |   17 +++++++++++++++++
 sys/kern/kern_context.c      |    2 ++
 4 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index da081f0..27fbe8e 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -306,6 +306,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	bzero(sf.sf_uc.uc_mcontext.mc_spare,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -327,6 +330,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	/* Build the argument list for the signal handler. */
 	regs->tf_rdi = sig;			/* arg 1 in %rdi */
 	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		regs->tf_rsi = (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
@@ -1653,6 +1657,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int flags)
 	mcp->mc_ss = tp->tf_ss;
 	mcp->mc_len = sizeof(*mcp);
 	get_fpcontext(td, mcp);
+	bzero(mcp->mc_spare, sizeof(mcp->mc_spare));
 	return (0);
 }
 
diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c
index ab9e6f9..2c9356a 100644
--- a/sys/amd64/ia32/ia32_signal.c
+++ b/sys/amd64/ia32/ia32_signal.c
@@ -158,6 +158,8 @@ ia32_get_mcontext(struct thread *td, struct ia32_mcontext *mcp, int flags)
 	mcp->mc_ss = tp->tf_ss;
 	mcp->mc_len = sizeof(*mcp);
 	ia32_get_fpcontext(td, mcp);
+	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	return (0);
 }
 
@@ -226,6 +228,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd32_getcontext_args *uap)
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
+		bzero(&uc.__spare__, sizeof(uc.__spare__));
 		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
 	}
 	return (ret);
@@ -345,6 +348,11 @@ freebsd4_ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	sf.sf_uc.uc_mcontext.mc_eflags = regs->tf_rflags;
 	sf.sf_uc.uc_mcontext.mc_esp = regs->tf_rsp;
 	sf.sf_uc.uc_mcontext.mc_ss = regs->tf_ss;
+	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
+	bzero(sf.sf_uc.uc_mcontext.__spare__,
+	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -362,6 +370,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
@@ -463,6 +472,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -482,6 +492,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 7413a93..1e44aa2 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -342,12 +342,14 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
+	bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
 		sf.sf_siginfo.si_signo = sig;
 		sf.sf_siginfo.si_code = ksi->ksi_code;
 		sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher;
+		sf.sf_addr = 0;
 	} else {
 		/* Old FreeBSD-style arguments. */
 		sf.sf_arg2 = ksi->ksi_code;
@@ -461,6 +463,11 @@ freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
 	sf.sf_uc.uc_mcontext.mc_gs = rgs();
 	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
+	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
+	bzero(sf.sf_uc.uc_mcontext.__spare__,
+	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -480,6 +487,7 @@ freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (register_t)&sfp->sf_si;
@@ -596,6 +604,11 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
+	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -617,6 +630,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (register_t)&sfp->sf_si;
@@ -2716,6 +2730,8 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int flags)
 	mcp->mc_ss = tp->tf_ss;
 	mcp->mc_len = sizeof(*mcp);
 	get_fpcontext(td, mcp);
+	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	return (0);
 }
 
@@ -2763,6 +2779,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
 #ifndef DEV_NPX
 	mcp->mc_fpformat = _MC_FPFMT_NODEV;
 	mcp->mc_ownedfp = _MC_FPOWNED_NONE;
+	bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
 #else
 	union savefpu *addr;
 
diff --git a/sys/kern/kern_context.c b/sys/kern/kern_context.c
index f951fca..36e2394 100644
--- a/sys/kern/kern_context.c
+++ b/sys/kern/kern_context.c
@@ -71,6 +71,7 @@ getcontext(struct thread *td, struct getcontext_args *uap)
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
+		bzero(uc.__spare__, sizeof(uc.__spare__));
 		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
 	}
 	return (ret);
@@ -109,6 +110,7 @@ swapcontext(struct thread *td, struct swapcontext_args *uap)
 		ret = EINVAL;
 	else {
 		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
+		bzero(uc.__spare__, sizeof(uc.__spare__));
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
-- 
1.7.4.3

help

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