lkml.org 
[lkml]   [2023]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: the x86 sysret_rip test fails on the Intel FRED architecture
Date
On 20/01/2023 9:17 pm, H. Peter Anvin wrote:
> On January 20, 2023 1:10:09 PM PST, Andrew Cooper <Andrew.Cooper3@citrix.com> wrote:
>> On 20/01/2023 8:50 pm, H. Peter Anvin wrote:
>>> On January 20, 2023 10:52:02 AM PST, Andrew Cooper <Andrew.Cooper3@citrix.com> wrote:
>>>> On 20/01/2023 5:45 pm, Dave Hansen wrote:
>>>>> On 1/19/23 23:49, Li, Xin3 wrote:
>>>>>> The x86 sysret_rip test has the following assertion:
>>>>>>
>>>>>> /* R11 and EFLAGS should already match. */
>>>>>> assert(ctx->uc_mcontext.gregs[REG_EFL] ==
>>>>>> ctx->uc_mcontext.gregs[REG_R11]);
>>>>>>
>>>>>> This is being tested to avoid kernel state leak due to sysret vs iret,
>>>>>> but that on FRED r11 is *always* preserved, and the test just fails.
>>>>> Let's figure out the reason that FRED acts differently, first. Right
>>>>> now, the SDM says:
>>>>>
>>>>> SYSCALL also saves RFLAGS into R11
>>>>>
>>>>> so that behavior of SYSCALL _looks_ architectural to me. Was this
>>>>> change in SYSCALL behavior with FRED intentional?
>>>> FRED 3.0 Section 7.4 says the only changes for the SYSCALL and SYSENTER
>>>> instructions are the enablement conditions.  Nowhere else is there
>>>> mention of a FRED OS needing to emulate legacy syscall behaviour by
>>>> adjusting %r11/%rcx
>>>>
>>>> However, ERETU does handle flags different to SYSRET (in particular, I
>>>> think you can establish TF on the instruction boundary after SYSCALL
>>>> now).  What are the raw values of REG_EFL and REG_R11 ?
>>>>
>>>> ~Andrew
>>>>
>>> Just to avoid any confusion:
>>>
>>> Syscall and sysenter in a FRED system are treated equivalently to software interrupts, e.g. INT 0x80. They do not modify any registers.
>> In which case can Intel please publish a v4 spec which actually says this?
>>
>> I can't see anything in the v3 spec which mentions a change in register
>> behaviour for SYSCALL.
>>
>> ~Andrew
>>
> I'll make sure it makes it into the next update.

Thankyou!

~Andrew
\
 
 \ /
  Last update: 2023-03-26 23:51    [W:0.082 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site