Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1406644pxb; Thu, 4 Feb 2021 12:05:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdryx+aCw0W1pcDio2W4n2xC/K0dDnT6x1bXx1DzHTXZ908IF4MM5IspkTknWNfaWurgut X-Received: by 2002:a50:cc4d:: with SMTP id n13mr241727edi.337.1612469148045; Thu, 04 Feb 2021 12:05:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612469148; cv=none; d=google.com; s=arc-20160816; b=Kt1En+nlBuulaJfzbHMik5hZOeTbh4y4frvnoZ+hHOB8LaxH4D3KEN8sYtRRK12P4u uvcd3St4nIsL2RWGl+KLpSZLsZKZDWA9P/1a/ZZm/UtbQLui/kUyi91SGnOrtrFCtUcH bbFIcRHDhxjTDWzbh6cnxnslJx1AJcvmNoAKc+vKfxEgnhWL80Jhugp5NHMGzUIifhp5 UVIWupniTCO6ob6mG7geA5Z33P05gPAfBzJ7nv1cZF3sdpo0v0OQN6iNBjlw1TbbLR77 DuvmHzUYETUhcU/2ye/n1XDhv7qrFOBOn76SLOBdnhqIHFfMUSmmw86uZf2LwtE6LE0Y rKFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Jq2q8UEnLf/ipaLn8qV8ffzERNFqom9zzTJdc5kA6TY=; b=dae6b9PLT+Sf3VmcFoULNgNh8GWsb0hllqxnqxfVcp6B/nN/j5wdJwLhS8FBqfJsrE LTDbFEujrInnywZZHxZvpd4Frvjrzn3ndVGXhyZdmkMaQhYvOc+iZXnp3RHIPGlgVCFv Hdh49gcTtImxIe7Xqx2QaqGhYNH4z48OvILvpRVX2z3dddxwvy0h5jSLtTOqLxQAd0vn kNN/h6Wi5Uz0nyQYacnXoWWIft8YPgAeGVwawG+QsnQXgPZj2CKtEdC4IoFtACLDxpH9 eL1ZHXlCD5wp5s4FX5dMW0JBic3dGsBWfylVL9YOGXpFh5gye/VNJhA1dW8KF2Z0JD5S O2gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZYyCgZ2F; 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 i24si3716843ejy.153.2021.02.04.12.05.23; Thu, 04 Feb 2021 12:05:48 -0800 (PST) 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=ZYyCgZ2F; 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 S239870AbhBDUCZ (ORCPT + 99 others); Thu, 4 Feb 2021 15:02:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239955AbhBDUAZ (ORCPT ); Thu, 4 Feb 2021 15:00:25 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D350C06178A for ; Thu, 4 Feb 2021 11:59:45 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id n10so2861622pgl.10 for ; Thu, 04 Feb 2021 11:59:45 -0800 (PST) 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=Jq2q8UEnLf/ipaLn8qV8ffzERNFqom9zzTJdc5kA6TY=; b=ZYyCgZ2F8b338soHdc11pps9YeSV7ZHYyO2VtWyXSsMAOujNdBUH5nPK8ZS/Niujt+ IfkH6tdg2aLeIBLt0gSKeQNFL2XubqtzQ4rZm6M7wbFlfc+3eaFryYNqoPSM7KYNMdLP QUK4+z7PSBVL/VWNGJ+JUJjOsKs4CFNQ8zt+Y= 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=Jq2q8UEnLf/ipaLn8qV8ffzERNFqom9zzTJdc5kA6TY=; b=io2xkBXTiQPvn4kyaW+WqvALJCJeQ2mpo7hob/kz6dMojeAJFgTvgzedLR/69UMGce hTsSl7IrPJyOiLBbFUnq06Bjg89jNpFIBH+kBEwGQVo2A7xRszXnA8uLqUmNM1f2zFjm S0ve0mDWEu0t4ocpsW4ia8CylgHUx/RYcR6HN/WeejSv4yC85k2Cw+8hFdvc8oIkKzLD 0Xpzyz5MYYu0O95IZL74im6+VpU2UM4IQZ0AEgqYmwIWV3MzLkAerIIbTHP4eDWjlLwp r2IkzNTuCb42KB2d7TCRHtt5Z/jvlfu7Tgf83NI2EvYGTpOfN+ej5owU5CM9PXo1FigK 8AkA== X-Gm-Message-State: AOAM530nOrffBhtBqWsI4/GM7U2N8IUqSdU8mU+LIYwkvvaU61vbx13L wcyAQDcYmhOOVHIsmaT+RslYwA== X-Received: by 2002:a63:2d3:: with SMTP id 202mr622394pgc.438.1612468785083; Thu, 04 Feb 2021 11:59:45 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e12sm6152391pjj.23.2021.02.04.11.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:59:44 -0800 (PST) Date: Thu, 4 Feb 2021 11:59:43 -0800 From: Kees Cook To: Yu-cheng Yu Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu Subject: Re: [PATCH v19 05/25] x86/fpu/xstate: Introduce CET MSR and XSAVES supervisor states Message-ID: <202102041159.44C6C3588@keescook> References: <20210203225547.32221-1-yu-cheng.yu@intel.com> <20210203225547.32221-6-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203225547.32221-6-yu-cheng.yu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 02:55:27PM -0800, Yu-cheng Yu wrote: > Control-flow Enforcement Technology (CET) introduces these MSRs: > > MSR_IA32_U_CET (user-mode CET settings), > MSR_IA32_PL3_SSP (user-mode shadow stack pointer), > > MSR_IA32_PL0_SSP (kernel-mode shadow stack pointer), > MSR_IA32_PL1_SSP (Privilege Level 1 shadow stack pointer), > MSR_IA32_PL2_SSP (Privilege Level 2 shadow stack pointer), > MSR_IA32_S_CET (kernel-mode CET settings), > MSR_IA32_INT_SSP_TAB (exception shadow stack table). > > The two user-mode MSRs belong to XFEATURE_CET_USER. The first three of > kernel-mode MSRs belong to XFEATURE_CET_KERNEL. Both XSAVES states are > supervisor states. This means that there is no direct, unprivileged access > to these states, making it harder for an attacker to subvert CET. > > For sigreturn and future ptrace() support, shadow stack address and MSR > reserved bits are checked before written to the supervisor states. > > Signed-off-by: Yu-cheng Yu Reviewed-by: Kees Cook -- Kees Cook