Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2825450rwb; Thu, 29 Sep 2022 15:56:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4z7f4mNUweRlhCr0uDwaCTbzjZ15xYer6DV9ofsmtYwv6wLo1u6PQ2803evYTk8Awyn2RG X-Received: by 2002:a17:907:6089:b0:783:592a:5d3f with SMTP id ht9-20020a170907608900b00783592a5d3fmr4545070ejc.385.1664492201496; Thu, 29 Sep 2022 15:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664492201; cv=none; d=google.com; s=arc-20160816; b=HMUOyK74QnZDC6LhKs3HE6Zj0LitMH9dpznaVInYiLm8Y6ylrsG5b2l/0ymkfRR9WP H4viSyH0lVsdJFOf2eXpbwyCeF4+EZh51cNCNKOB/mc7eTDF+b/1kdxnzbt3e/brxYNQ M+0mFWaqVOP8FnunJ7+vAMWgTAxkOgWR2zATxvN6DGWgho1I902+TH+dwTG97bSMxInh qGFMeC/8vccUnNGtRe1yKvr6ehW6Dg6IXUmJfaGijj3r0Qg7R8UiLAtkNYv2DAOnSU6c ZrRV78aWfcSOj8is2bABS8uZc8VearhkgpT3skuLslSIdNOoylF0yMjfd67CLrkXZ2vZ vKdA== 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=pIU+MFYxIuSqjSIdCsgc/ltahySYgaVHA8pVv5d6kdw=; b=mnHT+bqNRbYMPAnA3hHtxg4tdYppYOOSuEzH1T8noO5ric+jEOb6re4nguEJSuVdY+ BOA6J6SjCVuYjPokYigjBJvdnpD+xtHDfLX07bFs4VmRzEdlKlEXnmWbScN/3dFf+kso xO8T/IP73N7juYP7tEqfvr/HwtipcNkpjulol1Oo7YPwpslH8UnYm6/dtshzQqIbCFh3 8C3kfA+NcpVQOcGFDEQZtT14MEDxChO9oirHIxhT2F1NoOIRhc9VZKR9edeb58psauh4 PB2wCZjOGrlCMF8G7/UEire4qUZeTbPchtBQcT7B0clWmOiPgAxjsIo7adOeYj1jFlk0 k7EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aorq02zu; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020a056402511200b00458525f9349si823333edd.253.2022.09.29.15.56.16; Thu, 29 Sep 2022 15:56:41 -0700 (PDT) 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=aorq02zu; 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 S230271AbiI2Wgu (ORCPT + 99 others); Thu, 29 Sep 2022 18:36:50 -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> X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: 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