Message ID | 20230218211433.26859-37-rick.p.edgecombe@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp556180wrn; Sat, 18 Feb 2023 13:23:26 -0800 (PST) X-Google-Smtp-Source: AK7set9L80jCGo0TDAm0pB/1iaKsC5hDmM25wQ5qGYOIUT6Thv6nLe14nvyx9fgaCxeB9Ha4WCOC X-Received: by 2002:a17:90b:1d82:b0:233:ee50:d26d with SMTP id pf2-20020a17090b1d8200b00233ee50d26dmr796263pjb.4.1676755405453; Sat, 18 Feb 2023 13:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676755405; cv=none; d=google.com; s=arc-20160816; b=GuzPVeL9jWXKmZcGRjNYzWtkoyn3vrYxQyCLuiRDaDd1lv9swQVdShr65SsRSAwNPQ PFKF4+hNKHD/Xtr970r5kR5TNfmt3d3YqCAFKoR0IjK8APCj8c6615OL3zTuKHtHrwZK n8sES83HyMzBQ0vgAz0XjnjlQKtwHt7A3hUgUHE5sBML3Xl6tjmRC/bRGSf5tlnfd0y0 EUBHtpMPEGOb7R0HXnFQljtPzKDumUxXrD7g92iEla+Whvdcwk7YVUJW1cUvw/8njJ88 AVuPa2K9skaNfUS7u3MU+Hkwpw/3jW98k7J6kHaObuc5DztueVICuciwa7Y0gnjp2o3j TSvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=DReRSgvy6bwQAJ5021aO9D5VPOmaKRsAP7JXRlEBPpk=; b=IwQc53v8UZ32KlGpKqFnhnR/RLogHUezHVr8+hhnlER2ptMnSSoOB7gwkaOrouT7EH yqt0ecZLLbw/11hlFJBo2mZuY+mwBZ4T5D15ZJlmWY23ctNiZzJAQEhVlcC9LDkRJBY/ Bo2YAbet6VhqGLBRhrQZLJg7JoR8I5uyoPaheh3Le64Y46Ug8JCPrlRIf7kiIkKL5cDj gi8hf1Yw7VWjPg1SavJy3WWi3eIPxdUAMNBj0AyYc656KBNN/9qzRullgMDWjWGcoB5Y 7KdCl47GVL49prw5KZ3ojmjXZydADrmWDgppw7ctMLCl9kCVXtQePLPxYmSnix2TZ9Sf X8YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gi0qSIVE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a17090adf8500b002295e6b4fd7si8493604pjv.48.2023.02.18.13.23.11; Sat, 18 Feb 2023 13:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gi0qSIVE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbjBRVWr (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Sat, 18 Feb 2023 16:22:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbjBRVWL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 18 Feb 2023 16:22:11 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8199219F24; Sat, 18 Feb 2023 13:19:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676755150; x=1708291150; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=LBXMAmJiTfFh9q2evgIt9WapwuhYib2Yu77ryjdrcH4=; b=Gi0qSIVE/YtcisAgZe3dhDcc+S3sfKvJi+ncqccTxv9ehuNL2LhXTLzz pujQklXfi2RPMTd/QjWOz9S45hmQq5kqO/9V2r3Ab11FkTTnMssShxHkY xDJJdU4yDkZhgIAtk2CeswphKBOGYZwnLfp90TLjDQwh6xOX1UvJA9MjO 6yaa2rRKXLmaKBqehtB2IblogR564BgwUQa0767wyrMKSJyM8NsKMDXkU YKbvEZrG6Rzlx/zVmEqcKSvJDXIGymY7XjYzWesipcLv/gpUSRXrw+Y1P sOqK4k1/DdNhId7sXc5wLd7KZS2f5x0wNL4pdtfXk3G4ijN1863/4MmBM Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="418427879" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="418427879" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2023 13:16:26 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="664241745" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="664241745" Received: from adityava-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.209.80.223]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2023 13:16:25 -0800 From: Rick Edgecombe <rick.p.edgecombe@intel.com> To: x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, 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 <arnd@arndb.de>, Andy Lutomirski <luto@kernel.org>, Balbir Singh <bsingharora@gmail.com>, Borislav Petkov <bp@alien8.de>, Cyrill Gorcunov <gorcunov@gmail.com>, Dave Hansen <dave.hansen@linux.intel.com>, Eugene Syromiatnikov <esyr@redhat.com>, Florian Weimer <fweimer@redhat.com>, "H . J . Lu" <hjl.tools@gmail.com>, Jann Horn <jannh@google.com>, Jonathan Corbet <corbet@lwn.net>, Kees Cook <keescook@chromium.org>, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Oleg Nesterov <oleg@redhat.com>, Pavel Machek <pavel@ucw.cz>, Peter Zijlstra <peterz@infradead.org>, Randy Dunlap <rdunlap@infradead.org>, Weijiang Yang <weijiang.yang@intel.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, John Allen <john.allen@amd.com>, kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com, david@redhat.com, debug@rivosinc.com Cc: rick.p.edgecombe@intel.com Subject: [PATCH v6 36/41] x86/shstk: Wire in shadow stack interface Date: Sat, 18 Feb 2023 13:14:28 -0800 Message-Id: <20230218211433.26859-37-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230218211433.26859-1-rick.p.edgecombe@intel.com> References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758205476189096957?= X-GMAIL-MSGID: =?utf-8?q?1758205476189096957?= |
Series |
Shadow stacks for userspace
|
|
Commit Message
Edgecombe, Rick P
Feb. 18, 2023, 9:14 p.m. UTC
The kernel now has the main shadow stack functionality to support applications. Wire in the WRSS and shadow stack enable/disable functions into the existing shadow stack API skeleton. Tested-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: John Allen <john.allen@amd.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> --- v4: - Remove "CET" references v2: - Split from other patches --- arch/x86/kernel/shstk.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c index 009cb3fa0ae5..2faf9b45ac72 100644 --- a/arch/x86/kernel/shstk.c +++ b/arch/x86/kernel/shstk.c @@ -464,9 +464,17 @@ long shstk_prctl(struct task_struct *task, int option, unsigned long features) return -EINVAL; if (option == ARCH_SHSTK_DISABLE) { + if (features & ARCH_SHSTK_WRSS) + return wrss_control(false); + if (features & ARCH_SHSTK_SHSTK) + return shstk_disable(); return -EINVAL; } /* Handle ARCH_SHSTK_ENABLE */ + if (features & ARCH_SHSTK_SHSTK) + return shstk_setup(); + if (features & ARCH_SHSTK_WRSS) + return wrss_control(true); return -EINVAL; }