From: Yu Watanabe Date: Fri, 28 Feb 2025 12:49:03 +0000 (+0900) Subject: missing_syscall: memfd_create() is supported by glibc since 2.27 X-Git-Tag: v258-rc1~1195^2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ca5be8d3f3d0ff69f04b2d76a0efa7ad7dfd694;p=thirdparty%2Fsystemd.git missing_syscall: memfd_create() is supported by glibc since 2.27 Now, our baseline of glibc is 2.31, hence it is OK to drop it. --- diff --git a/meson.build b/meson.build index f4fd28410fb..a92d9f2cb08 100644 --- a/meson.build +++ b/meson.build @@ -603,7 +603,6 @@ foreach ident : ['secure_getenv', '__secure_getenv'] endforeach foreach ident : [ - ['memfd_create', '''#include '''], ['gettid', '''#include #include '''], ['fchmodat2', '''#include diff --git a/src/basic/missing_mman.h b/src/basic/missing_mman.h index d6a8b4bb9e6..29196b1c715 100644 --- a/src/basic/missing_mman.h +++ b/src/basic/missing_mman.h @@ -5,24 +5,14 @@ #include "macro.h" -#ifndef MFD_ALLOW_SEALING -# define MFD_ALLOW_SEALING 0x0002U -#else -assert_cc(MFD_ALLOW_SEALING == 0x0002U); -#endif - -#ifndef MFD_CLOEXEC -# define MFD_CLOEXEC 0x0001U -#else -assert_cc(MFD_CLOEXEC == 0x0001U); -#endif - +/* since glibc-2.38 */ #ifndef MFD_NOEXEC_SEAL # define MFD_NOEXEC_SEAL 0x0008U #else assert_cc(MFD_NOEXEC_SEAL == 0x0008U); #endif +/* since glibc-2.38 */ #ifndef MFD_EXEC # define MFD_EXEC 0x0010U #else diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index 3eab1a27efa..531e2fafb4b 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -68,16 +68,6 @@ static inline int missing_ioprio_set(int which, int who, int ioprio) { /* ======================================================================= */ -#if !HAVE_MEMFD_CREATE -static inline int missing_memfd_create(const char *name, unsigned int flags) { - return syscall(__NR_memfd_create, name, flags); -} - -# define memfd_create missing_memfd_create -#endif - -/* ======================================================================= */ - #if !HAVE_GETRANDOM /* glibc says getrandom() returns ssize_t */ static inline ssize_t missing_getrandom(void *buffer, size_t count, unsigned flags) { diff --git a/src/basic/missing_syscall_def.h b/src/basic/missing_syscall_def.h index e042b6be880..0b4a6190e14 100644 --- a/src/basic/missing_syscall_def.h +++ b/src/basic/missing_syscall_def.h @@ -382,74 +382,6 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom); # endif #endif -#ifndef __IGNORE_memfd_create -# if defined(__aarch64__) -# define systemd_NR_memfd_create 279 -# elif defined(__alpha__) -# define systemd_NR_memfd_create 512 -# elif defined(__arc__) || defined(__tilegx__) -# define systemd_NR_memfd_create 279 -# elif defined(__arm__) -# define systemd_NR_memfd_create 385 -# elif defined(__i386__) -# define systemd_NR_memfd_create 356 -# elif defined(__ia64__) -# define systemd_NR_memfd_create 1340 -# elif defined(__loongarch_lp64) -# define systemd_NR_memfd_create 279 -# elif defined(__m68k__) -# define systemd_NR_memfd_create 353 -# elif defined(_MIPS_SIM) -# if _MIPS_SIM == _MIPS_SIM_ABI32 -# define systemd_NR_memfd_create 4354 -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define systemd_NR_memfd_create 6318 -# elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define systemd_NR_memfd_create 5314 -# else -# error "Unknown MIPS ABI" -# endif -# elif defined(__hppa__) -# define systemd_NR_memfd_create 340 -# elif defined(__powerpc__) -# define systemd_NR_memfd_create 360 -# elif defined(__riscv) -# if __riscv_xlen == 32 -# define systemd_NR_memfd_create 279 -# elif __riscv_xlen == 64 -# define systemd_NR_memfd_create 279 -# else -# error "Unknown RISC-V ABI" -# endif -# elif defined(__s390__) -# define systemd_NR_memfd_create 350 -# elif defined(__sparc__) -# define systemd_NR_memfd_create 348 -# elif defined(__x86_64__) -# if defined(__ILP32__) -# define systemd_NR_memfd_create (319 | /* __X32_SYSCALL_BIT */ 0x40000000) -# else -# define systemd_NR_memfd_create 319 -# endif -# elif !defined(missing_arch_template) -# warning "memfd_create() syscall number is unknown for your architecture" -# endif - -/* may be an (invalid) negative number due to libseccomp, see PR 13319 */ -# if defined __NR_memfd_create && __NR_memfd_create >= 0 -# if defined systemd_NR_memfd_create -assert_cc(__NR_memfd_create == systemd_NR_memfd_create); -# endif -# else -# if defined __NR_memfd_create -# undef __NR_memfd_create -# endif -# if defined systemd_NR_memfd_create && systemd_NR_memfd_create >= 0 -# define __NR_memfd_create systemd_NR_memfd_create -# endif -# endif -#endif - #ifndef __IGNORE_mount_setattr # if defined(__aarch64__) # define systemd_NR_mount_setattr 442 diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py index e84e0afc202..e7c16f64062 100644 --- a/src/basic/missing_syscalls.py +++ b/src/basic/missing_syscalls.py @@ -11,7 +11,6 @@ SYSCALLS = [ 'copy_file_range', 'fchmodat2', 'getrandom', - 'memfd_create', 'mount_setattr', 'move_mount', 'name_to_handle_at',