Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1690575pxb; Fri, 20 Aug 2021 11:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2DOXO12s2W6pJeRdDpYHdgwbeQAgzVthuZ4wGvuCv7O+TSM4EygfuR1pT3rPA0QZd+se3 X-Received: by 2002:a6b:e70f:: with SMTP id b15mr1565500ioh.140.1629483932263; Fri, 20 Aug 2021 11:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629483932; cv=none; d=google.com; s=arc-20160816; b=OnatLsCXuFyFvAzhHrmwQWOwOQUKjKVhiD74YYpFfq6+BeckWRNztCv/GxFOH7X6HI zMGWwPEhHHKqqTc04zqBlz+KvE99XJIJJbmfcV/7mlsczvnHMiWhH6aq3fjwrXHiWWGf erPL3LwWiys7WTSQkIicqQUr1OsYSc+p740ZRAmsHNIcdAmWIbqmtElNRkKVKNgG397l qd6d48KNr8S479ZCiRFf638PSkV3d5NW0HWH8bXv71rOktLDMz4UZWvpex/ZJ+g7achd KMxflOolQiIm1fmusJViGvIWXQ3Zzlxr8IF73jSWjcA29Zy1hyqeqk3QANgQM6Lvv5rp 9cmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xvIiIzOQ2N1hIjXhJ7bht6jjUIbYPhlJu5CrEhp3XVQ=; b=qpU2tiMDzDEiQ08uZvtyHuHGU6iM6nR5cStVTcI4dh6pXhOoMb/nR9KmvmQH2H06HA CQvrAeq08W005wa/1cv+Hp7uYk3NNgvs8U8mALm3PUcwnruKVKn1Zfc4NnW2Msai8DYA kAYwH1vBdd/y4JFc5+4103qAXg4j5CbaShhH1HtlxxeCxgHSRXtd9g6AuZsBOzDtzkGQ Mfv2HknAR2tvo+Jl92W2zlMhUHjCXylJa/MdUy1hUXHUZO8KPxmRtxfxNbnyqWmDw+ml suSTEPUDS5PjM/pitwNd9gbi5X/fZDTXsRFRH0IKQFi8gqPZdXGaaQDJFVpK3KoZCEUM +SWA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay7si7325604jab.98.2021.08.20.11.25.20; Fri, 20 Aug 2021 11:25:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238364AbhHTSYd (ORCPT + 99 others); Fri, 20 Aug 2021 14:24:33 -0400 Received: from mga18.intel.com ([134.134.136.126]:48048 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238868AbhHTSYT (ORCPT ); Fri, 20 Aug 2021 14:24:19 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10082"; a="203964954" X-IronPort-AV: E=Sophos;i="5.84,338,1620716400"; d="scan'208";a="203964954" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 11:23:09 -0700 X-IronPort-AV: E=Sophos;i="5.84,338,1620716400"; d="scan'208";a="523799170" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 11:23:08 -0700 From: Yu-cheng Yu To: 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 , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang , Rick P Edgecombe Cc: Yu-cheng Yu Subject: [PATCH v29 06/10] x86/cet/ibt: Update arch_prctl functions for Indirect Branch Tracking Date: Fri, 20 Aug 2021 11:22:41 -0700 Message-Id: <20210820182245.1188-7-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210820182245.1188-1-yu-cheng.yu@intel.com> References: <20210820182245.1188-1-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H.J. Lu" Update ARCH_X86_CET_STATUS and ARCH_X86_CET_DISABLE for Indirect Branch Tracking. Signed-off-by: H.J. Lu Signed-off-by: Yu-cheng Yu Reviewed-by: Kees Cook --- arch/x86/kernel/cet_prctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/cet_prctl.c b/arch/x86/kernel/cet_prctl.c index b426d200e070..bd3c80d402e7 100644 --- a/arch/x86/kernel/cet_prctl.c +++ b/arch/x86/kernel/cet_prctl.c @@ -22,6 +22,9 @@ static int cet_copy_status_to_user(struct thread_shstk *shstk, u64 __user *ubuf) buf[2] = shstk->size; } + if (shstk->ibt) + buf[0] |= GNU_PROPERTY_X86_FEATURE_1_IBT; + return copy_to_user(ubuf, buf, sizeof(buf)); } @@ -46,6 +49,8 @@ int prctl_cet(int option, u64 arg2) return -EINVAL; if (arg2 & GNU_PROPERTY_X86_FEATURE_1_SHSTK) shstk_disable(); + if (arg2 & GNU_PROPERTY_X86_FEATURE_1_IBT) + ibt_disable(); return 0; case ARCH_X86_CET_LOCK: -- 2.21.0