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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 924CDC433DB for ; Wed, 10 Mar 2021 23:22:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F01264FC3 for ; Wed, 10 Mar 2021 23:22:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F01264FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 829BF8D024D; Wed, 10 Mar 2021 18:22:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D9748D0243; Wed, 10 Mar 2021 18:22:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6532B8D024D; Wed, 10 Mar 2021 18:22:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 40D908D0243 for ; Wed, 10 Mar 2021 18:22:47 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 05F728249980 for ; Wed, 10 Mar 2021 23:22:47 +0000 (UTC) X-FDA: 77905541574.29.E462332 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf04.hostedemail.com (Postfix) with ESMTP id 34397138 for ; Wed, 10 Mar 2021 23:22:45 +0000 (UTC) IronPort-SDR: dm2vxQnmEg01223n2Pjm4sWwRJnHl7sIMmQb02F8EBxf8RF4jwsHHinexIS3GQU2T88T0ztFjH cZlCuh3eK3OA== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="273620506" X-IronPort-AV: E=Sophos;i="5.81,238,1610438400"; d="scan'208";a="273620506" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 15:22:44 -0800 IronPort-SDR: 0IDkoEO2HQZNiV1iZJn7oQUIDlBiMFDNIBXwwNfIe/p83TkZr4G7JQyi9y+5tOLg+e/KoeoVJ7 SITLPWfab66A== X-IronPort-AV: E=Sophos;i="5.81,238,1610438400"; d="scan'208";a="509838912" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.209.23.206]) ([10.209.23.206]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 15:22:42 -0800 Subject: Re: [PATCH v22 8/8] x86/vdso: Add ENDBR64 to __vdso_sgx_enter_enclave To: Dave Hansen , Jarkko Sakkinen 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 References: <20210310220519.16811-1-yu-cheng.yu@intel.com> <20210310220519.16811-9-yu-cheng.yu@intel.com> <8b8efe44-b79f-ce29-ee28-066f88c93840@intel.com> From: "Yu, Yu-cheng" Message-ID: <727fed3a-f7da-a947-4221-56ab39deefe4@intel.com> Date: Wed, 10 Mar 2021 15:22:41 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Stat-Signature: opk9fu9z9smdb6fmqr57uczf3eafjzga X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 34397138 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=mga05.intel.com; client-ip=192.55.52.43 X-HE-DKIM-Result: none/none X-HE-Tag: 1615418565-464103 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 3/10/2021 3:20 PM, Dave Hansen wrote: > On 3/10/21 2:55 PM, 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.=C2=A0 Without the "no-track" prefix, = if an >> indirect call/jmp reaches a non-endbr opcode, a control-protection fau= lt >> is raised.=C2=A0 Usually endbr's are inserted by the compiler.=C2=A0 F= or assembly, >> these have to be put in manually.=C2=A0 I will add this in the commit = log if >> there is another revision.=C2=A0 Thanks! >=20 > This is close, but it's missing a detail or two that I think is > important for someone like Jarkko trying to figure out what it means fo= r > his subsystem or driver. >=20 > I'd probably say: >=20 > ENDBR is a special new instruction for the Indirect Branch Tracking > (IBR) component of CET. IBT prevents attacks by ensuring that (most) > indirect branches and function calls may only land at ENDBR > instructions. Branches that don't follow the rules will result in > control flow (#CF) exceptions. >=20 > ENDBR is a noop when IBT is unsupported or disabled. Most ENDBR > instructions are inserted automatically by the compiler, but branch > targets written in assembly must have ENDBR added manually, like this o= ne. >=20 Ok, I will update. Thanks! -- Yu-cheng