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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 C16CAC433E6 for ; Tue, 1 Sep 2020 10:28:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71A5F2083B for ; Tue, 1 Sep 2020 10:28:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71A5F2083B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DD86A6B005D; Tue, 1 Sep 2020 06:28:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D89196B0062; Tue, 1 Sep 2020 06:28:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C51D36B0068; Tue, 1 Sep 2020 06:28:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id A8B296B005D for ; Tue, 1 Sep 2020 06:28:08 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6A88A8248D7C for ; Tue, 1 Sep 2020 10:28:08 +0000 (UTC) X-FDA: 77214117456.24.juice09_5d0f14227097 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 42D711A4A0 for ; Tue, 1 Sep 2020 10:28:08 +0000 (UTC) X-HE-Tag: juice09_5d0f14227097 X-Filterd-Recvd-Size: 4477 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Sep 2020 10:28:07 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B96D330E; Tue, 1 Sep 2020 03:28:06 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 06EF93F71F; Tue, 1 Sep 2020 03:28:02 -0700 (PDT) Date: Tue, 1 Sep 2020 11:28:00 +0100 From: Dave Martin To: "H.J. Lu" Cc: Dave Hansen , "Yu, Yu-cheng" , Andy Lutomirski , 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 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack Message-ID: <20200901102758.GY6642@arm.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Rspamd-Queue-Id: 42D711A4A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Aug 27, 2020 at 06:26:11AM -0700, H.J. Lu wrote: > On Wed, Aug 26, 2020 at 12:57 PM Dave Hansen wrote: > > > > On 8/26/20 11:49 AM, Yu, Yu-cheng wrote: > > >> 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? > > > > No idea. > > > > But, mmap_special() is *basically* mmap2() with extra-big flags space. > > I suspect it will grow some more uses on top of shadow stacks. It could > > have, for instance, been used to allocate MPX bounds tables. > > There is no reason we can't use > > long arch_prctl (int, unsigned long, unsigned long, unsigned long, ..); > > for ARCH_X86_CET_MMAP_SHSTK. We just need to use > > syscall (SYS_arch_prctl, ARCH_X86_CET_MMAP_SHSTK, ...); For arm64 (and sparc etc.) we continue to use the regular mmap/mprotect family of calls. One or two additional arch-specific mmap flags are sufficient for now. Is x86 definitely not going to fit within those calls? For now, I can't see what arg[2] is used for (and hence the type argument of mmap_special()), but I haven't dug through the whole series. Cheers ---Dave