Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3838471pxb; Mon, 8 Feb 2021 01:08:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR/Pcn/W4O3/MDd7zUZarxGQBewH16O9vRo6ACO8HulLAn1QgCpkraesrCiRUjo7S8TSaJ X-Received: by 2002:a17:906:8555:: with SMTP id h21mr15718835ejy.403.1612775305518; Mon, 08 Feb 2021 01:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612775305; cv=none; d=google.com; s=arc-20160816; b=CsdU1nmwz0lLdNpIEM4pWHoFNH4mUO9DyX3TSX1FU6wO2InY9SpwRrrCN5kZoIcQav pGWIv37Vowz4ERFi64R93XyJKjH3GDyCF1sTq/IPxHGb3e1FcO1tjowN5Eewxjg+ebIK CovuUftVZKrsxA5G8mefk6HoyvQzhDoSCCsODt09adFReC/dCqBvl31TSjuStS91K14d KqP3b2kbwu/IVskumxWzgiDGaIfS7wixPUbLi9CZOWd508YibZ1lXhOjSiw6nhESbQyo 0JkSPZhRbxTh0OLjlwdcGp0KWVizBwbxuD5A7qYAXCpzb/zrDzEb7wjosH9lND4/+I+r yAHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oSSgClp6L21uLsAcnCqCUlVcxSWq/rJ2lKlpgvDSlqg=; b=hOInzh8gj2jQyxShM24yS72SjpEHcDU93Rgr97/P/rE3dBcGZxhc9hW5GU60Xq4epq vX5vAvv9iAh0nG6kAlIbLMgdQaoSnEg9djZZ1RbvZSyL335/k/HbWaOmdMugt4N2/b0c 3OBtQDlhVtij17tkW6uGR9uWL24QCGt9KhMo00v3JsVkmKpyli2PmDIed7EOlnLzYmtc 9j/qqd30mCz+uhfOdpKyuNXeYGy/uwFy5TJ5IkodXCmKfVDDHtFP3QrIsWFQ+1oHt1Ye mQATtBvlZddBhDblE/Yn759NSAvw3t9lzDiBCGsgmYO5y70X36tfr3haIHLd5Xa2rGbU 85qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ozStLFiY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si10785264ejc.517.2021.02.08.01.08.00; Mon, 08 Feb 2021 01:08:25 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ozStLFiY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231436AbhBHJE1 (ORCPT + 99 others); Mon, 8 Feb 2021 04:04:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:43412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbhBHIwr (ORCPT ); Mon, 8 Feb 2021 03:52:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 92AE864EA7; Mon, 8 Feb 2021 08:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612774283; bh=8GoM0ZYqUn/qb8LoFe3IehC6umF0GBgToY93utoh7DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ozStLFiYAFPTLnpaj77FiVCdgrASvuRwWETBZvA0HvNpZtEobymtPdW9qLAlRAcmD hQGLaslwSiimz3T/NYpu7ZwtwhyRN0aydqlAt3B+Iw6MdL/Q6BpS4cVYssLw4WBiK6 MMQnvsrdsa77MbbVDMWbMyKA7V6lZ/yJQPjNFrXkEGcLTtoRtHYxyDx0ZG12EoNqYY DLTTRvTdC9QwsvGhhNofifcshmB7w06g8Gsyq2iI4dhnDt8DTm4DY0elNf5IJU1qsV PDaVicmwf3kPBcGim0jlcqb+4xYnpliQUxHC8WlrBP+XI5lpZfwPJNnpjDWMb2l6uT Md88wAHEvPwGw== From: Mike Rapoport To: Andrew Morton Cc: Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , David Hildenbrand , Elena Reshetova , "H. Peter Anvin" , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Michal Hocko , Mike Rapoport , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Rick Edgecombe , Roman Gushchin , Shakeel Butt , Shuah Khan , Thomas Gleixner , Tycho Andersen , Will Deacon , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-riscv@lists.infradead.org, x86@kernel.org, Palmer Dabbelt , Hagen Paul Pfeifer Subject: [PATCH v17 09/10] arch, mm: wire up memfd_secret system call where relevant Date: Mon, 8 Feb 2021 10:49:19 +0200 Message-Id: <20210208084920.2884-10-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210208084920.2884-1-rppt@kernel.org> References: <20210208084920.2884-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Catalin Marinas Cc: Alexander Viro Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Christopher Lameter Cc: Dan Williams Cc: Dave Hansen Cc: David Hildenbrand Cc: Elena Reshetova Cc: Hagen Paul Pfeifer Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: James Bottomley Cc: "Kirill A. Shutemov" Cc: Mark Rutland Cc: Matthew Wilcox Cc: Michael Kerrisk Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Peter Zijlstra Cc: Rick Edgecombe Cc: Roman Gushchin Cc: Shakeel Butt Cc: Shuah Khan Cc: Thomas Gleixner Cc: Tycho Andersen Cc: Will Deacon --- 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 +++++- scripts/checksyscalls.sh | 4 ++++ 7 files changed, 14 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 a1c9f496fca6..34f04076a140 100644 --- a/arch/x86/entry/syscalls/syscall_32.tbl +++ b/arch/x86/entry/syscalls/syscall_32.tbl @@ -447,3 +447,4 @@ 440 i386 process_madvise sys_process_madvise 441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2 442 i386 mount_setattr sys_mount_setattr +443 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 7bf01cbe582f..bd3783edf27f 100644 --- a/arch/x86/entry/syscalls/syscall_64.tbl +++ b/arch/x86/entry/syscalls/syscall_64.tbl @@ -364,6 +364,7 @@ 440 common process_madvise sys_process_madvise 441 common epoll_pwait2 sys_epoll_pwait2 442 common mount_setattr sys_mount_setattr +443 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 cd7b5c817ba2..ad7ac9717884 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -1041,6 +1041,7 @@ asmlinkage long sys_pidfd_send_signal(int pidfd, int sig, siginfo_t __user *info, unsigned int flags); asmlinkage long sys_pidfd_getfd(int pidfd, int fd, unsigned int flags); +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 ce58cff99b66..7ac0732dbaa4 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -863,9 +863,13 @@ __SYSCALL(__NR_process_madvise, sys_process_madvise) __SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2) #define __NR_mount_setattr 442 __SYSCALL(__NR_mount_setattr, sys_mount_setattr) +#ifdef __ARCH_WANT_MEMFD_SECRET +#define __NR_memfd_secret 443 +__SYSCALL(__NR_memfd_secret, sys_memfd_secret) +#endif #undef __NR_syscalls -#define __NR_syscalls 443 +#define __NR_syscalls 444 /* * 32 bit systems traditionally used different 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 */ -- 2.28.0