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 51D51C2D0A3 for ; Fri, 6 Nov 2020 18:16:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D1D7A20728 for ; Fri, 6 Nov 2020 18:16:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1D7A20728 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 1AFBD6B0036; Fri, 6 Nov 2020 13:16:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 15F916B005C; Fri, 6 Nov 2020 13:16:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04EAA6B005D; Fri, 6 Nov 2020 13:16:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id CBF7B6B0036 for ; Fri, 6 Nov 2020 13:16:53 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 71C83180AD81F for ; Fri, 6 Nov 2020 18:16:53 +0000 (UTC) X-FDA: 77454799506.15.story02_5a0d00c272d4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 4C6D31814B0C7 for ; Fri, 6 Nov 2020 18:16:53 +0000 (UTC) X-HE-Tag: story02_5a0d00c272d4 X-Filterd-Recvd-Size: 4885 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Nov 2020 18:16:51 +0000 (UTC) IronPort-SDR: n2ljIaIasVCEAplIHWl7+eXsC/ijU611KkwLFMwUsdZsXad1Dxp1b9eKE6WobY/wpW/M5BVj4t WB0IydPofRhw== X-IronPort-AV: E=McAfee;i="6000,8403,9797"; a="187509925" X-IronPort-AV: E=Sophos;i="5.77,457,1596524400"; d="scan'208";a="187509925" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2020 10:16:50 -0800 IronPort-SDR: Ka0NRVjMOuYPOBeUcJOa8OIqahm5plMd42C7NVz8KqlA/ZUcuqINGfCTJyq5K5JLNcCLYM2dr9 XzMj1I1VDiQg== X-IronPort-AV: E=Sophos;i="5.77,457,1596524400"; d="scan'208";a="472149838" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.221.127]) ([10.212.221.127]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2020 10:16:48 -0800 Subject: Re: [PATCH v14 01/26] Documentation/x86: Add CET description To: Borislav Petkov 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 , 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 References: <20201012153850.26996-1-yu-cheng.yu@intel.com> <20201012153850.26996-2-yu-cheng.yu@intel.com> <20201106173410.GG14914@zn.tnic> From: "Yu, Yu-cheng" Message-ID: Date: Fri, 6 Nov 2020 10:16:47 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201106173410.GG14914@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 11/6/2020 9:34 AM, Borislav Petkov wrote: > On Mon, Oct 12, 2020 at 08:38:25AM -0700, Yu-cheng Yu wrote: >> +[1] Overview >> +============ >> + >> +Control-flow Enforcement Technology (CET) is an Intel processor feature >> +that provides protection against return/jump-oriented programming (ROP) >> +attacks. It can be set up to protect both applications and the kernel. >> +Only user-mode protection is implemented in the 64-bit kernel, including >> +support for running legacy 32-bit applications. >> + >> +CET introduces Shadow Stack and Indirect Branch Tracking. Shadow stack is >> +a secondary stack allocated from memory and cannot be directly modified by >> +applications. When executing a CALL, the processor pushes the return > ^ > . .. instruction ... > I will update it. [...] >> + >> +[2] Application Enabling >> +======================== >> + >> +An application's CET capability is marked in its ELF header and can be >> +verified from the following command output, in the NT_GNU_PROPERTY_TYPE_0 >> +field: >> + >> + readelf -n > > Can be verified how? What does it say for a CET-enabled executable? Put > it here in the doc pls. > readelf -n | grep SHSTK properties: x86 feature: IBT, SHSTK I will add this. [...] >> +[3] Backward Compatibility >> +========================== >> + >> +GLIBC provides a few tunables for backward compatibility. >> + >> +GLIBC_TUNABLES=glibc.tune.hwcaps=-SHSTK,-IBT >> + Turn off SHSTK/IBT for the current shell. > > For the current shell? How? > > You mean, you execute the kernel shell with that variable set? So you > set this variable in any executable's env which links with glibc in > order to disable CET? > > In any case, this needs clarification. > In the current shell, if GLIBC_TUNABLES variable is set as such, applications started will have CET features disabled. I can put more details here, or maybe a reference to the GLIBC man pages. Thanks, Yu-cheng