Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2762720ybh; Mon, 9 Mar 2020 12:28:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs5bVw0743VVu4BXVzY99P0iMzwci+Ib+8d8hi6qMD87W3tFyZKu53ETuYRZt1gEx3N7ZLX X-Received: by 2002:a9d:6205:: with SMTP id g5mr14838109otj.153.1583782137347; Mon, 09 Mar 2020 12:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583782137; cv=none; d=google.com; s=arc-20160816; b=HqwY6m28GMSq1PYaAp7zvPYyoJnYVS5CRWa1YM2Q9NAcESKSOTiPjgwzjNle4OhIeo bQW39bjmnrkUNA8lJ7EQIiAsY6HRfa6mD+8d5/hjrhIbf1uEwftS+Xyo+Gr8b/ZqDDou JiS2vN7b5g/aNAFzP5LS5Z73yLtj/wQKEAh5QL4olk81QcE4qkjai6iABiCl2V3dvOuu yFsQKrrofWJnDvQKgkEgnejPWcrqTMfUPRY3Jb1otFypcE/Hh5Nf6MeQI7o/6qqmI+SR /VUkgbSxqBn4qa7TnshOpb0SJ6tF8gBckViJJdRDaeUJqGE+2L8kiozFj7IcQ1n5q8/Z e4pw== 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; bh=tTK1GuFJ2MCQrHPKP6EOB013CmjTDmR6STyIrQi6EvY=; b=JmOfgtYCEp2o89jylsCK2YvpEFnA7Wh4zgcFK1uRem7bswfUr0t3bCJyxLMWxASNBj kE3DMILUznft5R3e/Avtv9i8okkeuUyztXVxGE/Abh8x1BEW8TtUUQ3IJthrSb8OVDGg V5QZa9gMSAPJgOSjyvFvMS8WAS18X4nWOxZefeExUXRJt5tZKB+MaYBbqEVfj7Z5fjJh UKE2YCwYTplTAv9U39OVWy1m+A/rYT4L0zAhvaATZ77ar4rn8v/Kc0RZgoT17V2sxfky aLMLXb9+N6fQZuqKjM/L8QlFwpePdKOUXg69yASZofj3tbbLBakb2KbEHOpkjILZ0667 AQBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 9si4766213ois.90.2020.03.09.12.28.39; Mon, 09 Mar 2020 12:28:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726368AbgCIT1b (ORCPT + 99 others); Mon, 9 Mar 2020 15:27:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:20358 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbgCIT1a (ORCPT ); Mon, 9 Mar 2020 15:27:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2020 12:27:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,534,1574150400"; d="scan'208";a="414918030" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga005.jf.intel.com with ESMTP; 09 Mar 2020 12:27:28 -0700 Message-ID: Subject: Re: [RFC PATCH v9 01/27] 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 , x86-patch-review@intel.com Date: Mon, 09 Mar 2020 12:27:28 -0700 In-Reply-To: <968af1c2-a5b4-fb48-dfa9-499ec37f677c@intel.com> References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-2-yu-cheng.yu@intel.com> <9ae1cf84-1d84-1d34-c0ce-48b0d70b8f3f@intel.com> <0f43463e02d1be2af6bcf8ff6917e751ba7676a0.camel@intel.com> <968af1c2-a5b4-fb48-dfa9-499ec37f677c@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-03-09 at 10:21 -0700, Dave Hansen wrote: > On 3/9/20 10:00 AM, Yu-cheng Yu wrote: > > On Wed, 2020-02-26 at 09:57 -0800, Dave Hansen wrote: > > > > index ade4e6ec23e0..8b69ebf0baed 100644 > > > > --- a/Documentation/admin-guide/kernel-parameters.txt > > > > +++ b/Documentation/admin-guide/kernel-parameters.txt > > > > @@ -3001,6 +3001,12 @@ > > > > noexec=on: enable non-executable mappings (default) > > > > noexec=off: disable non-executable mappings > > > > > > > > + no_cet_shstk [X86-64] Disable Shadow Stack for user-mode > > > > + applications > > > > > > If we ever add kernel support, "no_cet_shstk" will mean "no cet shstk > > > for userspace"? > > > > What about no_user_shstk, no_kernel_shstk? [...] > > > > +Note: > > > > + There is no CET-enabling arch_prctl function. By design, CET is > > > > + enabled automatically if the binary and the system can support it. > > > > > > This is kinda interesting. It means that a JIT couldn't choose to > > > protect the code it generates and have different rules from itself? > > > > JIT needs to be updated for CET first. Once that is done, it runs with CET > > enabled. It can use the NOTRACK prefix, for example. > > Am I missing something? > > What's the direct connection between shadow stacks and Indirect Branch > Tracking other than Intel marketing umbrellas? What I meant is that JIT code needs to be updated first; if it skips RETs, it needs to unwind the stack, and if it does indirect JMPs somewhere it needs to fix up the branch target or use NOTRACK. > > > > + The parameters passed are always unsigned 64-bit. When an IA32 > > > > + application passing pointers, it should only use the lower 32 bits. > > > > > > Won't a 32-bit app calling prctl() use the 32-bit ABI? How would it > > > even know it's running on a 64-bit kernel? > > > > The 32-bit app is passing only a pointer to an array of 64-bit numbers. > > Well, the documentation just talked about pointers and I naively assume > it means the "unsigned long *" you had in there. > > Rather than make suggestions, just say that the ABI is universally > 64-bit. Saying that the pointers must be valid is just kinda silly. > It's also not 100% clear what an "IA32 application" *MEANS* given fun > things like x32. Ok, I will update the text. > > Also, I went to go find this implementation in your series. I couldn't > find it. Did I miss a patch? Or are you documenting things you didn't > even implement? In patch #27: Add arch_prctl functions for Shadow Stack. Yu-cheng