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=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 758F8C433E1 for ; Wed, 26 Aug 2020 19:44:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1E1642076C for ; Wed, 26 Aug 2020 19:44:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ps/pJgcT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E1642076C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B5E056B0005; Wed, 26 Aug 2020 15:44:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0FC78E0003; Wed, 26 Aug 2020 15:44:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FC316B0007; Wed, 26 Aug 2020 15:44:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 88F8A6B0005 for ; Wed, 26 Aug 2020 15:44:16 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4489A824805A for ; Wed, 26 Aug 2020 19:44:16 +0000 (UTC) X-FDA: 77193746112.20.oil61_4a147ff27067 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 15BA0180C07AB for ; Wed, 26 Aug 2020 19:44:16 +0000 (UTC) X-HE-Tag: oil61_4a147ff27067 X-Filterd-Recvd-Size: 6602 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Wed, 26 Aug 2020 19:44:15 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id f12so2856277ils.6 for ; Wed, 26 Aug 2020 12:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lJ9q/iTfnCsZrkSkcmh8UHaAoIWOgUVnnZaiByIljT0=; b=Ps/pJgcT6hlQjSiv9LSDBFUBLEqMhQjJl+vRmYXQWoVU8FEt85TyheW93v4c1xKGn/ Anw5MGEuck1Lw8tOFZoHxtEaoxnCWoz8uxKNhvVxhLt+YphOBqavRg8DvHi4gVLDpJcQ W70rn7508qLaTn6d9FhUW8fZwkyu+CkONk1SFPOv9lniXIv0xYoBp3tMPOrfY4rb383t n+bYcmhHNKNXw0DztTgcTxgPH7HSyrQl+OQFOQkCrktG37+gm086BRyxfgUHercSBzx/ 70sVcuJy44Tn1oIqxDtgzULX/9cii27Iygnv0Rs35vn6icujZTGyyAU2BAqnhJtO3wcU HnDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lJ9q/iTfnCsZrkSkcmh8UHaAoIWOgUVnnZaiByIljT0=; b=YwnhmmtdFA9KbUKe9sPVk9S45hRAl2zL0M6RRo5BAwY+JeoIRS1X/TutBmTGLAEY0Z y/lKTrx/847VCSnXydWz9cbLFAGOPJlHFpgQkdVRY+NhE01JiQ+98x/zl3qLPE1Wa6bv MKXTIKZPo+EvJ9WRp8uELWdDptyp3Q+KlCqJwOEgI7TloL+VAsrQ05GWVAbCaEqEF2Tj c9en13DiYB/GPfm+DoWbu4wt5MRpG7DraQTNIExM0bj0g6dyxh1bWgZ6pBkaw/Bq3axH jsu1x2HJjy3UYGOkz7lllnL7lQRCESo4C+t7MlRWHEs+hl/FNj3qGbjdNUEKk7H8A8V4 ZO9w== X-Gm-Message-State: AOAM5327gioxDxC3wjxjp0tT3hBTFjSX5P4MV6ws0FL78xESY8X5Unbg hiW1cYG2NEbD2CPJD4oNwUWbrtqpVKq+D8SM8QM= X-Google-Smtp-Source: ABdhPJyGdPysh4JKvoSDONuj1Ue7wOLo62LEhwvjaBQ4WLmEDtNbWJ0lmUlU7vm1HojwsowSWTK8yJUtc2vFc3XGcvo= X-Received: by 2002:a92:6a0c:: with SMTP id f12mr13581043ilc.213.1598471055050; Wed, 26 Aug 2020 12:44:15 -0700 (PDT) MIME-Version: 1.0 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> <0e9996bc-4c1b-cc99-9616-c721b546f857@intel.com> In-Reply-To: <0e9996bc-4c1b-cc99-9616-c721b546f857@intel.com> From: "H.J. Lu" Date: Wed, 26 Aug 2020 12:43:39 -0700 Message-ID: Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: "Yu, Yu-cheng" Cc: Andy Lutomirski , Florian Weimer , 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 , 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 15BA0180C07AB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Wed, Aug 26, 2020 at 11:49 AM Yu, Yu-cheng wrote: > > 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? > arch/arm64/include/uapi/asm/mman.h: #define PROT_BTI 0x10 /* BTI guarded page */ -- H.J.