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 756DAC433B4 for ; Wed, 28 Apr 2021 15:43:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0122A608FE for ; Wed, 28 Apr 2021 15:43:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0122A608FE 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 5FDD1940022; Wed, 28 Apr 2021 11:43:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D5A1940015; Wed, 28 Apr 2021 11:43:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 461F5940022; Wed, 28 Apr 2021 11:43:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 2C44D940015 for ; Wed, 28 Apr 2021 11:43:07 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D5148180AD811 for ; Wed, 28 Apr 2021 15:43:06 +0000 (UTC) X-FDA: 78082194372.01.8482B1E Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf28.hostedemail.com (Postfix) with ESMTP id 3DCB7200027C for ; Wed, 28 Apr 2021 15:43:02 +0000 (UTC) IronPort-SDR: pBi0dwbTABZrlrM3fRYtc+IbfopDk06NGJtqjo6Ctq1y05ng0LzHlGxpPf1QKo6WdMQmtOHt3L nFGl8Yhyn3gA== X-IronPort-AV: E=McAfee;i="6200,9189,9968"; a="184253894" X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="184253894" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2021 08:42:50 -0700 IronPort-SDR: /OWRlgjZ0wHSA6ggy60QZxgWW9o+HITbgQiS/XSvWmnow0pIOwN5tBgD9qTODMQKg/BS5HJIjd 28fqMtnt2dsg== X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="430359505" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.209.133.34]) ([10.209.133.34]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2021 08:42:48 -0700 Subject: Re: [PATCH v26 0/9] Control-flow Enforcement: Indirect Branch Tracking To: Andy Lutomirski , "H.J. Lu" Cc: David Laight , "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 , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , 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: <20210427204720.25007-1-yu-cheng.yu@intel.com> <0e03c50ea05440209d620971b9db4f29@AcuMS.aculab.com> From: "Yu, Yu-cheng" Message-ID: <9f7dbabe-f369-fef9-a303-53e94c5fa4ad@intel.com> Date: Wed, 28 Apr 2021 08:42:48 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3DCB7200027C X-Stat-Signature: 4rg5j1qeeoodbtpfmccwumz3fmet31qo Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=mga18.intel.com; client-ip=134.134.136.126 X-HE-DKIM-Result: none/none X-HE-Tag: 1619624582-849825 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 4/28/2021 8:14 AM, Andy Lutomirski wrote: > On Wed, Apr 28, 2021 at 7:57 AM H.J. Lu wrote: >> >> On Wed, Apr 28, 2021 at 7:52 AM Andy Lutomirski wrote: >>> >>> On Wed, Apr 28, 2021 at 7:48 AM David Laight wrote: >>>> >>>> From: Yu-cheng Yu >>>>> Sent: 27 April 2021 21:47 >>>>> >>>>> Control-flow Enforcement (CET) is a new Intel processor feature that blocks >>>>> return/jump-oriented programming attacks. Details are in "Intel 64 and >>>>> IA-32 Architectures Software Developer's Manual" [1]. >>>> ... >>>> >>>> Does this feature require that 'binary blobs' for out of tree drivers >>>> be compiled by a version of gcc that adds the ENDBRA instructions? David, do you mean kernel loadable drivers here? Do not worry about it for now, since shadow stack/ibt is not enabled for kernel-mode yet. >>>> >>>> If enabled for userspace, what happens if an old .so is dynamically >>>> loaded? >> >> CET will be disabled by ld.so in this case. > > What if a program starts a thread and then dlopens a legacy .so? > >> >>>> Or do all userspace programs and libraries have to have been compiled >>>> with the ENDBRA instructions? >> >> Correct. ld and ld.so check this. >> >>> If you believe that the userspace tooling for the legacy IBT table >>> actually works, then it should just work. Yu-cheng, etc: how well >>> tested is it? >>> >> >> Legacy IBT bitmap isn't unused since it doesn't cover legacy codes >> generated by legacy JITs. >> > > How does ld.so decide whether a legacy JIT is in use? > Let me clarify. IBT bitmap isn't used at all. How dlopen() works depends entirely on the tunable of glibc.cpu.x86_ibt. There are three values: on, off, permissive. On is always on, and off is always off, regardless of the .so having ibt or not. The default is "permissive," which turns off ibt upon dlopen a legacy .so. I hope this also answers Andy's question above. Yu-cheng