summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/vm_machdep.c6
-rw-r--r--sys/i386/i386/vm_machdep.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index f58bdf3..bdb189f 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -247,9 +247,13 @@ cpu_exit(struct thread *td)
{
struct mdproc *mdp;
+ /* Reset pc->pcb_gs and %gs before possibly invalidating it. */
mdp = &td->td_proc->p_md;
- if (mdp->md_ldt)
+ if (mdp->md_ldt) {
+ td->td_pcb->pcb_gs = _udatasel;
+ load_gs(_udatasel);
user_ldt_free(td);
+ }
reset_dbregs();
}
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index f58bdf3..bdb189f 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -247,9 +247,13 @@ cpu_exit(struct thread *td)
{
struct mdproc *mdp;
+ /* Reset pc->pcb_gs and %gs before possibly invalidating it. */
mdp = &td->td_proc->p_md;
- if (mdp->md_ldt)
+ if (mdp->md_ldt) {
+ td->td_pcb->pcb_gs = _udatasel;
+ load_gs(_udatasel);
user_ldt_free(td);
+ }
reset_dbregs();
}
OpenPOWER on IntegriCloud