Re: [PATCH 4/8] x86: Add support for rd/wr fs/gs base

From: Andy Lutomirski
Date: Tue Nov 11 2014 - 15:49:42 EST


On Tue, Nov 11, 2014 at 12:05 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> On 11/10/2014 03:55 PM, Andi Kleen wrote:
>> To prevent recursive interrupts clobbering this
>> state in the task_struct this is only done for interrupts
>> coming directly from ring 3.
>
> Since this just came up in a different context today, I'd like to
> propose a different solution to this piece of the problem.
>
> Can we change the paranoid entry to check if the entry came from ring 3
> and to just switch stacks immediately to the standard kernel stack and
> run the non-paranoid entry code? This eliminates paranoid_userspace
> entirely, and there are no special gsbase machinations any more for the
> entry-from-userspace path.
>
> In fact, I think that this will result in the MSR KERNEL_GS_BASE value
> *always* matching the userspace gs value from any C code in the kernel,
> since we'll always swapgs exactly once on entry from userspace.

I'll send patches in a couple hours. I have it mostly working.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/