Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp331953pxa; Wed, 26 Aug 2020 11:50:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlwbCBEMzlV+K0uLCHxttqjXXMomNUar9AKnMVAoP2a3O8ANPwKKa2ztP954vNbep7Akfn X-Received: by 2002:a17:906:a4b:: with SMTP id x11mr18245590ejf.83.1598467858483; Wed, 26 Aug 2020 11:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598467858; cv=none; d=google.com; s=arc-20160816; b=WDYyosZFI7JwJGZNjp4BMyp5Yp+jZGI07py/lhoT9dHXVfUbadVMCEX87suQ6XazkT J9/MJ2iuD1KOwvFzI125jOw2Yr6PNMJ0H7EDQDH9QUbQBhbhwXK60ko10FXKuxWs6Orv Qj/LGft2fmZFyMBYDmdM8nHUjZtSTP+gWH4Ms3wbpFx8w9ZuBtf5Me1jVvXSk/zUnmp1 8/vreUsxagRO+2yt1go7gi0mnkqHcTDhccEzms4TKzJ8zCZILEUERxpwhpCSXW+Vj5iC CfiWR6udJzrU+5E1ZH23dBomgAz+/j+z6VXAnadG8Edki8lDKp6SRFB2UGmrCjL7G7Ke Ca/g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=sJasNIo4ywNnj341orPgwyKEZJwAVC0XfReviIL7GE0=; b=Gfy7aYTxGg+sXQO9L+nYHyUasvao18S/G68RB6Lr2k3kE+bup+tec4GVX071YEvRbM Ey2NoqjG74s2ZwygsQAFoe042jJzZqiCcmNDv155faPDLgKwNwoTf9/Oq/tYLg3aSrMa YNSw22KRw4hi3KhmzpPLRSArXkNaI8eNJLaYEe1sj3Nj8EDiF4wsuHoEndHT27yjGVXj mLRknIgwyKTYkc410WGCiQxP5bzyg3U2qU+CVDiP9nBPOiVP4cuAite15BJMF4k0Dtcq 6moedC8w9UE+5c7CYN8NzMekDaOs9AC1cs956aQECYte0AgMwTfEWpZzPHYjc6Ntuf8L L7aQ== 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 y19si1978209ejr.56.2020.08.26.11.50.35; Wed, 26 Aug 2020 11:50:58 -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 S1726894AbgHZStY (ORCPT + 99 others); Wed, 26 Aug 2020 14:49:24 -0400 Received: from mga12.intel.com ([192.55.52.136]:11669 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbgHZStX (ORCPT ); Wed, 26 Aug 2020 14:49:23 -0400 IronPort-SDR: KHu55cxrHrf0j8RUFm2jUI9+iDTzDovNZYYix61wcSZ7wRcRDpLzJFnaVK/egBpTSWbl0qn2GZ 85s5Q4Nf/R3g== X-IronPort-AV: E=McAfee;i="6000,8403,9725"; a="135915855" X-IronPort-AV: E=Sophos;i="5.76,356,1592895600"; d="scan'208";a="135915855" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2020 11:49:23 -0700 IronPort-SDR: kz1B6Bl9Evoh0DAuECATySIb6A0aSvHXJVx+ZQr3fJEHh3x2b1adDajhdyc7g2skce1j/DGDrQ EzPikqGDu3IQ== X-IronPort-AV: E=Sophos;i="5.76,356,1592895600"; d="scan'208";a="500347882" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.251.141.162]) ([10.251.141.162]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2020 11:49:22 -0700 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: Andy Lutomirski , Florian Weimer Cc: Dave Martin , Dave Hansen , 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 , "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 , Weijiang Yang References: <20200825002540.3351-1-yu-cheng.yu@intel.com> <20200825002540.3351-26-yu-cheng.yu@intel.com> <2d253891-9393-44d0-35e0-4b9a2da23cec@intel.com> <086c73d8-9b06-f074-e315-9964eb666db9@intel.com> <73c2211f-8811-2d9f-1930-1c5035e6129c@intel.com> <20200826164604.GW6642@arm.com> <87ft892vvf.fsf@oldenburg2.str.redhat.com> From: "Yu, Yu-cheng" Message-ID: <0e9996bc-4c1b-cc99-9616-c721b546f857@intel.com> Date: Wed, 26 Aug 2020 11:49:21 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/26/2020 10:04 AM, Andy Lutomirski wrote: > On Wed, Aug 26, 2020 at 9:52 AM Florian Weimer wrote: >> >> * Dave Martin: >> >>> On Tue, Aug 25, 2020 at 04:34:27PM -0700, Yu, Yu-cheng wrote: >>>> On 8/25/2020 4:20 PM, Dave Hansen wrote: >>>>> On 8/25/20 2:04 PM, Yu, Yu-cheng wrote: >>>>>>>> I think this is more arch-specific. Even if it becomes a new syscall, >>>>>>>> we still need to pass the same parameters. >>>>>>> >>>>>>> Right, but without the copying in and out of memory. >>>>>>> >>>>>> Linux-api is already on the Cc list. Do we need to add more people to >>>>>> get some agreements for the syscall? >>>>> What kind of agreement are you looking for? I'd suggest just coding it >>>>> up and posting the patches. Adding syscalls really is really pretty >>>>> straightforward and isn't much code at all. >>>>> >>>> >>>> Sure, I will do that. >>> >>> Alternatively, would a regular prctl() work here? >> >> Is this something appliation code has to call, or just the dynamic >> loader? >> >> prctl in glibc is a variadic function, so if there's a mismatch between >> the kernel/userspace syscall convention and the userspace calling >> convention (for variadic functions) for specific types, it can't be made >> to work in a generic way. >> >> The loader can use inline assembly for system calls and does not have >> this issue, but applications would be implcated by it. >> > > I would expect things like Go and various JITs to call it directly. > > If we wanted to be fancy and add a potentially more widely useful > syscall, how about: > > mmap_special(void *addr, size_t length, int prot, int flags, int type); > > Where type is something like MMAP_SPECIAL_X86_SHSTK. Fundamentally, > this is really just mmap() except that we want to map something a bit > magical, and we don't want to require opening a device node to do it. > One benefit of MMAP_SPECIAL_* is there are more free bits than MAP_*. Does ARM have similar needs for memory mapping, Dave? Yu-cheng