Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp147942ybk; Tue, 19 May 2020 18:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSwKIZJHvjS5aWwc9oppI4zAwNdXPZeIEH1qCYJBrs+EEDkBdTnrO4FpWUzr1IrixzT8Lv X-Received: by 2002:a17:906:14cb:: with SMTP id y11mr1638551ejc.131.1589936767606; Tue, 19 May 2020 18:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589936767; cv=none; d=google.com; s=arc-20160816; b=hx4q+I5pIcJ1T+P8v8BjFRcAbtyfLWqbAI4YXwEScWLUBhi//AY7mysbAXrFhGVlyr iaRQJiL1UAQtAb4OzVamG1Ky5rcZrWcrBCffpqoOFL9ma6FF8LmndPVKSlhJE/rx9PRi hcEMjUF+qvMCt94PmCBQiUOzTGzNG7vyrblPAhalgn2aOxUkVjmUQwEN1xW9zo0LlkuD ELwe5iPhmUWbpF/U/2G5+CJmE4ekOmEnEMz3AQJ47oWvVi3wvocmpBGLUu7r6U5J9ifM 3WPIMr9etiPRqABiu2znJNgBHVszMsmDkUmq5ac/3s8cRi9rTVlEZHeDEnnN1n41H8IG Qsxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=EeowlNIHfpKy0JgK731U2ac7Tf30J3+j6st9x0HwR6o=; b=bbxFuWRt2C5tOETupQYrspRPNvHDGE6opVEH5GNBji+Esv4SADE7XIOnqhdzjJ+bNw P8ucCL6ABoTWCFc06VtczLJtG4ujxKcrBK/JsVkkXziw73BwNjQ7emOwKVYD7OScaoiU 0hFLPgyAi4yA70UOKU/tCAHmaUtY9Cy8LXf8OHPbVlCuF37TfSANq6G0UeswxKTcI2PB o9mnf0Ck2gljRGvcyEs4dk6+KjGXm+RhvZRTsrYdYBo1MuMYw23VwOHHc6qVv2y7meWF AzuA6Zghyz6FF4Z21vdUCgjvlcWYei7xCVh+mhbcHg/5LUXVap0jV1j4l6c2zG8Tkuis wJag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@notmuch.email header.s=mail header.b=NJpU64f0; 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 v26si545072eda.549.2020.05.19.18.05.44; Tue, 19 May 2020 18:06: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=NJpU64f0; 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 S1728231AbgETBEV (ORCPT + 99 others); Tue, 19 May 2020 21:04:21 -0400 Received: from mx.h4ck.space ([159.69.146.50]:58672 "EHLO mx.h4ck.space" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgETBEU (ORCPT ); Tue, 19 May 2020 21:04:20 -0400 Date: Wed, 20 May 2020 03:04:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=notmuch.email; s=mail; t=1589936658; bh=SXL42srFoPlaa2GUG3aQEU4fKva96clfFImQwvvj0kk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=NJpU64f086GykurTVLJgzZg2h6QJW6hyh4o4awavfBwOCyTWlGRUa9QnS4i1WonMw LKgv1wirpX6uWaTATrjPhiaMog7MfV88X7cAFHU6iqgAoY/GOS2RzDZXNU2RCBr3A9 cS4VU71DxdVi8Ap5My4DjUSGvn/An5DwMOEEqlf4= From: andi@notmuch.email To: Ricardo Neri Cc: Brendan Shanks , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Eric W. Biederman" , Sergey Senozhatsky , Babu Moger , Kefeng Wang , Jason Yan , linux-kernel@vger.kernel.org Subject: Re: umip: AMD Ryzen 3900X, pagefault after emulate SLDT/SIDT instruction Message-ID: <20200520010418.ippljxawcwrbp6o2@wrt> References: <20200519143815.cpsd2xfx2kl3khsq@wrt> <2330FAB4-A6CE-49E7-921C-B7D55763BDED@codeweavers.com> <20200519194320.GA25138@ranerica-svr.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200519194320.GA25138@ranerica-svr.sc.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12:43 19.05.20, Ricardo Neri wrote: > > > 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? > > I am surprised you don't see it on the Intel processor. Maybe it does > not have UMIP. Do you see umip when you do > > $ grep umip /proc/cpuinfo Indeed it doesn't ahve the feature. I would have assumed that it is recent enough. Apparently not. > > > 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. > > I have a patch for this already that I wrote for testing purposes: > > https://github.com/ricardon/tip/commit/1692889cb3f8accb523d44b682458e234b93be50 > > Perhaps it can be used as a starting point? Not sure what the spoofing > value should be, though. Perhaps 0? I am not entirely sure what it should return in the general case. My assumption is that 0 might work. Maybe making it configurable like with the other UMIP constants that I saw? I'll give the patch a shot and try to figure out what the authors of the code have to say about it.