Re: [PATCH v2] x86/umip: Add emulation/spoofing for SLDT and STR instructions

From: Ricardo Neri
Date: Mon Jun 08 2020 - 17:53:18 EST


On Mon, Jun 08, 2020 at 11:14:54AM -0700, Brendan Shanks wrote:
> Add emulation/spoofing of SLDT and STR for both 32- and 64-bit
> processes.
>
> Wine users have found a small number of Windows apps using SLDT that
> were crashing when run on UMIP-enabled systems.
>
> Reported-by: Andreas Rammhold <andi@xxxxxxxxxxxxx>
> Originally-by: Ricardo Neri <ricardo.neri-calderon@xxxxxxxxxxxxxxx>
> Signed-off-by: Brendan Shanks <bshanks@xxxxxxxxxxxxxxx>
> ---
>
> v2: Return (GDT_ENTRY_LDT * 8) for SLDT when an LDT is set.
>
> arch/x86/kernel/umip.c | 34 +++++++++++++++++++++++++---------
> 1 file changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c
> index 8d5cbe1bbb3b..a85f0b0ec2b9 100644
> --- a/arch/x86/kernel/umip.c
> +++ b/arch/x86/kernel/umip.c
> @@ -64,6 +64,8 @@
> #define UMIP_DUMMY_GDT_BASE 0xfffffffffffe0000ULL
> #define UMIP_DUMMY_IDT_BASE 0xffffffffffff0000ULL
>
> +#define UMIP_DUMMY_TASK_REGISTER_SELECTOR 0x40

One more thing. How was this value selected? Would it be possible to use
GDT_ENTRY_TSS*8? Linux already uses this value.

Thanks and BR,
Ricardo