Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3768712ybk; Tue, 19 May 2020 12:30:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzae7J+AgfE0kWMPO0GlhBqCi/q5Zo2PNQKMUIOjDI00YBY+yDmuw7mm5QSUGarEm4S/tWl X-Received: by 2002:a17:906:1f87:: with SMTP id t7mr793626ejr.50.1589916607552; Tue, 19 May 2020 12:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589916607; cv=none; d=google.com; s=arc-20160816; b=GwYl3DcVQZzh+NFdpOuKQY7jTysibdbk8cDknQmeHHBg4yWvaLHPi6AoYk9WwuBxjV WbaT+D9emLjQBvvCrtYVFjnsERqsc8Esq9qNu5aHCRyc/qMCroS5WRgRhcngXfQQ1ipw TaZuMWNhvUPL+RMmDFPyYZbcOZua70AbO3xGnPf/vNhsuWAkMyV0nDH7CN6jO4iCT0w9 snFXx3f7iKaNTPqB3K/CqDdCEM4i/yHFvTpdOQezwO9fMcflQz8aVTTU7fvC6o1sPm0F fo7bGa7bm7Krc3VKDbISxzzahQG/R8co3JZs1jILk3+6X0ZgVRV9A73z1OVS9gOM3Zwl f7ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:to:from:dkim-signature:date; bh=1aZMEGKULjv1pHyrtOORoHQRpULaMESZJHGqyrR3qhQ=; b=G6xQeUbx0P3KJx9x0UxEngDwfmvmia1PW4pIwf8UiTUtIKqfNnOndwox0CM1HCjION k4rrZKQwSW37mtXMxmoASTtl68k3ZP/5cr8P4tiXcd5eV/VxoAVMyn9SKwn7XL1yC/Hl uoO4ghq29IoqckDTMRXepjW8ZM2zBDEeJ4FdXibRQh3It3iutre1u32zUpNqEWGv2Va8 vb4Jceq/fZvHS2dlYEiMbSMVi2NI9HCmPWJHE8a1rZLrOl50q6hn9tzyvncswYyXbdFi ImnDvrgAn5+Ft+rwSGNLZqYac2y3WCpinIOHbuObUx7SKT+4DBnzmLDH+9xIdjsVvmwC 0cZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@notmuch.email header.s=mail header.b=vtoz3V1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds3si582500ejc.545.2020.05.19.12.29.44; Tue, 19 May 2020 12:30:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@notmuch.email header.s=mail header.b=vtoz3V1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729140AbgESOpd (ORCPT + 99 others); Tue, 19 May 2020 10:45:33 -0400 Received: from mx.h4ck.space ([159.69.146.50]:37726 "EHLO mx.h4ck.space" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727904AbgESOpb (ORCPT ); Tue, 19 May 2020 10:45:31 -0400 X-Greylist: delayed 430 seconds by postgrey-1.27 at vger.kernel.org; Tue, 19 May 2020 10:45:31 EDT Date: Tue, 19 May 2020 16:38:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=notmuch.email; s=mail; t=1589899096; bh=Y9XZYNt+/7HUPB/P7WIrgOb1ARcvi6Rd5XCUCLuyNs0=; h=Date:From:To:Subject; b=vtoz3V1hUuSRbULf8tZ0J8tGKjJrqwfYb70ZRrxExO+2kdpZa+7qRUUSY45v+/0Eg cFMXEB46yGiFATylC/1F7x1vS+gS0VJzbce3RfImbkp7rcB2TYzFa50Z5WCt5eGQT7 yF2KjHu1yQNoGHjGbRVVRagYDr4rjAuzJ00mpylk= From: Andreas Rammhold To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Ricardo Neri , "Eric W. Biederman" , Sergey Senozhatsky , Babu Moger , Kefeng Wang , Jason Yan , Brendan Shanks , linux-kernel@vger.kernel.org Subject: umip: AMD Ryzen 3900X, pagefault after emulate SLDT/SIDT instruction Message-ID: <20200519143815.cpsd2xfx2kl3khsq@wrt> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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