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 38A75C433DB for ; Tue, 16 Mar 2021 17:45:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B44586512B for ; Tue, 16 Mar 2021 17:45:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B44586512B 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 46E276B006C; Tue, 16 Mar 2021 13:45:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 41D7F6B006E; Tue, 16 Mar 2021 13:45:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2707B6B0070; Tue, 16 Mar 2021 13:45:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 09D8C6B006C for ; Tue, 16 Mar 2021 13:45:06 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B1C818777 for ; Tue, 16 Mar 2021 17:45:05 +0000 (UTC) X-FDA: 77926463370.26.69FC817 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf03.hostedemail.com (Postfix) with ESMTP id 3A635C000C59 for ; Tue, 16 Mar 2021 17:44:59 +0000 (UTC) IronPort-SDR: IJRRYe2UYE7E6izZTC6XHDWG1dBlpDz1oOA9LmWE4k8bqOejbhI+nJKGVeW2RZuC2v40USUIIk MdUCX8ioPvuQ== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="186929023" X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="scan'208";a="186929023" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 10:44:52 -0700 IronPort-SDR: MZjiMp03UYJamI4W2nRjnkJKXjIRKPIm2imBomEuZSibBREq9EtVM4UkPwqWtXondLmupytRjs 9OxkjGvzBGxw== X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="scan'208";a="439201248" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.191.248]) ([10.212.191.248]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 10:44:46 -0700 Subject: Re: [PATCH v23 6/9] x86/entry: Introduce ENDBR macro To: Dave Hansen , 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 Cc: Jarkko Sakkinen References: <20210316151320.6123-1-yu-cheng.yu@intel.com> <20210316151320.6123-7-yu-cheng.yu@intel.com> <15966857-9be7-3029-7e93-e40596b4649a@intel.com> <0c0b3663-3c01-c166-03fa-a3dbfb250da3@intel.com> From: "Yu, Yu-cheng" Message-ID: <1cbd8068-60e3-3fc9-9618-3262b179182d@intel.com> Date: Tue, 16 Mar 2021 10:44:46 -0700 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: <0c0b3663-3c01-c166-03fa-a3dbfb250da3@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Stat-Signature: bspnsr8m3f9ic15z8xxday574tqfweb1 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3A635C000C59 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=mga04.intel.com; client-ip=192.55.52.120 X-HE-DKIM-Result: none/none X-HE-Tag: 1615916699-594895 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/16/2021 10:28 AM, Dave Hansen wrote: > On 3/16/21 10:12 AM, Yu, Yu-cheng wrote: >> On 3/16/2021 8:49 AM, Dave Hansen wrote: > ... >>> Is "#ifdef __i386__" the right thing to use here?=C2=A0 I guess ENDBR= only >>> ends up getting used in the VDSO, but there's a lot of >>> non-userspace-exposed stuff in calling.h.=C2=A0 It seems a bit weird = to have >>> the normally userspace-only __i386__ in there. >>> >>> I don't see any existing direct use of __i386__ in arch/x86/entry/vds= o. >> >> Good point.=C2=A0 My thought was, __i386__ comes from the compiler hav= ing the >> -m32 command-line option, and it is not dependent on anything else. >> >> Alternatively, there is another compiler-defined macro _CET_ENDBR that >> can be used.=C2=A0 We can put the following in calling.h: >> >> #ifdef __CET__ >> #include >> #else >> #define _CET_ENDBR >> #endif >> >> and then use _CET_ENDBR in other files.=C2=A0 How is that? >> >> In the future, in case we have kernel-mode IBT, ENDBR macros are also >> needed for other assembly files. >=20 > First of all, I think putting the macro in calling.h is wrong if it wil= l > be used exclusively in the VDSO. If it's VDSO-only, please put it in a > local header in the vdso/ directory, maybe even a new cet.h. >=20 > Also, Boris asked for two *different* macros for 32 and 64-bit: >=20 > https://lore.kernel.org/linux-api/20210310231731.GK23521@zn.tnic/ >=20 > Could you do that in the next version, please? >=20 Yes, we can do two macros, probably in arch/x86/include/asm/vdso.h.