Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp90081ybg; Tue, 9 Jun 2020 17:15:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo6gG2v/oIKuWQQD5l+XmGbKjsBCPaZkhAJSzw5Rx7FHDwaDU57dkUId6diwj0qBVKyxxC X-Received: by 2002:aa7:cc84:: with SMTP id p4mr280047edt.216.1591748115140; Tue, 09 Jun 2020 17:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591748115; cv=none; d=google.com; s=arc-20160816; b=Sj8J0XrMDektm23Pd4VAoURvh/8YatBEVyCGC7YZIL8acM4362XsP6a2JVMGGLneja /DBMhFYJHoD/GRXYqHrSasI+Gy8N7j61BvS78yG4XT7bZkFTXB+TW7Ny6GDgTvXEMhRf NdLqTQs2hSxCwVq2iPTp5j6uQ7xghwa4DT52dRhUfCc8Rdn+g8vvaR8n6TkhkFTn7unA p0RKj9VXSJrqOHuTjd4fgbMEkxbu4hkzU++x3nKPxQnfHzTfEnFxzGdsrAAYDrEMEm7J Z2CsYiSENBS26X/X9TAEfeadrq5U9WsMJgTqsgqHyPW9u/KmzVP5hKtSOIu6K0fmde1Y G+XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=ujybCm0kTqaK6DPjJrjFbWuNjgdsUBBWupjz1RGfsT4=; b=L7FLacAjGfbw1xmBWv4ZqepRCLuQNBleiQT1NkEqu21UxzCbUvYw68hKg130wUbgI/ PsM4HdpnxcL0miHTLzWfkuBFkSKXj+lLopMfyY6pJcadAVYrEazy/yYyI1CwO3RF2KsU PdqdvZUkeVjB1nDmks8xTEcQ0J0xC5fOJL2MjQ5x2No+T7zCmpjFstE1JCxOzZCjV7l9 Yi8ZF+bT5cv5LHmc/ZjOzkl/j25kPViDnPJb18ZSvn+9Vbqhiy4jbXNf5haSDvhBa9kd +GxKGttqNYkW3uYgobFMyVAP99jiWM7YviPzaf57DadD+9QpJn19F5Ifwyc3Vsu1WjSA w2ug== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o19si9321910edr.148.2020.06.09.17.14.51; Tue, 09 Jun 2020 17:15:15 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725927AbgFJAM6 (ORCPT + 99 others); Tue, 9 Jun 2020 20:12:58 -0400 Received: from mga01.intel.com ([192.55.52.88]:44463 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbgFJAM5 (ORCPT ); Tue, 9 Jun 2020 20:12:57 -0400 IronPort-SDR: kSYsqH3W6hayqi70e0T6Zx55UjnggGJ0nlhFdwzr6+MR9CPOJ81IHPhqsr7jm1vWa3vSQ+G4p3 ajwkiW7tqJ2Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2020 17:12:57 -0700 IronPort-SDR: QedeotHzgzWVQLwHRxGMRasI1cjy27kXs+Ra5lTiZAiIL0fYzjcNDfW6FwS9A/bgJRLa26neoF qNmadWo9oTKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,493,1583222400"; d="scan'208";a="418566432" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga004.jf.intel.com with ESMTP; 09 Jun 2020 17:12:56 -0700 Date: Tue, 9 Jun 2020 17:13:10 -0700 From: Ricardo Neri To: Brendan Shanks Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, ebiederm@xmission.com, andi@notmuch.email, Babu.Moger@amd.com Subject: Re: [PATCH v4] x86/umip: Add emulation/spoofing for SLDT and STR instructions Message-ID: <20200610001310.GA20597@ranerica-svr.sc.intel.com> References: <20200609175423.31568-1-bshanks@codeweavers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200609175423.31568-1-bshanks@codeweavers.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2020 at 10:54:23AM -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 > Originally-by: Ricardo Neri > Signed-off-by: Brendan Shanks > --- > > v4: Use braces for every clause of the conditional. I tried a switch(), > but it takes more lines and looks more cluttered (especially with the > #ifdef). > Also replace out-of-date comment at top of file. > > arch/x86/kernel/umip.c | 38 ++++++++++++++++++++++++++------------ > 1 file changed, 26 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c > index 8d5cbe1bbb3b..62f4f0afb979 100644 > --- a/arch/x86/kernel/umip.c > +++ b/arch/x86/kernel/umip.c > @@ -45,11 +45,12 @@ > * value that, lies close to the top of the kernel memory. The limit for the GDT > * and the IDT are set to zero. > * > - * Given that SLDT and STR are not commonly used in programs that run on WineHQ > - * or DOSEMU2, they are not emulated. > - * > * The instruction smsw is emulated to return the value that the register CR0 > * has at boot time as set in the head_32. > + * sldt and str are emulated to return the values that the kernel programmatically > + * assigns: > + * - sldt returns (GDT_ENTRY_LDT * 8) if an LDT has been set, 0 if not. > + * - str returns (GDT_ENTRY_TSS * 8). Probably for consistency with the rest of the document the instruction names should be capitalized (I know that smsw was not capitalized before :/). Maybe maintainers can fix this when applying? Other than that, FWIW: Reviewed-by: Ricardo Neri Tested-by: Ricardo Neri