Commit 39520ba4 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] fix Thread-Local Storage GDT access

The gdt entry is consulted only while loading its index into
the segment register.

So load_TLS_desc(next, cpu) must be called before loading
next->fs,next->gs in __switch_to().
parent c828dc4b
......@@ -674,6 +674,14 @@ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
tss->esp0 = next->esp0;
/*
* Load the per-thread Thread-Local Storage descriptor.
*
* NOTE: it's faster to do the two stores unconditionally
* than to branch away.
*/
load_TLS_desc(next, cpu);
/*
* Save away %fs and %gs. No need to save %es and %ds, as
* those are always kernel segments while inside the kernel.
......@@ -689,14 +697,6 @@ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
loadsegment(gs, next->gs);
}
/*
* Load the per-thread Thread-Local Storage descriptor.
*
* NOTE: it's faster to do the two stores unconditionally
* than to branch away.
*/
load_TLS_desc(next, cpu);
/*
* Now maybe reload the debug registers
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment