lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2330FAB4-A6CE-49E7-921C-B7D55763BDED@codeweavers.com>
Date:   Tue, 19 May 2020 11:56:40 -0700
From:   Brendan Shanks <bshanks@...eweavers.com>
To:     Andreas Rammhold <andi@...much.email>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Babu Moger <Babu.Moger@....com>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        Jason Yan <yanaijie@...wei.com>, linux-kernel@...r.kernel.org
Subject: Re: umip: AMD Ryzen 3900X, pagefault after emulate SLDT/SIDT
 instruction


> On May 19, 2020, at 7:38 AM, Andreas Rammhold <andi@...much.email> wrote:
> 
> Hi,
> 
> I've been running into a weird problem with UMIP on a current Ryzen
> 3900x with kernel 5.6.11 where a process receives a page fault after the
> kernel handled the SLDT (or SIDT) instruction (emulation).
> 
> The program I am running is run through WINE in 32bit mode and tries to
> figure out if it is running in a VMWare machine by comparing the results
> of SLDT against well known constants (basically as shown in the
> [example] linked below).
> 
> In dmesg I see the following log lines:
>> [99970.004756] umip: Program.exe[3080] ip:4373fb sp:32f3e0: SIDT instruction cannot be used by applications.
>> [99970.004757] umip: Program.exe[3080] ip:4373fb sp:32f3e0: For now, expensive software emulation returns the result.
>> [99970.004758] umip: Program.exe[3080] ip:437415 sp:32f3e0: SLDT instruction cannot be used by applications.
> 
> Following that the process terminates with a page fault:
>> Unhandled exception: page fault on read access to 0xffffffff in 32-bit code (0x0000000000437415).
> 
> Assembly at that address:
>> 0x0000000000437415: sldt    0xffffffe8(%ebp)
> 
> Running the same executable on the exact same kernel (and userland) but
> on a Intel i7-8565U doesn't crash at this point. I am guessing the
> emulation is supposed to do something different on AMD CPUs?
> 
> On the Ryzen the code executes successfully after setting CONFIG_X86_UMIP=n.

Hi Andreas,

The problem is that the kernel does not emulate/spoof the SLDT instruction, only SGDT, SIDT, and SMSW.
SLDT and STR weren't thought to be commonly used, so emulation/spoofing wasn’t added.
In the last few months I have seen reports of one or two (32-bit) Windows games that use SLDT though.
Can you share more information about the application you’re running?

Maybe the best path is to add kernel emulation/spoofing for SLDT and STR on 32 and 64-bit, just to cover all the cases. It should be a pretty simple patch, I’ll start working on it.

Alternately, I did work on a Wine patch to emulate the UMIP instructions in user-space, but it adds a lot of code and I don’t think there’s much appetite for it in upstream Wine (especially since the kernel emulation is sufficient for almost all cases).
https://www.winehq.org/pipermail/wine-devel/2020-February/160027.html

In the meantime, an easy way to disable UMIP without rebuilding the kernel is to pass 'clearcpuid=514’ on the kernel command line.

Brendan Shanks
CodeWeavers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ