Date: Fri, 18 Jun 2010 09:34:31 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r209292 - stable/8/sys/i386/i386 Message-ID: <201006180934.o5I9YV3F016496@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Jun 18 09:34:31 2010 New Revision: 209292 URL: http://svn.freebsd.org/changeset/base/209292 Log: MFC r208604: Clarify a potential issue in get_fpcontext() use. Modified: stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Fri Jun 18 09:29:08 2010 (r209291) +++ stable/8/sys/i386/i386/machdep.c Fri Jun 18 09:34:31 2010 (r209292) @@ -633,6 +633,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_gs = rgs(); bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ + + /* + * The get_fpcontext() call must be placed before assignments + * to mc_fsbase and mc_gsbase due to the alignment-override + * code in get_fpcontext() that possibly clobbers 12 bytes of + * mcontext after mc_fpstate. + */ get_fpcontext(td, &sf.sf_uc.uc_mcontext); fpstate_drop(td); /* @@ -3241,6 +3248,13 @@ get_mcontext(struct thread *td, mcontext mcp->mc_esp = tp->tf_esp; mcp->mc_ss = tp->tf_ss; mcp->mc_len = sizeof(*mcp); + + /* + * The get_fpcontext() call must be placed before assignments + * to mc_fsbase and mc_gsbase due to the alignment-override + * code in get_fpcontext() that possibly clobbers 12 bytes of + * mcontext after mc_fpstate. + */ get_fpcontext(td, mcp); sdp = &td->td_pcb->pcb_gsd; mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006180934.o5I9YV3F016496>