Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2751400ybk; Mon, 18 May 2020 07:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/Vz0hxxHT0NShBMDPEdnF3366CjLn8XLMB3NHh/k9k5gHskezhPzigOPH0TN76w4MNW7O X-Received: by 2002:a05:6402:1d2d:: with SMTP id dh13mr13029124edb.169.1589810861034; Mon, 18 May 2020 07:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589810861; cv=none; d=google.com; s=arc-20160816; b=s+OX3w85Xn93SJ9wALGpT3U9Ux0ObVbitqH2cYoQRIvP4sPYNk5XKs3k5iE/CjIyq9 YlnIrVlDt3voIACaWxEzMLLqW+7e7dZijKW03e62GhNEWbis3fjjr+1nxNJCxTz6o1UG SyaIXMcagkGxkGhlVRbey1r7ocL/Ojph6lUjwnr/tNgeYK1OHsTHyk5FjRGnkZNTpGQs SzuyaCPNeJKTWxFE3FwIKRrbAdD4IC805/GP/3779UTYbo15mAEVdDA6PGdMEIpcsIKi BP6KfpfEt/nfIA8nPX9q6Zt8VLcBKadk/ex4FF4fRvvfahWXvyPjq27xGHvGngzDIFLd JIRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Lc2ja+OHTT8sTlT4PSJZmwpduIMp6MGd9lph+7ugvPo=; b=nqfJrvR+aFRBQovdtb/D/w1aK4BWkThEaumGjj89tmvwNIGFfVuf2/YgtZtXEz7Z4N 5GyqGV0UEQxmZoYbW7gcBldZ3tP4Jwsx3ybpGWoTVq+ZOBrudhzmdNiReyBcQgHmEAPA zRuZniWxYWbK8Vl6ch5+lAUgxcHcSlLqXJhN+Ut5IjVlqyrPv7R0rjxvRH8UmFkp2+tb 4w3EWy9f9xclinx9pSby9x4kFImdVQw1V9vaw419UWzVY1eLvvgMVORWRLpiAKBXQu42 51x18SU/NytzfLV5lKd0RwUKc7pxHOuavdbfi+GIfCoqJ+qrm2IS7OvOy536wCVY722p fh+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qbduvMOb; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si5774437ejf.485.2020.05.18.07.07.16; Mon, 18 May 2020 07:07:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qbduvMOb; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727036AbgEROCD (ORCPT + 99 others); Mon, 18 May 2020 10:02:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726800AbgEROCD (ORCPT ); Mon, 18 May 2020 10:02:03 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 056CDC061A0C; Mon, 18 May 2020 07:02:03 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id f4so10617698iov.11; Mon, 18 May 2020 07:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Lc2ja+OHTT8sTlT4PSJZmwpduIMp6MGd9lph+7ugvPo=; b=qbduvMObfB4yRjE16Lk2I1jkkFlC8gyxmScE8/yONEYtl+ha6GHHDoroIcPVup9AP5 Kkj80GO+NWP/QuDci+E6oklocfM+u5RTtsJWZN7IGRxf6UCxPDS9ESSsQE+QJrx+lf9w UzktJo9Gtow4lVCwDFoIxmsE092+kcszCfcXPd5zL2AT4mui2+Z54+CrueIXzrJkdy7a 9r6TvT9azMS5JMo+MECqRncNO8mreZf9+cSNF3yjreOXzKJ20jLNMZ+X7ORrshGqIAnf eGEvnzgChQN/efkM2AQwHUCIoUX/uS3Nmls3gDBd90VH2MtitggtarHViNqjBZSFmN2l PNeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Lc2ja+OHTT8sTlT4PSJZmwpduIMp6MGd9lph+7ugvPo=; b=YatGenUe840OwYOofD1t8AvhAJBGeWj8m2GvMvuxqWOK8Mpxe7+JtAI8cpkjfiN/v2 kCw0937RxWntO+2wL7T5DdIOviMo9R8864ywKhvo4BiTakWWlIGhNS50QdRQYxChQoJi eiYrQRMyxju4NeIAHLabfldq2viygQ0ZhE9I6a41Xsy6/NVAnbEqgGYzlk0mpiIIPJd2 R6gsVt5qhYw4/744X/8T6pE3Hg7b+fkO03F+hev+IuhMWZ2jKoQvQxAEXe0Fh595X41y fc012AX8o6ol8A/x/eiH+QOW1NIh7FYifjk+cOajL8cOWN/KrCZEVcCXZ33N5DaOm4mu DYWQ== X-Gm-Message-State: AOAM533XaKJlXfNJg+rBH0oapkcYCsudaMVmlpBKK8/6EKOb8YxbaOuu GtAupqfk8e6MeSv5fymdQq8O2RnhiRAwlVhEsac= X-Received: by 2002:a5e:d918:: with SMTP id n24mr14655993iop.28.1589810522288; Mon, 18 May 2020 07:02:02 -0700 (PDT) MIME-Version: 1.0 References: <20200429220732.31602-1-yu-cheng.yu@intel.com> <20200429220732.31602-2-yu-cheng.yu@intel.com> <5cc163ff9058d1b27778e5f0a016c88a3b1a1598.camel@intel.com> <44c055342bda4fb4730703f987ae35195d1d0c38.camel@intel.com> <32235ffc-6e6c-fb3d-80c4-a0478e2d0e0f@intel.com> <631f071c-c755-a818-6a97-b333eb1fe21c@intel.com> <0f751be6d25364c25ee4bddc425b61e626dcd942.camel@intel.com> <6f2ef0e5-d3bb-2b52-dc81-8228fec4a3f5@intel.com> In-Reply-To: <6f2ef0e5-d3bb-2b52-dc81-8228fec4a3f5@intel.com> From: "H.J. Lu" Date: Mon, 18 May 2020 07:01:26 -0700 Message-ID: Subject: Re: [PATCH v10 01/26] Documentation/x86: Add CET description To: Dave Hansen Cc: Yu-cheng Yu , "the arch/x86 maintainers" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Andy Lutomirski , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 18, 2020 at 6:41 AM Dave Hansen wrote: > > On 5/15/20 7:53 PM, Yu-cheng Yu wrote: > > On Fri, 2020-05-15 at 16:56 -0700, Dave Hansen wrote: > >> What's my recourse as an end user? I want to run my app and turn off > >> CET for that app. How can I do that? > > > > GLIBC_TUNABLES=glibc.tune.hwcaps=-SHSTK,-IBT > > Like I mentioned to H.J., this is something that we need to at least > acknowledge the existence of in the changelog and probably even the > Documentation/. > > >>>> I think you're saying that the CET-enabled binary would do > >>>> arch_setup_elf_property() when it was first exec()'d. Later, it could > >>>> use the new prctl(ARCH_X86_CET_DISABLE) to disable its shadow stack, > >>>> then fork() and the child would not be using CET. Right? > >>>> > >>>> What is ARCH_X86_CET_DISABLE used for, anyway? > >>> > >>> Both the parent and the child can do ARCH_X86_CET_DISABLE, if CET is > >>> not locked. > >> > >> Could you please describe a real-world example of why > >> ARCH_X86_CET_DISABLE exists? What kinds of apps will use it, or *are* > >> using it? Why was it created in the first place? > > > > Currently, ld-linux turns off CET if the binary being loaded does not support > > CET. > > Great! Could this please be immortalized in the documentation for the > prctl()? > > >>>>>> Does this *code* work? Could you please indicate which JITs have been > >>>>>> enabled to use the code in this series? How much of the new ABI is in use? > >>>>> > >>>>> JIT does not necessarily use all of the ABI. The JIT changes mainly fix stack > >>>>> frames and insert ENDBRs. I do not work on JIT. What I found is LLVM JIT fixes > >>>>> are tested and in the master branch. Sljit fixes are in the release. > >>>> > >>>> Huh, so who is using the new prctl() ABIs? > >>> > >>> Any code can use the ABI, but JIT code CET-enabling part mostly do not use these > >>> new prctl()'s, except, probably to get CET status. > >> > >> Which applications specifically are going to use the new prctl()s which > >> this series adds? How are they going to use them? > >> > >> "Any code can use them" is not a specific enough answer. > > > > We have four arch_ptctl() calls. ARCH_X86_CET_DISABLE and ARCH_X86_CET_LOCK are > > used by ld-linux. ARCH_X86_CET_STATUS are used in many places to determine if > > CET is on. ARCH_X86_CET_ALLOC_SHSTK is used in ucontext related handling, but > > it can be use by any application to switch shadow stacks. > > Could some of this information be added to the documentation, please? > It would also be nice to have some more details about how apps end up > using ARCH_X86_CET_STATUS. Why would they care that CET is on? CET software spec is at https://gitlab.com/x86-psABIs/x86-64-ABI/-/wikis/Intel-CET-extension My CET presentation at 2018 LPC is at https://www.linuxplumbersconf.org/event/2/contributions/147/attachments/72/83/CET-LPC-2018.pdf I am working on an updated CET presentation for 2020 LPC. Let me know if you want to see the early draft. -- H.J.