[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXbZuVacSGBUvbcQQqUaqCtmOOXJv_pc=wA4mtnGy-nPQ@mail.gmail.com>
Date: Mon, 21 Mar 2016 15:47:28 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Andi Kleen <andi@...stfloor.org>
Cc: X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Updated version of RD/WR FS/GS BASE patchkit
On Mon, Mar 21, 2016 at 3:41 PM, Andi Kleen <andi@...stfloor.org> wrote:
>> Imagine that some brilliant lightweight threading library does:
>>
>> - set GS to nonzero (by whatever means -- arch_prctl(ARCH_SET_GS,
>> whatever) on a pre-IVB host followed by migration, some modify_ldt
>> garbage, simple bloody-mindedness, whatever);
>
> Migration is only possible when the CPUID flags match.
>
>> - WRGSBASE
>> - Use GS for a bit
>>
>> This will work most of the time until it gets unlucky with preemption.
>
> As soon as a kernel thread or something else schedules the value
> will be lost.
>
>> And yes, runtime library authors really do mess up in amazing ways.
>>
>> It's an issue. It needs conscious design.
>
> Ok. So your only objection is the order of the context switch
> updates?
No. My objection is that there needs to be an explicit statement what
the semantics are. If the agreed-upon semantics are "undefined
behavior if GS != 0 and GSBASE doesn't match the descriptor", so be
it, but this needs to be a conscious decision and needs to be weighed
against the alternatives.
The actual implementation details are just details. They need to
match the intended semantics, of course.
--Andy
Powered by blists - more mailing lists