Re: [PATCH urgent 3/3] x86/power: Make restore_processor_context() sane

From: Pavel Machek
Date: Thu Dec 14 2017 - 17:32:26 EST


Hi!

> My previous attempt to fix a couple of bugs in
> __restore_processor_context() introduced yet another bug. Rather
> than trying to come up with a minimal fix, let's try to clean it up
> for real. This patch fixes quite a few things:
>
> - The old code saved a nonsensical subset of segment registers.
> The only registers that need to be saved are those that contain
> userspace state or those that can't be trivially restored without
> percpu access working. (On x86_32, we can restore percpu access
> by writing __KERNEL_PERCPU to %fs. On x86_64, it's easier to
> save and restore the kernel's GSBASE.) With this patch, we
> restore hardcoded values to the kernel state where applicable and
> explicitly restore the user state after fixing all the descriptor
> tables.
>
> - We used to use an unholy mix of inline asm and C helpers for
> segment register access. Let's get rid of the inline asm.
>
> Tested-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
> Fixes: 5b06bbcfc2c6 ("x86/power: Fix some ordering bugs in __restore_processor_context()")
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>

Thanks!

Tested-by: Pavel Machek <pavel@xxxxxx>
Reported-by: Pavel Machek <pavel@xxxxxx>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature