[lkml]   [2015]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 7/8] x86: Add documentation for rd/wr fs/gs base
On Fri, Apr 10, 2015 at 1:22 PM, Andi Kleen <> wrote:
>> I think that your __switch_to is buggy and that's why the selectors
>> need to be zero. Is that the only issue? If so, let's fix the bug
>> instead.
> I don't think there is a bug.

So what's the issue?

If user code programs fs != 0 and fsbase != whatever is implied by fs
and the GDT/LDT, what happens? There's already a minor buglet in that
area without wrfsbase, but fixing it would be a big performance hit
because we don't have rdfsbase and rdgsbase to read the state
efficiently. (Specifically, if we have gs == 0, gsbase == 0, but
*saved* gsbase != 0, then we corrupt gsbase on context switch.)

But, with the new instructions, we can do it simply, efficiently, and
correctly in all cases. Let's do so.


> -Andi
> --
> -- Speaking for myself only

Andy Lutomirski
AMA Capital Management, LLC

 \ /
  Last update: 2015-04-10 23:01    [W:0.082 / U:3.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site