From mboxrd@z Thu Jan 1 00:00:00 1970 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 0899EC4332F for ; Thu, 29 Sep 2022 22:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230115AbiI2Wgv (ORCPT ); Thu, 29 Sep 2022 18:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbiI2WgB (ORCPT ); Thu, 29 Sep 2022 18:36:01 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA6E61D73E3; Thu, 29 Sep 2022 15:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664490721; x=1696026721; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=1ROr10PWtEQqZbu33f8bK3mcr7CnDfijyx9zzPA3SPo=; b=aorq02zuFyDcVhGLZccD7TL6jrcmXb17+IB3TlqPcqkI6CLsqjKNfJmn vklYN58QC/+4+X3iCmT7x6de0ZF7YWoO/qbbZCM6mLtmndCN0TlEFdQOu A/xRvtqXSRVDtwpz+JcTsnaqILj8228/jQLsWwL8QDcsDZvnM23jKzoBn uCIgMPhd1mK3tA1Vhujiku3IxiOYDmcj663/HB96rGqcW4+W5EuQFKuUN 9jrrAaNPVFIlUSw9dkbsUHZadA/Uw04HZ9mAxDshorAjhFK/UPS0ao7Dz hdIkRz1EXQ0XdFv0CZp6QF4JsPl85s2uLT3wkqMAEvZ9Ppmh/GKB0UumS g==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="285182132" X-IronPort-AV: E=Sophos;i="5.93,356,1654585200"; d="scan'208";a="285182132" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 15:30:52 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="691016353" X-IronPort-AV: E=Sophos;i="5.93,356,1654585200"; d="scan'208";a="691016353" Received: from sergungo-mobl.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.251.25.88]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 15:30:49 -0700 From: Rick Edgecombe 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" , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com Cc: rick.p.edgecombe@intel.com Subject: [PATCH v2 31/39] x86/cet/shstk: Wire in CET interface Date: Thu, 29 Sep 2022 15:29:28 -0700 Message-Id: <20220929222936.14584-32-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220929222936.14584-1-rick.p.edgecombe@intel.com> References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel now has the main CET functionality to support applications. Wire in the WRSS and shadow stack enable/disable functions into the existing CET API skeleton. Signed-off-by: Rick Edgecombe --- 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 fc64a04366aa..0efec02dbe6b 100644 --- a/arch/x86/kernel/shstk.c +++ b/arch/x86/kernel/shstk.c @@ -477,9 +477,17 @@ long cet_prctl(struct task_struct *task, int option, unsigned long features) return -EINVAL; if (option == ARCH_CET_DISABLE) { + if (features & CET_WRSS) + return wrss_control(false); + if (features & CET_SHSTK) + return shstk_disable(); return -EINVAL; } /* Handle ARCH_CET_ENABLE */ + if (features & CET_SHSTK) + return shstk_setup(); + if (features & CET_WRSS) + return wrss_control(true); return -EINVAL; } -- 2.17.1