Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1512774pxk; Fri, 18 Sep 2020 14:50:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ82KXqKRaY7gmS5KgZZqxgW8ZUQ39CfmEfmxw6u9IRp9ulmtM2hOUQimryHhhRkV7rQLk X-Received: by 2002:aa7:d3da:: with SMTP id o26mr39534452edr.169.1600465813466; Fri, 18 Sep 2020 14:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600465813; cv=none; d=google.com; s=arc-20160816; b=DdQnjKlLQgj0hrCIaw/1lMQ8c9ytKatwPHAQZxbOu8VqYXDN9/MBBN3jpLGUAXjl6R L8sY0WXJq5Q+/UNZZgdIBtUdBg8wK0MdBGfOrfo7KiHjdhf+5i/KfBbEHUWuvwYfSz67 BfrQyNRxAm7+Begb3N+ZbDOQk7qSl3btZgJpnBcrxUmu0HLht9pGUV+NaMet2NqCNlKz ma9dGDjxgfVUjIjw3bwsd/J70JusDuLddCCeuLhzvDy22FXNqNWTaIuwP1vaujMoChiQ uH1IPWvmQHOjUFW2/0TU+MPLLZzuXy1YzAThlihH/JpxJiJaI503IlLSXnKtPYBjIhTY uFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tEtbTCyG2rnV0biaFUft9F3G7S1Bq/fIXdfXEt6SoFU=; b=ksF9/IrBOayeFe1C9scD1EGkSb3VlaWvY4stydcwLlIh+grruo8Om5gEROrRH+RspS zAhHOjHD0UIh1E7pSLRTeP5YeTDCt0GfS+/VaEiXiACat6+DQDE58kP8PanUIcxLo79j 2VIQYqRd1ujxOCXgN5QcWiIscKOdYjNEt5w2aynRPNg6kRqwNfSbx6mkHDlFj3RNGl/C 3AxlpzYYOmEuNhAesSryNmx/Tx19R6/r5VSVf/yABHGQqxAe1O3furUN67dSjZMd5js/ /RfvAhlF3U73F3golPNyE0IXb/Txw633v39S4hckakisAb8K1rpj9E+8JNIOVQqksfbw T+gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tfndcyVD; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si3143675ejf.457.2020.09.18.14.49.49; Fri, 18 Sep 2020 14:50:13 -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=@gmail.com header.s=20161025 header.b=tfndcyVD; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726247AbgIRVqt (ORCPT + 99 others); Fri, 18 Sep 2020 17:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726159AbgIRVqs (ORCPT ); Fri, 18 Sep 2020 17:46:48 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C04E1C0613CE; Fri, 18 Sep 2020 14:46:48 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id s88so7771895ilb.6; Fri, 18 Sep 2020 14:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tEtbTCyG2rnV0biaFUft9F3G7S1Bq/fIXdfXEt6SoFU=; b=tfndcyVD0M/bXUGTAbsmnIWMQiyXNfjabqa9SSP2Hj1voEfSH6Z1MBJtiAMWa2TGv1 6tPXBXrMNbJHxQlz5BVy8hna39lXHstRkN8uusvJjUOobFqCmqY69qlv4qoZjp4oM/Zw AVfbqa7IsxoEtMrYPIZIEDgWpIYIN1vuiJ96DlCPb1wYHvs9X0OsYUZH+MG+QTQiDOXi 4pyhof/Z1GDu5FqNz9E6GBuXXHjDu3lqtyxxc0njesBymBEY79/Uak2H0YczKaky8WAh YvMFt+FCI98OuqvIsX5aZ9Zkv0Evmzet9eK6ZwqgjBXEXvJG5s0LEA7jBUBLuxH4fdup xCAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tEtbTCyG2rnV0biaFUft9F3G7S1Bq/fIXdfXEt6SoFU=; b=XqBJkbBpDdKihL9jXeZrotCk8vzzzkgZ5zbgfmVl5KiKUvetxE1q9qZceQfGNQIf0U mGT8PRfW0gNaWWeCcQxvb4p0Qx7VKhBELxrxOXionnbe3hM0Gu8bu0Ef0vVjnkW46DAv Qey7k+6CQLm9YDUYBttcQnup2HRW2D4yCFIlmGZwGOZbxHGVLaIa2BPxK5ajfHUkvaJ0 BkLDZLSe6XekvTrwnTYPKTTUs1rmIkqKjGS3nL62fJlS5XyHjXaMGvDtsdsJ+gq5umfX vSLTQtLTDwG1dXDSApztiZEo2wCDjPacw8PDHIk5p0XnM8NZkp99yXRVcZCmpw/VYmv1 j2FQ== X-Gm-Message-State: AOAM530yGf4QhIxmjzKyDoXV3n6UKMfK3goaNNdfoZbeRtSFIkPVnvFL JhnXH1BpYW9cJu1956aWhIhgxVQYy5usVaUtlTY= X-Received: by 2002:a92:c9c4:: with SMTP id k4mr8200166ilq.292.1600465608096; Fri, 18 Sep 2020 14:46:48 -0700 (PDT) MIME-Version: 1.0 References: <20200918192312.25978-1-yu-cheng.yu@intel.com> <20200918192312.25978-2-yu-cheng.yu@intel.com> <20200918205933.GB4304@duo.ucw.cz> <019b5e45-b116-7f3d-f1f2-3680afbd676c@intel.com> <20200918214020.GF4304@duo.ucw.cz> In-Reply-To: <20200918214020.GF4304@duo.ucw.cz> From: "H.J. Lu" Date: Fri, 18 Sep 2020 14:46:12 -0700 Message-ID: Subject: Re: [PATCH v12 1/8] x86/cet/ibt: Add Kconfig option for user-mode Indirect Branch Tracking To: Pavel Machek Cc: "Yu, Yu-cheng" , Randy Dunlap , "the arch/x86 maintainers" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Peter Zijlstra , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2020 at 2:40 PM Pavel Machek wrote: > > On Fri 2020-09-18 14:25:12, Yu, Yu-cheng wrote: > > On 9/18/2020 1:59 PM, Pavel Machek wrote: > > > On Fri 2020-09-18 13:24:13, Randy Dunlap wrote: > > > > Hi, > > > > > > > > If you do another version of this: > > > > > > > > On 9/18/20 12:23 PM, Yu-cheng Yu wrote: > > > > > Introduce Kconfig option X86_INTEL_BRANCH_TRACKING_USER. > > > > > > > > > > Indirect Branch Tracking (IBT) provides protection against CALL-/JMP- > > > > > oriented programming attacks. It is active when the kernel has this > > > > > feature enabled, and the processor and the application support it. > > > > > When this feature is enabled, legacy non-IBT applications continue to > > > > > work, but without IBT protection. > > > > > > > > > > Signed-off-by: Yu-cheng Yu > > > > > --- > > > > > v10: > > > > > - Change build-time CET check to config depends on. > > > > > > > > > > arch/x86/Kconfig | 16 ++++++++++++++++ > > > > > 1 file changed, 16 insertions(+) > > > > > > > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > > > > index 6b6dad011763..b047e0a8d1c2 100644 > > > > > --- a/arch/x86/Kconfig > > > > > +++ b/arch/x86/Kconfig > > > > > @@ -1963,6 +1963,22 @@ config X86_INTEL_SHADOW_STACK_USER > > > > > If unsure, say y. > > > > > +config X86_INTEL_BRANCH_TRACKING_USER > > > > > + prompt "Intel Indirect Branch Tracking for user-mode" > > > > > + def_bool n > > > > > + depends on CPU_SUP_INTEL && X86_64 > > > > > + depends on $(cc-option,-fcf-protection) > > > > > + select X86_INTEL_CET > > > > > + help > > > > > + Indirect Branch Tracking (IBT) provides protection against > > > > > + CALL-/JMP-oriented programming attacks. It is active when > > > > > + the kernel has this feature enabled, and the processor and > > > > > + the application support it. When this feature is enabled, > > > > > + legacy non-IBT applications continue to work, but without > > > > > + IBT protection. > > > > > + > > > > > + If unsure, say y > > > > > > > > If unsure, say y. > > > > > > Actually, it would be "If unsure, say Y.", to be consistent with the > > > rest of the Kconfig. > > > > > > But I wonder if Yes by default is good idea. Only very new CPUs will > > > support this, right? Are they even available at the market? Should the > > > help text say "if your CPU is Whatever Lake or newer, ...." :-) ? > > > > I will revise the wording if there is another version. But a CET-capable > > kernel can run on legacy systems. We have been testing that combination. > > Yes, but enabling CET is unneccessary overhead on older systems. And > Kconfig is great place to explain that. > I can't tell any visible CET kernel overhead on my non-CET machines. -- H.J.