linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* umip: AMD Ryzen 3900X, pagefault after emulate SLDT/SIDT instruction
@ 2020-05-19 14:38 Andreas Rammhold
  2020-05-19 18:56 ` Brendan Shanks
  2020-05-20  0:17 ` H. Peter Anvin
  0 siblings, 2 replies; 13+ messages in thread
From: Andreas Rammhold @ 2020-05-19 14:38 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Ricardo Neri, Eric W. Biederman,
	Sergey Senozhatsky, Babu Moger, Kefeng Wang, Jason Yan,
	Brendan Shanks, linux-kernel

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.

I'd love to contriubte a patch but I have no knowledge of the inner
workings of how UMIP actually works.

Is there anything else I can provide to help debugging/fixing this? Very
happy to test patches as well.


[example] https://www.aldeid.com/wiki/X86-assembly/Instructions/sldt

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-28 11:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 14:38 umip: AMD Ryzen 3900X, pagefault after emulate SLDT/SIDT instruction Andreas Rammhold
2020-05-19 18:56 ` Brendan Shanks
2020-05-19 19:43   ` Ricardo Neri
2020-05-20  0:54     ` Andy Lutomirski
2020-05-21  0:56       ` Ricardo Neri
2020-05-21  1:16         ` Andy Lutomirski
2020-05-20  1:04     ` andi
2020-05-23  2:17     ` Andreas Rammhold
2020-05-26 13:33       ` Ricardo Neri
2020-05-28 11:36         ` Andreas Rammhold
2020-05-20  1:08   ` andi
2020-05-23  2:21   ` andi
2020-05-20  0:17 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).