Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp353360ybm; Thu, 28 May 2020 04:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9W26qjLWMEwtGMl6bwee8gHp7vx4X5/uV1mUBFb7eLZQITNQpvQuqJWLvGOY4GGWSAxJG X-Received: by 2002:a05:6402:1aca:: with SMTP id ba10mr2791044edb.100.1590665913775; Thu, 28 May 2020 04:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590665913; cv=none; d=google.com; s=arc-20160816; b=aDgXlEFO5eIr8fpxPrDTnLBa8WojDiIW0P3V7FAakDJhC2iolXAnkc41Ynfn835teO a7ZKCjcCNXpimaBr25wathktQgoQp6GDyAWEPR+FDxsBwfamSBjaCJjxMqpAKl/wFPVw 0vbSfkJtMEveDGK5J0rKZDNbt3DHpd5JqP3y3oFFq/NMkRp9gyeKs3WHVhO/eB3LPg2q nXlNGEUeRMhbQXi+zl9WnFECcODlY4UzR/mWHIejNS7nM+s721LaBEaLssNFErqrFAf+ Mkd+b6IOdV2Nm5JDXCxIVrcXx6I7uSzDIBCUPpI7zsd2HyF+iNjqaX4O0aAGVVFLjb43 41uw== 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-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:date; bh=xyt8OmK7hjgVhEwAU4n2myPXrPDA6Pvci3nex2oNjOM=; b=Vl+rTWLcl7sgGro203agfnTWoMin5sW42zoZBB6hyvzXIrNCaJGpBqjgmkVbjVL45i JwczgtfKFxLSL5RzY1PcK73GjE+HTcAIgnyU3i+uBXfh4gFSKo3v7vjPE4pepXsWouPq C0U+UcNaB0fBYY5biwfVsAHxUiJsj5fa0Nh5v8iwux04TscpUhXIKKUNJ+rqieZlxi10 zYYPbntOJbn6WZ5cqanvnHs0sGFfWJe02aQkdZ3LpaPHe023iOADfRMe+zx34xoPty7j WpyQ2C7ni2XnobPU0BMengoB6wn1cTg3MAfvvVSB3VFSKMj3xjT96M6701GeG1TAQA7h kQ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@notmuch.email header.s=mail header.b=kRfbURVx; 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 s5si1141534ejv.64.2020.05.28.04.38.09; Thu, 28 May 2020 04:38:33 -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=kRfbURVx; 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 S2388426AbgE1LgF (ORCPT + 99 others); Thu, 28 May 2020 07:36:05 -0400 Received: from mx.h4ck.space ([159.69.146.50]:33350 "EHLO mx.h4ck.space" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388326AbgE1LgE (ORCPT ); Thu, 28 May 2020 07:36:04 -0400 Date: Thu, 28 May 2020 13:36:00 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=notmuch.email; s=mail; t=1590665761; bh=kfSMeWv1tDa6JpUtOKsModDfCKY6+eHNJv6lWWzZ+z4=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=kRfbURVxI6yeCflzKOErdME/nWFhpHzVTJ+vuOXKCcz8i8i7EA1pdToUC53v9BVGn BpNjXi3xWSSDT4BVtKwVa8hHP+hug0ksm7L90PCSvUtw/Cr2vZC4CQZN2BvmpQ/sMP 1q0k+o1a+nTPYqJUZvJ2TdygAKYbupCKu6UgwhlY= From: Andreas Rammhold 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: <20200528113600.napo64uaxxexlgxj@wrt> References: <20200519143815.cpsd2xfx2kl3khsq@wrt> <2330FAB4-A6CE-49E7-921C-B7D55763BDED@codeweavers.com> <20200519194320.GA25138@ranerica-svr.sc.intel.com> <20200523021739.bbq5m6ze63ctouh6@wrt> <20200526133318.GA3796@ranerica-svr.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200526133318.GA3796@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 06:33 26.05.20, Ricardo Neri wrote: > On Sat, May 23, 2020 at 04:17:39AM +0200, Andreas Rammhold wrote: > > On 12:43 19.05.20, Ricardo Neri wrote: > > > 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 tried the above patch (in modified/rebased version; hope that didn't > > kill it [0]). The results are negative, as without the patch. > > Ah. My patch above is based on a rather old kernel. There is a check in > fixup_umip_exception() for SLDT and STR. I think this causes the > exception you see. Perhaps you can try by removing such check: > > diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c > @@ -383,10 +389,6 @@ bool fixup_umip_exception(struct pt_regs *regs) > umip_pr_warn(regs, "%s instruction cannot be used by applications.\n", > umip_insns[umip_inst]); > > - /* Do not emulate (spoof) SLDT or STR. */ > - if (umip_inst == UMIP_INST_STR || umip_inst == UMIP_INST_SLDT) > - return false; > - > umip_pr_warn(regs, "For now, expensive software emulation returns the result.\n"); > > if (emulate_umip_insn(&insn, umip_inst, dummy_data, &dummy_data_size, > > You would still need my old patch. Thanks, that works for my application. Regards, Andi