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=-8.8 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=unavailable 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 41253C10DAA for ; Thu, 10 Sep 2020 02:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16B33206F4 for ; Thu, 10 Sep 2020 02:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730140AbgIJCVI (ORCPT ); Wed, 9 Sep 2020 22:21:08 -0400 Received: from mga03.intel.com ([134.134.136.65]:52209 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730729AbgIJCSf (ORCPT ); Wed, 9 Sep 2020 22:18:35 -0400 IronPort-SDR: IzZnHC92zX56tSI2JiAj352zGjlBYSii2icYTIWU6+U42tFtgHuCRMcIcjkEdLw/wlOBPU59GC FRgfqUtlQXKg== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="158468124" X-IronPort-AV: E=Sophos;i="5.76,410,1592895600"; d="scan'208";a="158468124" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 16:07:09 -0700 IronPort-SDR: qkfpSoKV1QeBLR8tjA8HAJxMsc61Q3klbLaexWsYoj4/2+poJ8zDHk1wXd4u6VEzMkKvkZoTVx KbyeR31mj0lQ== X-IronPort-AV: E=Sophos;i="5.76,410,1592895600"; d="scan'208";a="300309339" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.243.130]) ([10.212.243.130]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 16:07:08 -0700 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: Dave Hansen , Andy Lutomirski Cc: Dave Martin , "H.J. Lu" , Florian Weimer , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Weijiang Yang References: <086c73d8-9b06-f074-e315-9964eb666db9@intel.com> <73c2211f-8811-2d9f-1930-1c5035e6129c@intel.com> <20200826164604.GW6642@arm.com> <87ft892vvf.fsf@oldenburg2.str.redhat.com> <0e9996bc-4c1b-cc99-9616-c721b546f857@intel.com> <4f2dfefc-b55e-bf73-f254-7d95f9c67e5c@intel.com> <20200901102758.GY6642@arm.com> <32005d57-e51a-7c7f-4e86-612c2ff067f3@intel.com> <46dffdfd-92f8-0f05-6164-945f217b0958@intel.com> <6e1e22a5-1b7f-2783-351e-c8ed2d4893b8@intel.com> <5979c58d-a6e3-d14d-df92-72cdeb97298d@intel.com> From: "Yu, Yu-cheng" Message-ID: <08c91835-8486-9da5-a7d1-75e716fc5d36@intel.com> Date: Wed, 9 Sep 2020 16:07:07 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-arch-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On 9/9/2020 3:59 PM, Dave Hansen wrote: > On 9/9/20 3:08 PM, Yu, Yu-cheng wrote: >> After looking at this more, I found the changes are more similar to >> mprotect() than madvise().  We are going to change an anonymous mapping >> to a read-only mapping, and add the VM_SHSTK flag to it.  Would an >> x86-specific mprotect(PROT_SHSTK) make more sense? >> >> One alternative would be requiring a read-only mapping for >> madvise(MADV_SHSTK).  But that is inconvenient for the application. > > Why? It's just: > > mmap()/malloc(); > mprotect(PROT_READ); > madvise(MADV_SHSTK); > > vs. > > mmap()/malloc(); > mprotect(PROT_SHSTK); > > I'm not sure a single syscall counts as inconvenient. > > I don't quite think we should use a PROT_ bit for this. It seems like > the kind of thing that could be fragile and break existing expectations. > I don't care _that_ strongly though. > What if a writable mapping is passed to madvise(MADV_SHSTK)? Should that be rejected?