From nobody Sun Feb 8 13:28:03 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 1237CC001DF for ; Wed, 2 Aug 2023 22:19:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233865AbjHBWTt (ORCPT ); Wed, 2 Aug 2023 18:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232144AbjHBWTc (ORCPT ); Wed, 2 Aug 2023 18:19:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A762737; Wed, 2 Aug 2023 15:19:31 -0700 (PDT) Date: Wed, 02 Aug 2023 22:19:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691014769; 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=UPIuUeivTqjwJWivQoXOvYw2V+3/HwN/ogghC08VCps=; b=v6rYWsRhZ08iNO0paXzink0M733VYk+hs6HoTEVO+XAOuD5W2p+Hh5Tt07UUAQhypsvMrA 2H0yJ1JKqWwtYMV1C+sFZOuSUnmOv5MX+bwGKOYi2IMO46tf2Tc8f8sDYiftYuFftgPpzo s8cQne9rjEdY86JpfmQU5TcHvbmnWl9ak1JKR7BqrRx6P6KQwofHuDcS3qaW/PAgw2Ww0d 3Y6NdOBtujTyLcSQEKamlieddRoFV1I0RC3d/ufLYz4xrjQhccy7Eph4/kBiRL4IbWOyQD ZQCN6berpKMi7XdTeXrDu7rErKAgNaqRNL5jxMbdo9LLSWMhhsDokxelQiCqXQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691014769; 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=UPIuUeivTqjwJWivQoXOvYw2V+3/HwN/ogghC08VCps=; b=OQWndwCRoZvj4gS3Io/HbNjxcXYX61//u9tCf0PC8uUoxkH/Cj2UaP6gzEm1nRBfR6NLsY PhMhrrycKpHEr3Cw== 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: <169101476881.28540.10108940235697972924.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: 488af8ea7131185c1adcbb0b52da2b6800429ecb Gitweb: https://git.kernel.org/tip/488af8ea7131185c1adcbb0b52da2b680= 0429ecb Author: Rick Edgecombe AuthorDate: Mon, 12 Jun 2023 17:11:03 -07:00 Committer: Dave Hansen CommitterDate: Wed, 02 Aug 2023 15:01:51 -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; }