Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2764848ybk; Mon, 18 May 2020 07:25:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNVo/TTacK5hky/93YXPmgJEYh5PitvI/xulI9j6PAYL8Zfsda8XShUAdt3To61Dj98Ot3 X-Received: by 2002:aa7:d98c:: with SMTP id u12mr2736671eds.85.1589811928538; Mon, 18 May 2020 07:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589811928; cv=none; d=google.com; s=arc-20160816; b=xrDKjnwe7WpHGBqylwl+IZDGt5x/WGeadfv1mnCcH/8oVnJSWwWOdisW/TtCD2cY+M rom+5+JGOfh4H5oJxqJjFQw5S1Oj6HBt5FqFVyiKgJbCAWeVXuwNXnetvJAPGYSUfhu+ fgKLZlY1QnbPe+j0F2z+vdRja6F4p6HCcZ891dgHp5/du6DXIUgzJxPCJ7bwOTad0fQG XaD19G8LCb0nBlIZapZ7YJlx4Gs3WsRgw6VuSYGHZkC5Li8VQnuFnxuC17AhsQZkRH7w ChaUP/9dbMC+NTjN9hvvdful9LKUstolfVP5xb8/CnH0d2l0EN9tHrwFkGIZkfRAKfJV Xn0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id :ironport-sdr:ironport-sdr; bh=iUrZ/277x563Prx6AfWbWBMSQti3Vo/oW1Pu8mgzFGY=; b=CAHXZuADfsT2rrgxxlM28hYWBKw0By9iYkSxtLV3TNBiawigYrWZnwYmVV0Dl1+U7x SuP3X/9G6Z1wBEpRV9MPld7JSLY17PKisosq6jM1pQuUZL3cjdVZr4qJML3kg2QZUaER TdxXB37gyglroll2menGwC2vt3mJtYHNLrJDhXP7IVpMwGO4dO8P7kFi2QNNudZy5AvZ NUeoMmO/K8hpX/i2vlOG5JB1VbaEt3TcaxU6w8Mj4jZmp6RYV5kYIPyjYHlXkBsymsbg DTnU10MjiZULg2bqRH4Q+n+0qtcFMhRbpoYtcd+QIDMbhPIde9//if3l4issiGkoZAA2 FPEA== 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 i3si6268923ejg.428.2020.05.18.07.25.04; Mon, 18 May 2020 07:25:28 -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 S1727983AbgEROVW (ORCPT + 99 others); Mon, 18 May 2020 10:21:22 -0400 Received: from mga04.intel.com ([192.55.52.120]:29438 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbgEROVV (ORCPT ); Mon, 18 May 2020 10:21:21 -0400 IronPort-SDR: 785uuoDhT3VkOSqzFEFmJInsEm6GDfkvxdDMZPdNkhilYu6TUGae8RlCiXS/JWY57cjnEO44Hi 0FJBXp+fiiOw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2020 07:21:20 -0700 IronPort-SDR: Ju000fylxMRhD3U/zlfjUVehdqzMEoACEpsreORet3y01wLHG2QgRGl47fIRMgZyBs6Nevex3n AIYVqL+3ccTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,407,1583222400"; d="scan'208";a="288587097" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga004.fm.intel.com with ESMTP; 18 May 2020 07:21:20 -0700 Message-ID: Subject: Re: [PATCH v10 01/26] Documentation/x86: Add CET description From: Yu-cheng Yu 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 Date: Mon, 18 May 2020 07:21:26 -0700 In-Reply-To: <6f2ef0e5-d3bb-2b52-dc81-8228fec4a3f5@intel.com> 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> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-05-18 at 06:41 -0700, 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/. Sure. I will do that. > > > > > > 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()? Yes. > > > > > > > > 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? Yes. Yu-cheng