From nobody Sun Feb 8 13:27:32 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 3E7A9C001B0 for ; Wed, 19 Jul 2023 22:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230259AbjGSWrp (ORCPT ); Wed, 19 Jul 2023 18:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbjGSWrb (ORCPT ); Wed, 19 Jul 2023 18:47:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE6C81FFE; Wed, 19 Jul 2023 15:47:30 -0700 (PDT) Date: Wed, 19 Jul 2023 22:47:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1689806848; 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=lvQD2v47OmpQLyD6tCUDQcGs/nfoahlZfJXIfvLLcYo=; b=UqvDJVJRe5LZOSXZGm2bB8XM1Mk1rIIlyaXOhaJk7GHkbDN3tXNAPHgqAIDEQz0UeBzU5n uvJivKGrMSenYv6Tp6JublTu7yP7EOQZHrp6tM0yKFAeyKikUIILCJxU7za/vQ+UVihQmp b9aLv1NHzKqZgCeS0Zr3auDl9TjVLovt80Ede8WCyPCGiT/Plrlxp4lcI7+FcURuHciuRt Kjle8kRUpkj6L70wqCGUiwkBlG9qQtI5jy/+EgVNljxdBn57faFM1SDE/tuOQLp5ZHmkRp ygBG8v7n0F4WS1dKO7sxxy/r+SvO8qOk7LTu2g31JiyE339F7A72bbbkfmT/gg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1689806848; 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=lvQD2v47OmpQLyD6tCUDQcGs/nfoahlZfJXIfvLLcYo=; b=u7t6VdWjBfSDDYL7xFkWTMamyppM0UzCasjX3eky7ygELW8Y4l3uhskFfyFdAbcr1n6W7O Vm6qBNAY1cin77CQ== 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: <168980684796.28540.5293840532791424484.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: 90359b0a7eed998740ae3794c66aac98d09d6ee1 Gitweb: https://git.kernel.org/tip/90359b0a7eed998740ae3794c66aac98d= 09d6ee1 Author: Rick Edgecombe AuthorDate: Mon, 12 Jun 2023 17:11:03 -07:00 Committer: Rick Edgecombe CommitterDate: Tue, 11 Jul 2023 14:13:46 -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; }