---
i386/i386/pcb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index 5ca6f124..21f9e06a 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -316,7 +316,11 @@ void stack_handoff(
stack = current_stack();
old->kernel_stack = 0;
new->kernel_stack = stack;
- percpu_assign(active_thread, new);
+
+ /*
+ * NB: cannot use percpu_assign here because GS is now switched!
+ */
+ percpu_array[mycpu].active_thread = new;
/*
* Switch exception link to point to new
--
2.45.2