diff mbox series

posix: Add posix_spawn extension to setup resource limits (BZ 31049)

Message ID 20250605180231.1427626-1-adhemerval.zanella@linaro.org
State New
Headers show
Series posix: Add posix_spawn extension to setup resource limits (BZ 31049) | expand

Commit Message

Adhemerval Zanella Netto June 5, 2025, 6:02 p.m. UTC
This patch adds two new functions:

  int posix_spawnattr_setrlimit_np (posix_spawnattr_t *restrict __attr,
 				    int resource,
                                    const struct rlimit *rlim);

  int posix_spawnattr_getrlimit_np (posix_spawnattr_t *__restrict __attr,
                                    int resource,
                                    struct rlimit *rlim)

Along with a new POSIX_SPAWN_SETRLIMIT flag.  It allows to setup the
new process resource limits, similar to call setlimit/prlimit before
execve.  It work for both posix_spawn and pidfd_spawn.

To create a process with a resource limit, one can use the:

  posix_spawnattr_t attr;
  posix_spawnattr_init (&attr);
  posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETRLIMIT);
  posix_spawnattr_setrlimit_np (&attr, RLIMIT_STACK,
				& (const struct rlimit) { RLIM_INFINITY,
							  RLIM_INFINITY });
  posix_spawn (...);

The resources limits are applied after the effective user and group IDs
change (POSIX_SPAWN_RESETIDS) and before the file actions.  Only LFS
supported is provided (non-LFS prototypes are not exported or
implemented).

Checked on x86_64-linux-gnu and aarch64-linux-gnu.
---
 NEWS                                          |   6 +
 bits/resource.h                               |   7 +-
 include/sys/resource.h                        |   3 +
 posix/Makefile                                |   6 +
 posix/Versions                                |   4 +
 posix/spawn.h                                 |  16 ++
 posix/spawn_int.h                             |   3 +
 posix/spawnattr_destroy.c                     |   6 +-
 posix/spawnattr_getrlimit_np.c                |  46 ++++
 posix/spawnattr_setflags.c                    |   3 +-
 posix/spawnattr_setrlimit_np.c                |  54 +++++
 posix/tst-spawn8.c                            | 226 ++++++++++++++++++
 resource/setrlimit64.c                        |   4 +-
 sysdeps/mach/hurd/bits/typesizes.h            |   5 +
 sysdeps/mach/hurd/i386/libc.abilist           |   2 +
 sysdeps/mach/hurd/spawni.c                    |  14 ++
 sysdeps/mach/hurd/x86_64/libc.abilist         |   4 +-
 sysdeps/unix/sysv/linux/Makefile              |   4 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   2 +
 sysdeps/unix/sysv/linux/alpha/bits/resource.h |   7 +-
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   2 +
 sysdeps/unix/sysv/linux/alpha/setrlimit64.c   |   2 +-
 sysdeps/unix/sysv/linux/arc/libc.abilist      |   2 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   2 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   2 +
 sysdeps/unix/sysv/linux/bits/resource.h       |   7 +-
 sysdeps/unix/sysv/linux/csky/libc.abilist     |   2 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   2 +
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   2 +
 .../sysv/linux/loongarch/lp64/libc.abilist    |   2 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |   2 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   2 +
 .../sysv/linux/microblaze/be/libc.abilist     |   2 +
 .../sysv/linux/microblaze/le/libc.abilist     |   2 +
 sysdeps/unix/sysv/linux/mips/bits/resource.h  |   7 +-
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   2 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   2 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   2 +
 sysdeps/unix/sysv/linux/or1k/libc.abilist     |   2 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   2 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |   2 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |   2 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |   2 +
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |   2 +
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |   2 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   2 +
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   2 +
 sysdeps/unix/sysv/linux/setrlimit64.c         |   7 +-
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   2 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   2 +
 sysdeps/unix/sysv/linux/sparc/bits/resource.h |   7 +-
 .../sysv/linux/sparc/sparc32/libc.abilist     |   2 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |   2 +
 sysdeps/unix/sysv/linux/spawni.c              |  14 ++
 sysdeps/unix/sysv/linux/tst-spawn8-pidfd.c    |  20 ++
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   2 +
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   2 +
 57 files changed, 531 insertions(+), 15 deletions(-)
 create mode 100644 posix/spawnattr_getrlimit_np.c
 create mode 100644 posix/spawnattr_setrlimit_np.c
 create mode 100644 posix/tst-spawn8.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-spawn8-pidfd.c

Comments

Florian Weimer June 6, 2025, 6:44 a.m. UTC | #1
* Adhemerval Zanella:

> This patch adds two new functions:
>
>   int posix_spawnattr_setrlimit_np (posix_spawnattr_t *restrict __attr,
>  				    int resource,
>                                     const struct rlimit *rlim);
>
>   int posix_spawnattr_getrlimit_np (posix_spawnattr_t *__restrict __attr,
>                                     int resource,
>                                     struct rlimit *rlim)
>
> Along with a new POSIX_SPAWN_SETRLIMIT flag.  It allows to setup the
> new process resource limits, similar to call setlimit/prlimit before
> execve.  It work for both posix_spawn and pidfd_spawn.

Why is the separate flag is needed?

> The resources limits are applied after the effective user and group IDs
> change (POSIX_SPAWN_RESETIDS) and before the file actions.  Only LFS
> supported is provided (non-LFS prototypes are not exported or
> implemented).

It would be more general to treat this as a file action, so that the
limits can be applied after opening files.

Thanks,
Florian
Adhemerval Zanella Netto June 6, 2025, 1:01 p.m. UTC | #2
On 06/06/25 03:44, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> This patch adds two new functions:
>>
>>   int posix_spawnattr_setrlimit_np (posix_spawnattr_t *restrict __attr,
>>  				    int resource,
>>                                     const struct rlimit *rlim);
>>
>>   int posix_spawnattr_getrlimit_np (posix_spawnattr_t *__restrict __attr,
>>                                     int resource,
>>                                     struct rlimit *rlim)
>>
>> Along with a new POSIX_SPAWN_SETRLIMIT flag.  It allows to setup the
>> new process resource limits, similar to call setlimit/prlimit before
>> execve.  It work for both posix_spawn and pidfd_spawn.
> 
> Why is the separate flag is needed?

Mainly because it was already added by a libc implementation [1] and it
allows to use the same attribute to spawn different process with and
without limits.

> 
>> The resources limits are applied after the effective user and group IDs
>> change (POSIX_SPAWN_RESETIDS) and before the file actions.  Only LFS
>> supported is provided (non-LFS prototypes are not exported or
>> implemented).
> 
> It would be more general to treat this as a file action, so that the
> limits can be applied after opening files.
> 

I think it would really matter if the RLIMIT_NOFILE is less than the
number of file descriptors set by the file actions.  And in this case,
setting the limit *after* won't trigger a potential failure for bogus
values, and I am not sure which is better (allow all file operation
or enforce RLIMIT_NOFILE is set, I am more inclined for the latter).

Also, resources are *not* file operation so I really think we should
not tie them together. And make them a file operation would make it
even harder to get consensus on a future standardization. 

> Thanks,
> Florian
> 


[1] https://justine.lol/cosmopolitan/documentation.html#posix_spawnattr_setrlimit_np
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index afe8076dfc..e6de652859 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,12 @@  Major new features:
 * The ISO C2Y family of unsigned abs functions, i.e.
   uabs, ulabs, ullabs and uimaxabs, are now supported.
 
+* The functions posix_spawnattr_getrlimit_np and
+  posix_spawnattr_setrlimit_np have been added, along with the
+  POSIX_SPAWN_SETRLIMIT flag.  They allow posix_spawn, posix_spawnp,
+  pidfd_spawn, and pidfd_spawnp to set a process resource limit in the new
+  process, similiar to setrlimit or prlimit.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The glibc.rtld.execstack now supports a compatibility mode to allow
diff --git a/bits/resource.h b/bits/resource.h
index a42a338b44..f4ff02ebcc 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -16,7 +16,10 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_RESOURCE_H
+#ifndef _BITS_RESOURCE_H
+#define _BITS_RESOURCE_H
+
+#if !defined _SYS_RESOURCE_H && !defined _SPAWN_H
 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
 #endif
 
@@ -151,3 +154,5 @@  enum __priority_which
     PRIO_USER = 2               /* WHO is a user ID.  */
 #define PRIO_USER PRIO_USER
   };
+
+#endif
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 21d3908714..b1f019a4d1 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -135,6 +135,9 @@  extern int __setrlimit (enum __rlimit_resource __resource,
 			const struct rlimit *__rlimits) __nonnull ((2));
 libc_hidden_proto (__setrlimit);
 
+extern __typeof (setrlimit64) __setrlimit64;
+libc_hidden_proto (__setrlimit64);
+
 #if __TIMESIZE == 64
 # define __getrusage64 __getrusage
 # define __wait4_time64 __wait4
diff --git a/posix/Makefile b/posix/Makefile
index 240de15123..395d817112 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -161,6 +161,7 @@  routines := \
   spawnattr_getdefault \
   spawnattr_getflags \
   spawnattr_getpgroup \
+  spawnattr_getrlimit_np \
   spawnattr_getschedparam \
   spawnattr_getschedpolicy \
   spawnattr_getsigmask \
@@ -168,6 +169,7 @@  routines := \
   spawnattr_setdefault \
   spawnattr_setflags \
   spawnattr_setpgroup \
+  spawnattr_setrlimit_np \
   spawnattr_setschedparam \
   spawnattr_setschedpolicy \
   spawnattr_setsigmask \
@@ -317,6 +319,7 @@  tests := \
   tst-spawn5 \
   tst-spawn6 \
   tst-spawn7 \
+  tst-spawn8 \
   tst-sysconf \
   tst-sysconf-empty-chroot \
   tst-truncate \
@@ -601,6 +604,8 @@  CFLAGS-fork.c = $(libio-mtsafe) $(config-cflags-wno-ignored-attributes)
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
 		--none random --col --color --colour
 
+CFLAGS-tst-spawn8.c += -D_FILE_OFFSET_BITS=64
+
 tst-exec-ARGS = -- $(host-test-program-cmd)
 tst-exec-static-ARGS = $(tst-exec-ARGS)
 tst-execvpe5-ARGS = -- $(host-test-program-cmd)
@@ -609,6 +614,7 @@  tst-spawn-static-ARGS = $(tst-spawn-ARGS)
 tst-spawn5-ARGS = -- $(host-test-program-cmd)
 tst-spawn6-ARGS = -- $(host-test-program-cmd)
 tst-spawn7-ARGS = -- $(host-test-program-cmd)
+tst-spawn8-ARGS = -- $(host-test-program-cmd)
 tst-posix_spawn-setsid-ARGS = -- $(host-test-program-cmd)
 tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
 tst-chmod-ARGS = $(objdir)
diff --git a/posix/Versions b/posix/Versions
index 0624d24bcc..c741ce425c 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -159,6 +159,10 @@  libc {
   GLIBC_2.35 {
     posix_spawn_file_actions_addtcsetpgrp_np;
   }
+  GLIBC_2.42 {
+    posix_spawnattr_setrlimit_np;
+    posix_spawnattr_getrlimit_np;
+  }
   GLIBC_PRIVATE {
     __libc_fork; __libc_pread; __libc_pwrite;
     __nanosleep_nocancel; __pause_nocancel;
diff --git a/posix/spawn.h b/posix/spawn.h
index a2ff3fa4a2..bed7c0102f 100644
--- a/posix/spawn.h
+++ b/posix/spawn.h
@@ -59,6 +59,7 @@  typedef struct
 # define POSIX_SPAWN_USEVFORK		0x40
 # define POSIX_SPAWN_SETSID		0x80
 # define POSIX_SPAWN_SETCGROUP         0x100
+# define POSIX_SPAWN_SETRLIMIT         0x200
 #endif
 
 
@@ -199,6 +200,21 @@  extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
      __THROW __nonnull ((1));
 
 #ifdef __USE_MISC
+
+#include <bits/resource.h>
+
+#if __RLIM_T_MATCHES_RLIM64_T || defined __USE_FILE_OFFSET64
+extern int posix_spawnattr_setrlimit_np (posix_spawnattr_t *__restrict __attr,
+					 int __resource,
+					 const struct rlimit *__rlim)
+     __THROW __nonnull ((1, 3));
+
+extern int posix_spawnattr_getrlimit_np (posix_spawnattr_t *__restrict __attr,
+					 int __resource,
+					 struct rlimit *__rlim)
+     __THROW __nonnull ((1, 3));
+#endif
+
 /* Add an action changing the directory to PATH during spawn.  This
    affects the subsequent file actions.  */
 extern int posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *
diff --git a/posix/spawn_int.h b/posix/spawn_int.h
index 2af524fad6..6b25cebff9 100644
--- a/posix/spawn_int.h
+++ b/posix/spawn_int.h
@@ -22,6 +22,7 @@ 
 #include <spawn.h>
 #include <spawn_int_def.h>
 #include <stdbool.h>
+#include <sys/resource.h>
 
 struct __spawn_attr
 {
@@ -36,6 +37,8 @@  struct __spawn_attr
       struct sched_param __sp;
       int __policy;
       int __cgroup;
+      uint32_t __rlimitset;
+      struct rlimit64 *__rlimits;
     };
     char __size[__SIZEOF_POSIX_SPAWNATTR_T];
   };
diff --git a/posix/spawnattr_destroy.c b/posix/spawnattr_destroy.c
index bae3fc38cb..e1ec29e635 100644
--- a/posix/spawnattr_destroy.c
+++ b/posix/spawnattr_destroy.c
@@ -16,12 +16,16 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <spawn.h>
+#include <spawn_int.h>
+#include <stdlib.h>
 
 /* Initialize data structure for file attribute for `spawn' call.  */
 int
 __posix_spawnattr_destroy (posix_spawnattr_t *attr)
 {
-  /* Nothing to do in the moment.  */
+  struct __spawn_attr *at = (struct __spawn_attr *) attr;
+  free (at->__rlimits);
+
   return 0;
 }
 weak_alias (__posix_spawnattr_destroy, posix_spawnattr_destroy)
diff --git a/posix/spawnattr_getrlimit_np.c b/posix/spawnattr_getrlimit_np.c
new file mode 100644
index 0000000000..349dc1eee6
--- /dev/null
+++ b/posix/spawnattr_getrlimit_np.c
@@ -0,0 +1,46 @@ 
+/* Implement posix_spawn extension to setup resource limits.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <spawn.h>
+#include <spawn_int.h>
+#include <stdlib.h>
+
+int
+__posix_spawnattr_getrlimit_np (posix_spawnattr_t *__restrict attr,
+				int resource,
+#if __RLIM_T_MATCHES_RLIM64_T
+				struct rlimit *rlim
+#else
+				struct rlimit64 *rlim
+#endif
+				)
+{
+  if (resource < 0 || resource >= RLIM_NLIMITS)
+    return EINVAL;
+
+  struct __spawn_attr *at = (struct __spawn_attr *) attr;
+  if (!(at->__rlimitset & (1u << resource)))
+    return ENOENT;
+
+  rlim->rlim_cur = at->__rlimits[resource].rlim_cur;
+  rlim->rlim_max = at->__rlimits[resource].rlim_max;
+
+  return 0;
+}
+weak_alias (__posix_spawnattr_getrlimit_np, posix_spawnattr_getrlimit_np)
diff --git a/posix/spawnattr_setflags.c b/posix/spawnattr_setflags.c
index bbe5838b9f..186c1ca17d 100644
--- a/posix/spawnattr_setflags.c
+++ b/posix/spawnattr_setflags.c
@@ -28,7 +28,8 @@ 
 		   | POSIX_SPAWN_SETSCHEDULER				      \
 		   | POSIX_SPAWN_SETSID					      \
 		   | POSIX_SPAWN_USEVFORK				      \
-		   | POSIX_SPAWN_SETCGROUP)
+		   | POSIX_SPAWN_SETCGROUP				      \
+		   | POSIX_SPAWN_SETRLIMIT)
 
 /* Store flags in the attribute structure.  */
 int
diff --git a/posix/spawnattr_setrlimit_np.c b/posix/spawnattr_setrlimit_np.c
new file mode 100644
index 0000000000..b6a748835b
--- /dev/null
+++ b/posix/spawnattr_setrlimit_np.c
@@ -0,0 +1,54 @@ 
+/* Implement posix_spawn extension to setup resource limits.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <spawn.h>
+#include <spawn_int.h>
+#include <stdlib.h>
+
+/* Initialize data structure for file attribute for `spawn' call.  */
+int
+__posix_spawnattr_setrlimit_np (posix_spawnattr_t *__restrict attr,
+				int resource,
+#if __RLIM_T_MATCHES_RLIM64_T
+				const struct rlimit *rlim
+#else
+				const struct rlimit64 *rlim
+#endif
+				)
+{
+  if (resource < 0 || resource >= RLIM_NLIMITS)
+    return EINVAL;
+
+  struct __spawn_attr *at = (struct __spawn_attr *) attr;
+
+  if (at->__rlimits == NULL)
+    {
+      at->__rlimits = __libc_reallocarray (at->__rlimits, RLIM_NLIMITS,
+					      sizeof (struct rlimit64));
+      if (at->__rlimits == NULL)
+	return ENOMEM;
+    }
+
+  at->__rlimitset |= 1u << resource;
+  at->__rlimits[resource].rlim_cur = rlim->rlim_cur;
+  at->__rlimits[resource].rlim_max = rlim->rlim_max;
+
+  return 0;
+}
+weak_alias (__posix_spawnattr_setrlimit_np, posix_spawnattr_setrlimit_np)
diff --git a/posix/tst-spawn8.c b/posix/tst-spawn8.c
new file mode 100644
index 0000000000..263d033fb9
--- /dev/null
+++ b/posix/tst-spawn8.c
@@ -0,0 +1,226 @@ 
+/* Tests for posix_spawn resource limit set.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <array_length.h>
+#include <errno.h>
+#include <getopt.h>
+#include <intprops.h>
+#include <inttypes.h>
+#include <spawn.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <support/check.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+#include <tst-spawn.h>
+#include <unistd.h>
+
+#define CMDLINE_OPTIONS \
+  { "restart", no_argument, &restart, 1 },
+static int restart;
+
+#pragma GCC optimize ("O0")
+
+static char *spargs[4                /* The four initial arguments.  */
+		    + 1              /* The extra --direct.  */
+		    + 1              /* The extra --restart.  */
+		    + RLIM_NLIMITS   /* The resources to check.  */
+		    + RLIM_NLIMITS   /* The soft limit.  */
+		    + RLIM_NLIMITS   /* The maximum limit.  */
+		    + 1              /* The final NULL.  */];
+static int start_args;
+
+_Noreturn static void
+handle_restart (int argc, char *argv[])
+{
+  TEST_VERIFY_EXIT (argc % 3 == 0);
+
+  for (int i = 0; i < argc; i += 3)
+    {
+      int resource;
+      {
+	char *endp;
+	resource = strtol (argv[0], &endp, 10);
+	TEST_VERIFY (endp != argv[0]);
+      }
+      TEST_VERIFY_EXIT (resource < RLIM_NLIMITS);
+      rlim64_t cur;
+      {
+	char *endp;
+	cur = strtoumax (argv[1], &endp, 10);
+	TEST_VERIFY (endp != argv[1]);
+      }
+      rlim64_t max;
+      {
+	char *endp;
+	max = strtoumax (argv[2], &endp, 10);
+	TEST_VERIFY (endp != argv[2]);
+      }
+
+      struct rlimit rlimit;
+      TEST_VERIFY_EXIT (getrlimit (resource, &rlimit) == 0);
+      TEST_COMPARE (rlimit.rlim_cur, cur);
+      TEST_COMPARE (rlimit.rlim_max, max);
+    }
+
+  exit (EXIT_SUCCESS);
+}
+
+static int
+do_basic_test (void)
+{
+  {
+    posix_spawnattr_t attr;
+    TEST_COMPARE (posix_spawnattr_init (&attr), 0);
+    TEST_COMPARE (posix_spawnattr_getrlimit_np (&attr, -1,
+						&(struct rlimit) {}),
+		  EINVAL);
+    TEST_COMPARE (posix_spawnattr_getrlimit_np (&attr, RLIM_NLIMITS,
+						&(struct rlimit) {}),
+		  EINVAL);
+    TEST_COMPARE (posix_spawnattr_destroy (&attr), 0);
+  }
+
+  for (int i = 0; i < RLIM_NLIMITS; i++)
+    {
+      posix_spawnattr_t attr;
+
+      TEST_COMPARE (posix_spawnattr_init (&attr), 0);
+
+      /* Query a non initialized resource.  */
+      TEST_COMPARE (posix_spawnattr_getrlimit_np (&attr, i,
+						  &(struct rlimit) {}),
+		    ENOENT);
+
+      /* Set the value.  */
+      TEST_COMPARE (posix_spawnattr_setrlimit_np (&attr, i,
+						  &(const struct rlimit)
+						   { 0, RLIM_INFINITY }), 0);
+      {
+	struct rlimit rlim;
+	TEST_COMPARE (posix_spawnattr_getrlimit_np (&attr, i, &rlim),
+		      0);
+	TEST_COMPARE (rlim.rlim_cur, 0);
+	TEST_COMPARE (rlim.rlim_max, RLIM_INFINITY);
+      }
+
+      /* Query a valid, but not already set value.  */
+      if (i != RLIM_NLIMITS - 1)
+	TEST_COMPARE (posix_spawnattr_getrlimit_np (&attr, i + 1,
+						    &(struct rlimit) {}),
+		      ENOENT);
+
+      /* Overwrite the resource value.  */
+      TEST_COMPARE (posix_spawnattr_setrlimit_np (&attr, i,
+						  &(const struct rlimit)
+						   { RLIM_INFINITY, 0 }), 0);
+      {
+	struct rlimit rlim;
+	TEST_COMPARE (posix_spawnattr_getrlimit_np (&attr, i, &rlim),
+		      0);
+	TEST_COMPARE (rlim.rlim_cur, RLIM_INFINITY);
+	TEST_COMPARE (rlim.rlim_max, 0);
+      }
+
+      TEST_COMPARE (posix_spawnattr_destroy (&attr), 0);
+    }
+
+  return 0;
+}
+
+static int
+do_test_spawn (void)
+{
+  struct rlimit rlimits[RLIM_NLIMITS];
+  for (int i = 0; i < RLIM_NLIMITS; i++)
+    TEST_VERIFY_EXIT (getrlimit (i, &rlimits[i]) == 0);
+
+  char resource_str[RLIM_NLIMITS][INT_STRLEN_BOUND (int)];
+  char cur_limit_str[RLIM_NLIMITS][INT_STRLEN_BOUND (uintmax_t)];
+  char max_limit_str[RLIM_NLIMITS][INT_STRLEN_BOUND (uintmax_t)];
+
+  posix_spawnattr_t attr;
+  TEST_COMPARE (posix_spawnattr_init (&attr), 0);
+
+  int argc = start_args;
+  for (int i = 0; i < RLIM_NLIMITS; i++)
+    {
+      if (rlimits[i].rlim_max == 0)
+	continue;
+
+      rlimits[i].rlim_cur /= 2;
+      rlimits[i].rlim_max /= 2;
+
+      TEST_COMPARE (posix_spawnattr_setrlimit_np (&attr, i, &rlimits[i]), 0);
+
+      snprintf (resource_str[i], sizeof resource_str[i], "%d", i);
+      snprintf (cur_limit_str[i], sizeof cur_limit_str[i], "%ju",
+		(uintmax_t) rlimits[i].rlim_cur);
+      snprintf (max_limit_str[i], sizeof max_limit_str[i], "%ju",
+		(uintmax_t) rlimits[i].rlim_max);
+
+      spargs[argc++] = resource_str[i];
+      spargs[argc++] = cur_limit_str[i];
+      spargs[argc++] = max_limit_str[i];
+    }
+  spargs[argc] = NULL;
+
+  TEST_COMPARE (posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETRLIMIT), 0);
+
+  PID_T_TYPE pid;
+  TEST_COMPARE (POSIX_SPAWN (&pid, spargs[0], NULL, &attr, spargs, environ),
+		0);
+
+  TEST_COMPARE (posix_spawnattr_destroy (&attr), 0);
+
+  siginfo_t sinfo;
+  TEST_COMPARE (WAITID (P_ALL, 0, &sinfo, WEXITED), 0);
+  TEST_COMPARE (sinfo.si_code, CLD_EXITED);
+  TEST_COMPARE (sinfo.si_status, 0);
+
+  return 0;
+}
+
+static int
+do_test (int argc, char *argv[])
+{
+  if (restart)
+    handle_restart (argc - 1, &argv[1]);
+  TEST_VERIFY_EXIT (argc == 2 || argc == 5);
+
+  do_basic_test ();
+
+  {
+    int i;
+    for (i = 0; i < argc - 1; i++)
+      spargs[i] = argv[i + 1];
+    spargs[i++] = (char *) "--direct";
+    spargs[i++] = (char *) "--restart";
+    start_args = i;
+  }
+
+  do_test_spawn ();
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION_ARGV do_test
+#include <support/test-driver.c>
diff --git a/resource/setrlimit64.c b/resource/setrlimit64.c
index 25fe5f1bb7..d28bf399f1 100644
--- a/resource/setrlimit64.c
+++ b/resource/setrlimit64.c
@@ -23,7 +23,7 @@ 
    Only the super-user can increase hard limits.
    Return 0 if successful, -1 if not (and sets errno).  */
 int
-setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
+__setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
 {
   struct rlimit rlimits32;
 
@@ -38,3 +38,5 @@  setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
 
   return __setrlimit (resource, &rlimits32);
 }
+libc_hidden_def (__setrlimit64)
+weak_alias (__setrlimit64, setrlimit64)
diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h
index 6192bb1243..38c22742f2 100644
--- a/sysdeps/mach/hurd/bits/typesizes.h
+++ b/sysdeps/mach/hurd/bits/typesizes.h
@@ -69,5 +69,10 @@ 
    fsfilcnt64_t are not the same type for all ABI purposes.  */
 # define __STATFS_MATCHES_STATFS64  0
 
+#ifdef __LP64__
+# define __RLIM_T_MATCHES_RLIM64_T	1
+#else
+# define __RLIM_T_MATCHES_RLIM64_T	0
+#endif
 
 #endif /* bits/typesizes.h */
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 3e183f5c02..5a9d173c01 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2586,6 +2586,8 @@  GLIBC_2.41 pthread_mutexattr_settype F
 GLIBC_2.41 pthread_sigmask F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_barrier_destroy F
 GLIBC_2.42 pthread_barrier_init F
 GLIBC_2.42 pthread_barrier_wait F
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index b1f934b0dd..d8c574ff51 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -32,6 +32,7 @@ 
 #include <hurd/resource.h>
 #include <assert.h>
 #include <argz.h>
+#include <stdbit.h>
 #include "spawn_int.h"
 
 /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
@@ -478,6 +479,19 @@  retry:
     }
   __mutex_unlock (&_hurd_dtable_lock);
 
+  /* Set the process resource limits.  */
+  if ((attrp->__flags & POSIX_SPAWN_SETRLIMIT) != 0)
+    {
+      uint32_t rlimitset = attrp->__rlimitset;
+      while (rlimitset != 0)
+	{
+	  int resource = stdc_trailing_zeros (rlimitset);
+	  if (__setrlimit64 (resource, &attrp->__rlimits[resource]) == -1)
+	    goto out;
+	  rlimitset &= ~(1u << resource);
+	}
+    }
+
   /* Safe to let signals happen now.  */
   _hurd_critical_section_unlock (ss);
 
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index 688ee26f4b..4d4afa0769 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -607,7 +607,7 @@  GLIBC_2.38 _libc_intl_domainname D 0x5
 GLIBC_2.38 _longjmp F
 GLIBC_2.38 _mcleanup F
 GLIBC_2.38 _mcount F
-GLIBC_2.38 _nl_default_dirname D 0xe
+GLIBC_2.38 _nl_default_dirname D 0x12
 GLIBC_2.38 _nl_domain_bindings D 0x8
 GLIBC_2.38 _nl_msg_cat_cntr D 0x4
 GLIBC_2.38 _obstack_allocated_p F
@@ -2269,6 +2269,8 @@  GLIBC_2.41 pthread_mutexattr_settype F
 GLIBC_2.41 pthread_sigmask F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_barrier_destroy F
 GLIBC_2.42 pthread_barrier_init F
 GLIBC_2.42 pthread_barrier_wait F
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index ebcf820403..42af360440 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -536,6 +536,7 @@  tests += \
   tst-spawn5-pidfd \
   tst-spawn6-pidfd \
   tst-spawn7-pidfd \
+  tst-spawn8-pidfd \
   # tests
 
 tests-static += \
@@ -551,11 +552,14 @@  CFLAGS-getpid.o = -fomit-frame-pointer
 CFLAGS-getpid.os = -fomit-frame-pointer
 CFLAGS-tst-spawn3-pidfd.c += -DOBJPFX=\"$(objpfx)\"
 
+CFLAGS-tst-spawn8-pidfd.c += -D_FILE_OFFSET_BITS=64
+
 tst-spawn-cgroup-ARGS = -- $(host-test-program-cmd)
 tst-spawn-pidfd-ARGS = -- $(host-test-program-cmd)
 tst-spawn5-pidfd-ARGS = -- $(host-test-program-cmd)
 tst-spawn6-pidfd-ARGS = -- $(host-test-program-cmd)
 tst-spawn7-pidfd-ARGS = -- $(host-test-program-cmd)
+tst-spawn8-pidfd-ARGS = -- $(host-test-program-cmd)
 tst-posix_spawn-setsid-pidfd-ARGS = -- $(host-test-program-cmd)
 endif
 
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index aa6bf483dd..d0d856532e 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2752,6 +2752,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index 225ed98915..9c7a44a91c 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -16,7 +16,10 @@ 
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_RESOURCE_H
+#ifndef _BITS_RESOURCE_H
+#define _BITS_RESOURCE_H
+
+#if !defined _SYS_RESOURCE_H && !defined _SPAWN_H
 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
 #endif
 
@@ -221,3 +224,5 @@  extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
 #endif
 
 __END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index d5df9656a8..2378442fe8 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -3099,6 +3099,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
index fd6c50cb27..d340164a8a 100644
--- a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
@@ -17,7 +17,7 @@ 
 
 #define USE_VERSIONED_RLIMIT
 #include <sysdeps/unix/sysv/linux/setrlimit64.c>
-versioned_symbol (libc, __setrlimit, setrlimit, GLIBC_2_27);
+versioned_symbol (libc, __setrlimit64, setrlimit, GLIBC_2_27);
 versioned_symbol (libc, __setrlimit64, setrlimit64, GLIBC_2_27);
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index c46c08da85..c884f7764a 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -2513,6 +2513,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 4df150c0f0..fef1b8d2ff 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -2805,6 +2805,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index be294783f6..f03c28c065 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -2802,6 +2802,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 51c07da019..8cbd494432 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -16,7 +16,10 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_RESOURCE_H
+#ifndef _BITS_RESOURCE_H
+#define _BITS_RESOURCE_H
+
+#if !defined _SYS_RESOURCE_H && !defined _SPAWN_H
 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
 #endif
 
@@ -221,3 +224,5 @@  extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
 #endif
 
 __END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index f123757134..5133b265a9 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2789,6 +2789,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 2dc85b9533..984b55f31c 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2826,6 +2826,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 1e38217ec6..863dc10ad8 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -3009,6 +3009,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
index 927fc21445..5cb5864b71 100644
--- a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist
@@ -2273,6 +2273,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 74da49d9da..e84db96f17 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -2785,6 +2785,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index e5d678111f..fdb16fdb6a 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2952,6 +2952,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 4dbd4b6045..2db46c6479 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2838,6 +2838,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index c5965bb50c..715333baf0 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2835,6 +2835,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
index 05f8e6ad35..50b9239ea8 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/resource.h
@@ -16,7 +16,10 @@ 
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_RESOURCE_H
+#ifndef _BITS_RESOURCE_H
+#define _BITS_RESOURCE_H
+
+#if !defined _SYS_RESOURCE_H && !defined _SPAWN_H
 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
 #endif
 
@@ -229,3 +232,5 @@  extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
 #endif
 
 __END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 10715e0777..78b2343bb8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2913,6 +2913,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index e4cb45275b..cef4c3fdfc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2919,6 +2919,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 8a32d2585d..88552d3d83 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2821,6 +2821,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist
index 64dac95b2a..eafbc801f7 100644
--- a/sysdeps/unix/sysv/linux/or1k/libc.abilist
+++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist
@@ -2263,6 +2263,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index cc5e93c77c..fa84873e19 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -3142,6 +3142,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 9814997083..f108b01d47 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -3187,6 +3187,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 7f46295c11..7cbf55204f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2896,6 +2896,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index f24f81bb5f..ca2abbee1e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2972,6 +2972,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 9330c7ab76..8f750dc78c 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -2516,6 +2516,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index ea4555d39e..12e755d237 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2716,6 +2716,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 3e625fa4e9..fe663d1f20 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -3140,6 +3140,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 46b4a04f65..e17b3d2a3a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2933,6 +2933,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c
index d62ea94acf..b7ca64d914 100644
--- a/sysdeps/unix/sysv/linux/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/setrlimit64.c
@@ -24,12 +24,9 @@ 
 /* Add this redirection so the strong_alias for __RLIM_T_MATCHES_RLIM64_T
    linking setrlimit64 to {__}setrlimit does not throw a type error.  */
 #undef setrlimit
-#undef __setrlimit
 #define setrlimit setrlimit_redirect
-#define __setrlimit __setrlimit_redirect
 #include <sys/resource.h>
 #undef setrlimit
-#undef __setrlimit
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
@@ -39,17 +36,17 @@  __setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
 {
   return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
 }
+libc_hidden_def (__setrlimit64)
 /* Alpha defines a versioned setrlimit{64}.  */
 #ifndef USE_VERSIONED_RLIMIT
 weak_alias (__setrlimit64, setrlimit64)
 #endif
 
 #if __RLIM_T_MATCHES_RLIM64_T
-strong_alias (__setrlimit64, __setrlimit)
 # ifndef USE_VERSIONED_RLIMIT
 weak_alias (__setrlimit64, setrlimit)
 # endif
 # ifdef SHARED
-__hidden_ver1 (__setrlimit64, __GI___setrlimit, __setrlimit64);
+strong_alias (__setrlimit64, __GI___setrlimit)
 # endif
 #endif
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 36a94c9210..807321c07f 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2832,6 +2832,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index f79aba6aab..df23a1db81 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2829,6 +2829,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index 193c94657d..727914ab3d 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -16,7 +16,10 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_RESOURCE_H
+#ifndef _BITS_RESOURCE_H
+#define _BITS_RESOURCE_H
+
+#if !defined _SYS_RESOURCE_H && !defined _SPAWN_H
 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
 #endif
 
@@ -236,3 +239,5 @@  extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
 #endif
 
 __END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 4a6acc08e0..876f2529f7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -3161,6 +3161,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 931109dab1..8d1bd80545 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2797,6 +2797,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index d78298d8b4..bfeeb0cf4f 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -27,6 +27,7 @@ 
 #include <sysdep.h>
 #include <sys/resource.h>
 #include <clone_internal.h>
+#include <stdbit.h>
 
 /* The Linux implementation of posix_spawn{p} uses the clone syscall directly
    with CLONE_VM and CLONE_VFORK flags and an allocated stack.  The new stack
@@ -171,6 +172,19 @@  __spawni_child (void *arguments)
 	  || local_setegid (__getgid ()) != 0))
     goto fail;
 
+  /* Set the process resource limits.  */
+  if ((attr->__flags & POSIX_SPAWN_SETRLIMIT) != 0)
+    {
+      uint32_t rlimitset = attr->__rlimitset;
+      while (rlimitset != 0)
+	{
+	  int resource = stdc_trailing_zeros (rlimitset);
+	  if (__setrlimit64 (resource, &attr->__rlimits[resource]) == -1)
+	    goto fail;
+	  rlimitset &= ~(1u << resource);
+	}
+    }
+
   /* Execute the file actions.  */
   if (file_actions != NULL)
     {
diff --git a/sysdeps/unix/sysv/linux/tst-spawn8-pidfd.c b/sysdeps/unix/sysv/linux/tst-spawn8-pidfd.c
new file mode 100644
index 0000000000..5322e9b12c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-spawn8-pidfd.c
@@ -0,0 +1,20 @@ 
+/* Tests for spawn pidfd extension.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-spawn-pidfd.h>
+#include <posix/tst-spawn8.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 7ab9073e3a..bbe7d8b606 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2748,6 +2748,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index e11876f6ab..0c3fde8fa7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2767,6 +2767,8 @@  GLIBC_2.41 sched_getattr F
 GLIBC_2.41 sched_setattr F
 GLIBC_2.42 __inet_ntop_chk F
 GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 posix_spawnattr_getrlimit_np F
+GLIBC_2.42 posix_spawnattr_setrlimit_np F
 GLIBC_2.42 pthread_gettid_np F
 GLIBC_2.42 uabs F
 GLIBC_2.42 uimaxabs F