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 X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75220C4332E for ; Thu, 11 Mar 2021 03:37:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 487CD64FE0 for ; Thu, 11 Mar 2021 03:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbhCKDgm (ORCPT ); Wed, 10 Mar 2021 22:36:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:51254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbhCKDgb (ORCPT ); Wed, 10 Mar 2021 22:36:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D85C64E22; Thu, 11 Mar 2021 03:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615433791; bh=VU36+Oy9eNMQX1av5VV5rT/wzZmLW57dBFB+sUkXF4w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e7M11Ykz/wwfbgjKNn5uhle8DDoJiLEl5wtNAzrhBK5zeTMiiIe70zX3rO1f+tMpn EV8wPp3kqY/+Epphh1oW1a5Wg8muWy6V92Lc0VJ47G57DvHYoMIwrbmJC82GJh7K2K xT3sFovM1zbQxp17qxWMUtcMUruA7l6KLd9nF5BCTc7IfAN0XDhrteiGRvWvEOECEo GdnDEiGZfSEgrEWvKdvoj8OFJFrrbOLoTkSFI+bRru2BEB5IIeLYrjnJ4n4t0YTywG EbYs1bSm7vsUntt8XSuaTBZJnaAe/AIFepL4WoJO8P7vVTqj3xFoBZZpl7lAUf19fm z301GU9DwHQVw== Date: Thu, 11 Mar 2021 05:36:06 +0200 From: Jarkko Sakkinen To: "Yu, Yu-cheng" Cc: 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" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang Subject: Re: [PATCH v22 8/8] x86/vdso: Add ENDBR64 to __vdso_sgx_enter_enclave Message-ID: References: <20210310220519.16811-1-yu-cheng.yu@intel.com> <20210310220519.16811-9-yu-cheng.yu@intel.com> <8b8efe44-b79f-ce29-ee28-066f88c93840@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b8efe44-b79f-ce29-ee28-066f88c93840@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 02:55:55PM -0800, Yu, Yu-cheng wrote: > On 3/10/2021 2:39 PM, Jarkko Sakkinen wrote: > > On Wed, Mar 10, 2021 at 02:05:19PM -0800, Yu-cheng Yu wrote: > > > When CET is enabled, __vdso_sgx_enter_enclave() needs an endbr64 > > > in the beginning of the function. > > > > OK. > > > > What you should do is to explain what it does and why it's needed. > > > > The endbr marks a branch target. Without the "no-track" prefix, if an > indirect call/jmp reaches a non-endbr opcode, a control-protection fault is > raised. Usually endbr's are inserted by the compiler. For assembly, these > have to be put in manually. I will add this in the commit log if there is > another revision. Thanks! Thanks for the explanation. There is another revision, because this is lacking from the commit message. Does it do any harm to put it there unconditionally? > > -- > Yu-cheng > > > > > > > Signed-off-by: Yu-cheng Yu > > > Cc: Andy Lutomirski > > > Cc: Dave Hansen > > > Cc: Jarkko Sakkinen > > > --- > > > arch/x86/entry/vdso/vsgx.S | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/arch/x86/entry/vdso/vsgx.S b/arch/x86/entry/vdso/vsgx.S > > > index 86a0e94f68df..a70d4d09f713 100644 > > > --- a/arch/x86/entry/vdso/vsgx.S > > > +++ b/arch/x86/entry/vdso/vsgx.S > > > @@ -27,6 +27,9 @@ > > > SYM_FUNC_START(__vdso_sgx_enter_enclave) > > > /* Prolog */ > > > .cfi_startproc > > > +#ifdef CONFIG_X86_CET > > > + endbr64 > > > +#endif > > > push %rbp > > > .cfi_adjust_cfa_offset 8 > > > .cfi_rel_offset %rbp, 0 > > > -- > > > 2.21.0 > > > > > > > > > > /Jarkko > > > > /Jarkko