Re: [PATCH v7 1/4] x86/insn-eval: Add support for 64-bit kernel mode

From: Andy Lutomirski
Date: Thu Jan 02 2020 - 02:55:28 EST




> On Jan 2, 2020, at 4:47 PM, Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
>
> ïOn Thu, Dec 19, 2019 at 12:11:47AM +0100, Jann Horn wrote:
>> To support evaluating 64-bit kernel mode instructions:
>>
>> Replace existing checks for user_64bit_mode() with a new helper that
>> checks whether code is being executed in either 64-bit kernel mode or
>> 64-bit user mode.
>>
>> Select the GS base depending on whether the instruction is being
>> evaluated in kernel mode.
>>
>> Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
>
> In most cases you have struct insn around (or can easily pass it down to
> the place). Why not use insn->x86_64?
>
>

What populates that?

FWIW, this code is a bit buggy: it gets EFI mixed mode wrong. Iâm not entirely sure we care.