Date: Sat, 3 Jul 2010 18:18:36 +0200 (CEST) From: Tijl Coosemans <tijl@coosemans.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: i386/148344: [patch] i386 mcontext has fsbase and gsbase fields swapped Message-ID: <201007031618.o63GIao0003970@kalimero.tijl.coosemans.org> Resent-Message-ID: <201007031620.o63GK1S1077792@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 148344 >Category: i386 >Synopsis: [patch] i386 mcontext has fsbase and gsbase fields swapped >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 03 16:20:00 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Tijl Coosemans >Release: FreeBSD 8.1-PRERELEASE i386 >Organization: >Environment: >Description: When setting up the i386 mcontext (e.g. when delivering a signal) FreeBSD stores fsbase in the gsbase field and gsbase in the fsbase field. >How-To-Repeat: >Fix: --- patch-fsgsbase begins here --- diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 502aa4f..872d09b 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -645,10 +645,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* * Unconditionally fill the fsbase and gsbase into the mcontext. */ - sdp = &td->td_pcb->pcb_gsd; + sdp = &td->td_pcb->pcb_fsd; sf.sf_uc.uc_mcontext.mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; - sdp = &td->td_pcb->pcb_fsd; + sdp = &td->td_pcb->pcb_gsd; sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; @@ -3255,9 +3255,9 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int flags) * mcontext after mc_fpstate. */ get_fpcontext(td, mcp); - sdp = &td->td_pcb->pcb_gsd; - mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; sdp = &td->td_pcb->pcb_fsd; + mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; + sdp = &td->td_pcb->pcb_gsd; mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; return (0); --- patch-fsgsbase ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007031618.o63GIao0003970>