Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp101563ybt; Thu, 9 Jul 2020 16:40:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjwKIbRe78heojUxnuPn2vBX+JvflyWmpWyGISrAVIXrexXNRr0rXdkFQ5Vsgvc70OQSTZ X-Received: by 2002:aa7:c885:: with SMTP id p5mr61595568eds.100.1594338016926; Thu, 09 Jul 2020 16:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594338016; cv=none; d=google.com; s=arc-20160816; b=W1zbrIxehj1B+FMSAQuaKtfln9Gz6y6MSb8qpctkFlom3J0FIBTjiWiSqSb9gj9UOW 9ErayTGfL2XSPUhcYqxyw5OgtDujqHoB5nLOTjOQJe0yb0M01pnNdHvdg2+8jFaJva0T 248DPkPwy7IySE90EcmBzzhYdrySD1BFSGtYMoGMjQZRBjbWk2uJcXDDoBsn7JHCYr7x TQEHJ5wH1aU9jOwc1A/l2oQC1+MMshFEoOdfk1o5xdpwUmMaxog6GLsWrD6WEs4DFLxq zcUNP3GlnNIu+WrNeqpuDBZBMC7/5iTDp/WvX+5X8szPrxScZokFsg8YMjYkACRV29sp cDWw== 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:date :dkim-signature; bh=49nvohObD7NIzUF0BfwI36tqxmTFWboJS8SYsz0QQGI=; b=aXs9zGckx+8oOCIQl+0qvpZjbIDWflTB9lF9bnRBlZTd2O8OFMUFsWSkaA8j7pODbS S5T23tVUPX4J10Izu4/wJezfHLaCyZdZ3MwBBWpW8qUQxOO3vwpUA7ZU9c84mTJuXisY eIn1AAKpsDZFEAjFdnI7DaRaLNkTqYOliKc0D+4V6ZbUSHs9JHoCahPoGVlFkh8u464Q Wo7B9fO5azg1SJDzqZQCmGC74pU/jHGzrUGA0yuTO2yexBZzuF0BYD3Q+5ZS55lwXRIB y0nkuLTzKDIVFfmLRtDrZXZDF2muPKEOs//5nMpaky8rkvgQMsS+TKlwe2CYEPVwcm6g k1GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=d1fhruaq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z22si2604926edr.357.2020.07.09.16.39.52; Thu, 09 Jul 2020 16:40:16 -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=@chromium.org header.s=google header.b=d1fhruaq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbgGIXhl (ORCPT + 99 others); Thu, 9 Jul 2020 19:37:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbgGIXhk (ORCPT ); Thu, 9 Jul 2020 19:37:40 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DF65C08E806 for ; Thu, 9 Jul 2020 16:37:40 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id t6so1674567pgq.1 for ; Thu, 09 Jul 2020 16:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=49nvohObD7NIzUF0BfwI36tqxmTFWboJS8SYsz0QQGI=; b=d1fhruaq3iAgLLhUtayeHvRegHINeqtG7TBQnzxSkGDJxNJfqFuwBJvMmZzBA8RONW 3EWhHxsZlCQudvK8/fMc0kPEU+vuxkCxX/cWcbSfPQuI2x2MFgBmsRwJSfUOp2JxxBB7 5QyFewNxU0UWUNDkYBxZQ7ozqL4/qf61sjw2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=49nvohObD7NIzUF0BfwI36tqxmTFWboJS8SYsz0QQGI=; b=SHvjBtIDsKfA56reN0d0b/XWRH3AIPSXDWvrI5EkppuTQYE0LjPsKgWumIg4MhpezW K2yjLy7ABEKnaqFzVPTDYvsUu8ILLmvG1juRFmel4ORC0BVEzNSTKCcBi/PD9UtOo3sg T/u7lVjW9RFncc9RYtnhrFa5TWS4ijTogtUwT9BbbB6RuieHn7nRcSDJy1puzCyZsw+M c6u0guoTSnmk32U69zFri6u+rjsIS1dP7FUdVQxc2AqT75E6XjMtOJ1dvN/V0cYCAz97 1zkzgkUi7wV1ozSDz9828fvYjO/OIMa+Ug4marzK2FE1a7M3JgWbeIekJ0KDKlyxPTE0 sbgA== X-Gm-Message-State: AOAM530iMGzs7g8cqHN+k3QTM1cE6CDtFnARqjMfkC9FsCdPMMF/+tHY AXxkAynbPGefOYFPajWuKzqRWw== X-Received: by 2002:a63:3c09:: with SMTP id j9mr54205575pga.206.1594337859635; Thu, 09 Jul 2020 16:37:39 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q20sm3987518pfn.111.2020.07.09.16.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 16:37:38 -0700 (PDT) Date: Thu, 9 Jul 2020 16:37:37 -0700 From: Kees Cook To: Dave Hansen Cc: Andy Lutomirski , "Andersen, John" , Paolo Bonzini , Sean Christopherson , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , Shuah Khan , Liran Alon , Andrew Jones , Rick Edgecombe , Kristen Carlson Accardi , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Mauro Carvalho Chehab , Greg KH , "Paul E. McKenney" , Pawan Gupta , Juergen Gross , Mike Kravetz , Oliver Neukum , Peter Zijlstra , Fenghua Yu , reinette.chatre@intel.com, vineela.tummalapalli@intel.com, Dave Hansen , Arjan van de Ven , caoj.fnst@cn.fujitsu.com, Baoquan He , Arvind Sankar , Dan Williams , eric.auger@redhat.com, aaronlewis@google.com, Peter Xu , makarandsonare@google.com, "open list:DOCUMENTATION" , LKML , kvm list , "open list:KERNEL SELFTEST FRAMEWORK" , Kernel Hardening Subject: Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning Message-ID: <202007091634.528B6641@keescook> References: <0fa9682e-59d4-75f7-366f-103d6b8e71b8@intel.com> <20200618144314.GB23@258ff54ff3c0> <124a59a3-a603-701b-e3bb-61e83d70b20d@intel.com> <20200707211244.GN20096@linux.intel.com> <19b97891-bbb0-1061-5971-549a386f7cfb@intel.com> <31eb5b00-9e2a-aa10-0f20-4abc3cd35112@redhat.com> <20200709154412.GA25@64c96d3be97b> <6040c3b3-cac9-cc0e-f0de-baaa274920a2@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6040c3b3-cac9-cc0e-f0de-baaa274920a2@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 09, 2020 at 09:22:09AM -0700, Dave Hansen wrote: > On 7/9/20 9:07 AM, Andy Lutomirski wrote: > > On Thu, Jul 9, 2020 at 8:56 AM Dave Hansen wrote: > >> On 7/9/20 8:44 AM, Andersen, John wrote: > >>> Bits which are allowed to be pinned default to WP for CR0 and SMEP, > >>> SMAP, and UMIP for CR4. > >> I think it also makes sense to have FSGSBASE in this set. > >> > >> I know it hasn't been tested, but I think we should do the legwork to > >> test it. If not in this set, can we agree that it's a logical next step? > > I have no objection to pinning FSGSBASE, but is there a clear > > description of the threat model that this whole series is meant to > > address? The idea is to provide a degree of protection against an > > attacker who is able to convince a guest kernel to write something > > inappropriate to CR4, right? How realistic is this? > > If a quick search can find this: > > > https://googleprojectzero.blogspot.com/2017/05/exploiting-linux-kernel-via-packet.html > > I'd pretty confident that the guys doing actual bad things have it in > their toolbox too. Right, it's common (see my commit log in 873d50d58f67), and having this enforced by the hypervisor is WAY better since it'll block gadgets or ROP. -- Kees Cook