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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 BAA0CC4167B for ; Mon, 7 Dec 2020 14:46:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7094523372 for ; Mon, 7 Dec 2020 14:46:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7094523372 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=81d4oJt/A2Sa+79z3S3/hqxzi8P9OLw5gHFaaGIUtKI=; b=JisaiJEMy+PZ9tAxXvwcdWtsp 1L6WWAgq+J3EHN0uj5ezuZC428c9d3UrwxFG1L4mFA/oiz75P8p7RFpsWA/xmX80IkAR3L4PpE7W9 NErhQc3CbD2SXMYn/kiMHyxAbBmYyZNjawoDrZDZom4S+9c6fRiIIonTOc/JK6JqEfBtdTqkiBFEc dmFYZXKqA/ujuLCHgvrDRfSnC54PFIX5Kff2TslJD4/AFxlVOdwbLrmMRaWRat7A3kRIYu/Ay/bm0 baK/tdOdIQW7VUYRuI6W0HQAJ+OwOZHCmNuIt6rr0BLQO4aNkszfd8Lm6RZS0Je8EO/ikPzYXPn+k L3TDo5U+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmHmW-00040g-FT; Mon, 07 Dec 2020 14:46:28 +0000 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmHmS-0003y6-Jo for linux-riscv@lists.infradead.org; Mon, 07 Dec 2020 14:46:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607352378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jWg1t6sTeUgW79K7ShAQcqT7Q1eiw+skkSRDGT0t/ys=; b=IgZXFcH6KI5zb99XSOn93x6wat38sLvXBZhmYfZQpOhoJ/vSDsCydfcc81qQQWH/lzudV5 +peJyv3/Iuf2+aLhNQf+Prxlrjodoh7GfQGiatOX8ov5xi6KR2V0kvMCavUhVhTKSzWBNP jqIquTSbUDLFBn/KH4kNTiQ8CjiqWsc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-370-0dVUfL9vOh2HHBPLYoOQ1w-1; Mon, 07 Dec 2020 09:46:13 -0500 X-MC-Unique: 0dVUfL9vOh2HHBPLYoOQ1w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77E8F1005504; Mon, 7 Dec 2020 14:46:08 +0000 (UTC) Received: from ovpn-66-220.rdu2.redhat.com (ovpn-66-220.rdu2.redhat.com [10.10.66.220]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FE5F60BE2; Mon, 7 Dec 2020 14:45:59 +0000 (UTC) Message-ID: <81631d3391abca3f41f2e19092b97a61d49f4e44.camel@redhat.com> Subject: Re: [PATCH v14 09/10] arch, mm: wire up memfd_secret system call were relevant From: Qian Cai To: Mike Rapoport , Andrew Morton Date: Mon, 07 Dec 2020 09:45:59 -0500 In-Reply-To: <20201203062949.5484-10-rppt@kernel.org> References: <20201203062949.5484-1-rppt@kernel.org> <20201203062949.5484-10-rppt@kernel.org> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_094624_713393_08A3B6B8 X-CRM114-Status: GOOD ( 24.87 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , David Hildenbrand , Peter Zijlstra , Catalin Marinas , Dave Hansen , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, "H. Peter Anvin" , Christopher Lameter , Shuah Khan , Thomas Gleixner , Elena Reshetova , linux-arch@vger.kernel.org, Tycho Andersen , linux-nvdimm@lists.01.org, Will Deacon , x86@kernel.org, Matthew Wilcox , Mike Rapoport , Ingo Molnar , Michael Kerrisk , Palmer Dabbelt , Arnd Bergmann , James Bottomley , Borislav Petkov , Alexander Viro , Andy Lutomirski , Paul Walmsley , "Kirill A. Shutemov" , Dan Williams , linux-arm-kernel@lists.infradead.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , linux-fsdevel@vger.kernel.org, Shakeel Butt , Rick Edgecombe , Roman Gushchin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, 2020-12-03 at 08:29 +0200, Mike Rapoport wrote: > From: Mike Rapoport > > Wire up memfd_secret system call on architectures that define > ARCH_HAS_SET_DIRECT_MAP, namely arm64, risc-v and x86. > > Signed-off-by: Mike Rapoport > Acked-by: Palmer Dabbelt > Acked-by: Arnd Bergmann > --- > arch/arm64/include/uapi/asm/unistd.h | 1 + > arch/riscv/include/asm/unistd.h | 1 + > arch/x86/entry/syscalls/syscall_32.tbl | 1 + > arch/x86/entry/syscalls/syscall_64.tbl | 1 + > include/linux/syscalls.h | 1 + > include/uapi/asm-generic/unistd.h | 6 +++++- > mm/secretmem.c | 3 +++ > scripts/checksyscalls.sh | 4 ++++ > 8 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h > index f83a70e07df8..ce2ee8f1e361 100644 > --- a/arch/arm64/include/uapi/asm/unistd.h > +++ b/arch/arm64/include/uapi/asm/unistd.h > @@ -20,5 +20,6 @@ > #define __ARCH_WANT_SET_GET_RLIMIT > #define __ARCH_WANT_TIME32_SYSCALLS > #define __ARCH_WANT_SYS_CLONE3 > +#define __ARCH_WANT_MEMFD_SECRET > > #include > diff --git a/arch/riscv/include/asm/unistd.h b/arch/riscv/include/asm/unistd.h > index 977ee6181dab..6c316093a1e5 100644 > --- a/arch/riscv/include/asm/unistd.h > +++ b/arch/riscv/include/asm/unistd.h > @@ -9,6 +9,7 @@ > */ > > #define __ARCH_WANT_SYS_CLONE > +#define __ARCH_WANT_MEMFD_SECRET > > #include > > diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl > index c52ab1c4a755..109e6681b8fa 100644 > --- a/arch/x86/entry/syscalls/syscall_32.tbl > +++ b/arch/x86/entry/syscalls/syscall_32.tbl > @@ -446,3 +446,4 @@ > 439 i386 faccessat2 sys_faccessat2 > 440 i386 process_madvise sys_process_madvise > 441 i386 watch_mount sys_watch_mount > +442 i386 memfd_secret sys_memfd_secret > diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl > index f3270a9ef467..742cf17d7725 100644 > --- a/arch/x86/entry/syscalls/syscall_64.tbl > +++ b/arch/x86/entry/syscalls/syscall_64.tbl > @@ -363,6 +363,7 @@ > 439 common faccessat2 sys_faccessat2 > 440 common process_madvise sys_process_madvise > 441 common watch_mount sys_watch_mount > +442 common memfd_secret sys_memfd_secret > > # > # Due to a historical design error, certain syscalls are numbered differently > diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h > index 6d55324363ab..f9d93fbf9b69 100644 > --- a/include/linux/syscalls.h > +++ b/include/linux/syscalls.h > @@ -1010,6 +1010,7 @@ asmlinkage long sys_pidfd_send_signal(int pidfd, int sig, > asmlinkage long sys_pidfd_getfd(int pidfd, int fd, unsigned int flags); > asmlinkage long sys_watch_mount(int dfd, const char __user *path, > unsigned int at_flags, int watch_fd, int watch_id); > +asmlinkage long sys_memfd_secret(unsigned long flags); > > /* > * Architecture-specific system calls > diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h > index 5df46517260e..51151888f330 100644 > --- a/include/uapi/asm-generic/unistd.h > +++ b/include/uapi/asm-generic/unistd.h > @@ -861,9 +861,13 @@ __SYSCALL(__NR_faccessat2, sys_faccessat2) > __SYSCALL(__NR_process_madvise, sys_process_madvise) > #define __NR_watch_mount 441 > __SYSCALL(__NR_watch_mount, sys_watch_mount) > +#ifdef __ARCH_WANT_MEMFD_SECRET > +#define __NR_memfd_secret 442 > +__SYSCALL(__NR_memfd_secret, sys_memfd_secret) > +#endif I can't see where was it defined for arm64 after it looks like Andrew has deleted the above chunk. Thus, we have a warning using this .config: https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config :1539:2: warning: #warning syscall memfd_secret not implemented [-Wcpp] > > #undef __NR_syscalls > -#define __NR_syscalls 442 > +#define __NR_syscalls 443 > > /* > * 32 bit systems traditionally used different > diff --git a/mm/secretmem.c b/mm/secretmem.c > index 7236f4d9458a..b8a32954ac68 100644 > --- a/mm/secretmem.c > +++ b/mm/secretmem.c > @@ -415,6 +415,9 @@ static int __init secretmem_setup(char *str) > unsigned long reserved_size; > int err; > > + if (!can_set_direct_map()) > + return 0; > + > reserved_size = memparse(str, NULL); > if (!reserved_size) > return 0; > diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh > index a18b47695f55..b7609958ee36 100755 > --- a/scripts/checksyscalls.sh > +++ b/scripts/checksyscalls.sh > @@ -40,6 +40,10 @@ cat << EOF > #define __IGNORE_setrlimit /* setrlimit */ > #endif > > +#ifndef __ARCH_WANT_MEMFD_SECRET > +#define __IGNORE_memfd_secret > +#endif > + > /* Missing flags argument */ > #define __IGNORE_renameat /* renameat2 */ > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv