From nobody Sun Feb 8 12:42:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 822DAEB64D7 for ; Fri, 16 Jun 2023 19:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345332AbjFPTRJ (ORCPT ); Fri, 16 Jun 2023 15:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbjFPTQ4 (ORCPT ); Fri, 16 Jun 2023 15:16:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F09EA3A8C; Fri, 16 Jun 2023 12:16:54 -0700 (PDT) Date: Fri, 16 Jun 2023 19:16:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686943013; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iovYtGDAR/iBGfQFTuKy+OfLY4uRUPtPAYOMshctPE0=; b=3XmLumZO1viAcpRF/plHjU3AZ48D02cWnL9+ZAyFMPZFdFajznmWQ3ZaJUdRQWZjmVaB7j 1Z2B+EHVHBkDGXXHWQS/p4jOsPjwWy6don6z5xgwHKs07HI/71hK9F8mdsXsA3v3/hlFur 9NvK71u9yExSJ6zwzwbQ5GwD1XEhlbst6VTqh8fsmsfuXPgI4OxV8VGdSn1WhAIyt7QWUg MmQ40gnVtUx3t3OgouwUL+5UIwK/K/1oR+SDBXKZ2/3TxuMhkaXlR5LU6rt7qTDAduG7n2 BU8WDxWRXhsExuUXG/Errym/CWFWtWcPQZRD0nbdIgvcjYGwLTkoMj2/ncCVjQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686943013; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iovYtGDAR/iBGfQFTuKy+OfLY4uRUPtPAYOMshctPE0=; b=IQDKuAPs7rL51DxhrR74FDVurV1ORXil6SD1n32qBXzeRDdzCZKjMoXJr++UNGDgqeR9Y7 OjPMcGgCpILeDmDg== From: "tip-bot2 for Rick Edgecombe" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/shstk] x86/shstk: Wire in shadow stack interface Cc: Rick Edgecombe , Dave Hansen , "Borislav Petkov (AMD)" , Kees Cook , "Mike Rapoport (IBM)" , Pengfei Xu , John Allen , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <168694301311.404.15338316204935361111.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/shstk branch of tip: Commit-ID: d463cfe241f0ea4194f3575b4d28fd744db321f1 Gitweb: https://git.kernel.org/tip/d463cfe241f0ea4194f3575b4d28fd744= db321f1 Author: Rick Edgecombe AuthorDate: Mon, 12 Jun 2023 17:11:03 -07:00 Committer: Dave Hansen CommitterDate: Thu, 15 Jun 2023 16:31:34 -07:00 x86/shstk: Wire in shadow stack interface 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. Signed-off-by: Rick Edgecombe Signed-off-by: Dave Hansen Reviewed-by: Borislav Petkov (AMD) Reviewed-by: Kees Cook Acked-by: Mike Rapoport (IBM) Tested-by: Pengfei Xu Tested-by: John Allen Tested-by: Kees Cook Link: https://lore.kernel.org/all/20230613001108.3040476-38-rick.p.edgecomb= e%40intel.com --- 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 ea0bf11..d723cdc 100644 --- a/arch/x86/kernel/shstk.c +++ b/arch/x86/kernel/shstk.c @@ -502,9 +502,17 @@ long shstk_prctl(struct task_struct *task, int option,= unsigned long features) return -EINVAL; =20 if (option =3D=3D ARCH_SHSTK_DISABLE) { + if (features & ARCH_SHSTK_WRSS) + return wrss_control(false); + if (features & ARCH_SHSTK_SHSTK) + return shstk_disable(); return -EINVAL; } =20 /* Handle ARCH_SHSTK_ENABLE */ + if (features & ARCH_SHSTK_SHSTK) + return shstk_setup(); + if (features & ARCH_SHSTK_WRSS) + return wrss_control(true); return -EINVAL; }