Re: [PATCH] x86/entry: Clarify the RF saving/restoring situation with SYSCALL/SYSRET

From: Andy Lutomirski
Date: Wed Aug 03 2016 - 13:29:54 EST


On Wed, Aug 3, 2016 at 10:14 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Wed, Aug 03, 2016 at 09:42:29AM -0700, Andy Lutomirski wrote:
>> I would change "so" and "and" -- the CPU designers could have make
>> SYSRET restore RF, but they chose not to.
>
> I'm assuming the reasoning behind it was that you should be able to
> break after SYSRET but then again, the kernel could've been left in
> control of that bit and set it or clear it however it likes before
> SYSRETing.
>
> Oh well.

AFAICT the AMD people didn't think of any use cases involving doing
anything interesting between SYSCALL and SYSRET. Witness the
sysret_ss_attrs goof, for example: apparently SYSCALL; context switch;
IRET; interrupt; context switch; SYSRET didn't occur to AMD as a valid
use case.

--Andy