Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp61577ybb; Tue, 7 Apr 2020 16:54:43 -0700 (PDT) X-Google-Smtp-Source: APiQypIZc2qkUYOT5yebK/am/hp16UxleBz4K86xAd67FVd/BZGbwj3N4CGjQ967gdgneJkKsSG+ X-Received: by 2002:a9d:24a4:: with SMTP id z33mr3746628ota.105.1586303683127; Tue, 07 Apr 2020 16:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586303683; cv=none; d=google.com; s=arc-20160816; b=cGKLxjasJoZiy+FvTyArsvyiNgVq60nVfd58ggK/dQsNGi9XJAkaQ8eR3vaniAWCZZ JJb0ndszmcjT6Hd9kA3wrHLLg4BraSTK8VeTF+tOegqtSE3xDo5NXS9cNY96Kw7n+Btz NCA57Ss3LPhRwN5iFNCbJDWpswn+TvHRD59beGBa3V/dOZQzMeGCPrjWZcJvfSbDDnn6 aLfRVVihwkHt0L7Mx99vkaqbJ2/tRuo1oexE5j8jy+ekFDz/rbOof3L6JN3CIlV5ImHa GkGtv3hU6qFkxJ4A1LlvCOYPd4/TWStzf8yx86+wnKgl6zQvwlbfve+g/GrBt1fDr/iI 1IdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=yi5N0/kPtibwvaPoEsen6lkTis7zla3Rx4lUTaY+3hg=; b=yJZ1ftJKf/8HXqOPgtUOrdvvPzc7uOq8ucvWLcy3D9ZG/berIvLVZZRexc/r5ioSvP vLG2gA7OngwplPd939pwyJkV0LQm1Io6q2UzDNhJ2UmhS8GWgktW4TaYZ0+r//TFzYf9 L2w3b47GNcSJwRXpiWTdTMjmNC6qw/miJ6QAA4VmgcqV9f7HeSjnGX242oM5V+rqwaXf HOjcX5skT1nvfH94jeeuMyjZQUO/WGKaxzy2cfNya6nBevLyVnq+h3YjVSRSIWZcJR+6 UfC1OhqeP8oT6KSvNv4k/8uZ/3ns/GW2nw7TN5W38yzJY1tUf+qs124wtOAnXwuh6RsV sKcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UxLby8j0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si1948143oti.77.2020.04.07.16.54.27; Tue, 07 Apr 2020 16:54:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UxLby8j0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbgDGXv7 (ORCPT + 99 others); Tue, 7 Apr 2020 19:51:59 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:55566 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbgDGXv7 (ORCPT ); Tue, 7 Apr 2020 19:51:59 -0400 Received: by mail-pj1-f68.google.com with SMTP id fh8so411123pjb.5 for ; Tue, 07 Apr 2020 16:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yi5N0/kPtibwvaPoEsen6lkTis7zla3Rx4lUTaY+3hg=; b=UxLby8j0hhHK4v1rgi2F9QL6OFUcWgpvoK4MUJ1TfyKvzIaQtPSrOQXbKEc8chl8/b etKzy10ELjXhrSdv8O/k5aUryyIeqGTGdlS0B1zbeKx7Pwmn9bJa4U8kuAO9bZIHHBDg NsnZM3NwmDwu6nV3x2xsHwCJGGbFkLHLFSh90EQ9Igf90f5cFYjDQUkF7Yr1gv6E1TYt wQdXhyzvnUwN4hip5j9DdmZQYteAY7gQQZYmWbuZc7TL3e3MKEHoud/n1ryATmDZmaAi OjhNruGj2jFxI+u+IbvlAXk3FOkCLIqfcnjuf3VfTk/JFHO0roPF1RKYxCXZuIRl2bDQ JylQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yi5N0/kPtibwvaPoEsen6lkTis7zla3Rx4lUTaY+3hg=; b=MROwglufSOUV3bv/SEIcsOu5eZ0wIGdBPW3aeUhhvL+e1RIpOpvg/ANp5IfzpODN2+ 8hx0ukf40KprBSUHnTzHdy8Shm/k4hr7uwdw6h7r9lEiYl3P+XdN7o/QSbVTVJBii49Y nxewJFSyZqHhV45v22ssLket5XRjxhxRuf+oShyUBHA3MxkCiW92djRMMEZ3slB7z6wq Mgge9zM/8pcpqN5eql5O5YNK5WseU1a72dzXloHd0w4Zc6TF8Rl0k/rgvPL4kKCcxSlW 4/sktC3pcKegqj5eNPDY+m5QzwcRNVdzTBxut1Vc8oUPIgHz8wGCiRxKh69PGebO/IR5 vBLw== X-Gm-Message-State: AGi0PuanGvwzFrJg0oAjDwWp6gagcu0STypzj7X6+iU8GVXGcs3Sfw3e 1RMk6YJNZUovZw8kIyRgCD8= X-Received: by 2002:a17:902:d685:: with SMTP id v5mr4751396ply.256.1586303517938; Tue, 07 Apr 2020 16:51:57 -0700 (PDT) Received: from ?IPv6:2601:647:4700:9b2:1d50:a6a4:b3be:b3e4? ([2601:647:4700:9b2:1d50:a6a4:b3be:b3e4]) by smtp.gmail.com with ESMTPSA id n7sm14245864pgm.28.2020.04.07.16.51.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2020 16:51:56 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH 4/4] x86,module: Detect CRn and DRn manipulation From: Nadav Amit In-Reply-To: Date: Tue, 7 Apr 2020 16:51:54 -0700 Cc: Peter Zijlstra , Thomas Gleixner , LKML , hch@infradead.org, Sean Christopherson , mingo , bp , hpa@zytor.com, x86 , "Kenneth R. Crudup" , Jessica Yu , Rasmus Villemoes , Fenghua Yu , Xiaoyao Li , Thomas Hellstrom , Tony Luck , Steven Rostedt , Greg Kroah-Hartman , jannh@google.com, keescook@chromium.org, David.Laight@aculab.com, Doug Covelli , mhiramat@kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20200407110236.930134290@infradead.org> <20200407111007.429362016@infradead.org> <10ABBCEE-A74D-4100-99D9-05B4C1758FF6@gmail.com> <20200407193853.GP2452@worktop.programming.kicks-ass.net> <90B32DAE-0BB5-4455-8F73-C43037695E7C@gmail.com> <20200407205042.GT2452@worktop.programming.kicks-ass.net> <96C2F23A-D6F4-4A04-82B6-284788C5D2CC@gmail.com> <20200407212754.GU2452@worktop.programming.kicks-ass.net> To: Paolo Bonzini X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Apr 7, 2020, at 3:12 PM, Paolo Bonzini wrote: >=20 > On 07/04/20 23:27, Peter Zijlstra wrote: >> On Tue, Apr 07, 2020 at 02:22:11PM -0700, Nadav Amit wrote: >>> Anyhow, I do not think it is the only use-case which is not covered = by your >>> patches (even considering CRs/DRs alone). For example, there is no = kernel >>> function to turn on CR4.VMXE, which is required to run hypervisors = on x86. >> That needs an exported function; there is no way we'll allow random >> writes to CR4, there's too much dodgy stuff in there. >=20 > native_write_cr4 and pv_ops (through which you can do write_cr4) are > both exported, and so is cpu_tlbstate which is used by __cr4_set_bits > and friends. Am I missing something glaringly obvious? No, I was the one who missed the obvious thing. Having said that, I still think there are additional cases that need to = be handled. For instance, I see that is_erratum_383() in KVM (AMD) flushes = the local TLB by writing to CR3 the previous value. I am not familiar with = the erratum. Maybe I am missing something again, but I do not see an = appropriate exported alternative in the kernel.