Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp624477pxy; Wed, 28 Apr 2021 10:42:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwu8C3ZPFw+RYAe6l6SpHDB5okrGAl0eJ6bPfCfZPrslOKhd5kPAR22vaex2gweNnj9mFu/ X-Received: by 2002:a17:906:6b89:: with SMTP id l9mr29800687ejr.249.1619631723752; Wed, 28 Apr 2021 10:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619631723; cv=none; d=google.com; s=arc-20160816; b=PqVIabpMQjkF4YA0FD+a10DKjJgo7ZGlxgW1ufulYd/IvtOhFVNu+ke3FvtV9Mc8OX o3j/8N3t45dvAlY6VCYG2Li0AgNuJ5pX4xEmR/3DzpLE+iHTR6kNA9lNXdnb5T7TseB7 mdvx5+vN0cwIbm8dHa9wAxDiLG1fXkDpJhtotIDKdLBmMYOT3f1jhjWdDkw2+nxC08lB RYUDxUEN/wwNrEPjoYwv9o4mizuJiPBYkklkJUZTo/3D1dHXf/fyfISC5n6WL5i8Acv7 fHtvYauORzTpvNDOooh+V9ykeMFKHnlemzLQotsfCX4iAxkj5wgMLek6EU6xFDKfgX9e RwMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=pR4I3F2DtGW6mm5e38v5kU2D0kG/v9ev5nvMcOkIP5g=; b=mhwRU5esy55Flpy3lTE7LKX2e8K7YSH7uquk6Ccqj8bm6PnUcShmtI+GSyUioueetq aiWb8F62U4mTYvB36ZM1x6jFZltw045r9Bw8GV4dmy4z36g8SN2bdrTSN+legdWy3Yfn YQCTlrt77oa4HzB48HsoucT9pVrPSND4uB4+k8F56Uh1Y+MRtGnLu0tQbbZ10PuU8W1e uoXnDjdQwV++PkVB92FXrVvHDlhBAcUaoLFwic6Xj8/JEmJXDbHMRSQvtxekh3aCHYHc 8nvOAu/dAVFO+Gr59nJfTGSXxn3em+nHSOKYdXFBtZmImJ4bolzVOdRqtEEGr0yEW0B2 0xFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si719343ejb.573.2021.04.28.10.41.40; Wed, 28 Apr 2021 10:42:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236938AbhD1Prj (ORCPT + 99 others); Wed, 28 Apr 2021 11:47:39 -0400 Received: from mga01.intel.com ([192.55.52.88]:38165 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240489AbhD1Pr0 (ORCPT ); Wed, 28 Apr 2021 11:47:26 -0400 IronPort-SDR: WDFuOCh4jFL+z6EiCWvxT3jzG8EXwRjrknnqD9+MTbfihsWwLYY5v5j8OKKcD+hVHlvpYpDfjO pNbLEWb9+Irw== X-IronPort-AV: E=McAfee;i="6200,9189,9968"; a="217489590" X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="217489590" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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