]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Support Linux syscall 434 pidfd_open
authorEarl Chew <earl_chew@yahoo.com>
Fri, 14 Apr 2023 20:56:16 +0000 (22:56 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 14 Apr 2023 21:06:48 +0000 (23:06 +0200)
14 files changed:
NEWS
coregrind/m_syswrap/priv_syswrap-linux.h
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-arm-linux.c
coregrind/m_syswrap/syswrap-arm64-linux.c
coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-mips32-linux.c
coregrind/m_syswrap/syswrap-mips64-linux.c
coregrind/m_syswrap/syswrap-nanomips-linux.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-s390x-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c
include/vki/vki-scnums-shared-linux.h

diff --git a/NEWS b/NEWS
index 68acfff7cfc47dd33c2ed7e510e555f86f52402a..b8d5e333d720b23e4c278640ac51408f5cafbcb8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -140,6 +140,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 462830  WARNING: unhandled amd64-freebsd syscall: 474
 463027  broken check for MPX instruction support in assembler
 464476  Firefox fails to start under Valgrind
+464609  Valgrind memcheck should support Linux pidfd_open
 464680  Show issues caused by memory policies like selinux deny_execmem
 464859  Build failures with GCC-13 (drd tsan_unittest)
 464969  D language demangling
index 4f85069476700d3806b0d3fd923dd57a7924e00f..a73b6247e7c8d8e671879f300f002c0237910ec2 100644 (file)
@@ -320,6 +320,9 @@ DECL_TEMPLATE(linux, sys_io_uring_setup);
 DECL_TEMPLATE(linux, sys_io_uring_enter);
 DECL_TEMPLATE(linux, sys_io_uring_register);
 
+// Linux-specific (new in Linux 5.3)
+DECL_TEMPLATE(linux, sys_pidfd_open);
+
 // Linux-specific (new in Linux 5.9)
 DECL_TEMPLATE(linux, sys_close_range);
 DECL_TEMPLATE(linux, sys_openat2);
index 9054199857a430b1ad3611d95115d28f2f9224c8..1aeebd274b5f2df0207a4559b5bc6a25b6192d53 100644 (file)
@@ -876,6 +876,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
 
+   LINXY(__NR_pidfd_open,        sys_pidfd_open),        // 434
    GENX_(__NR_clone3,            sys_ni_syscall),        // 435
    LINXY(__NR_close_range,       sys_close_range),       // 436
    LINXY(__NR_openat2,           sys_openat2),           // 437
index d583cef0c78ae9dc0be82dd68ec4c6bf386f29b7..8b1a8fe702390700a11d0ae24096f7151a3c2095 100644 (file)
@@ -1052,6 +1052,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
 
+   LINXY(__NR_pidfd_open,        sys_pidfd_open),        // 434
    GENX_(__NR_clone3,            sys_ni_syscall),        // 435
    LINXY(__NR_close_range,       sys_close_range),       // 436
 
index 3ed71e143b7644cb9f3b696872e6a04afc379c4e..9532360007be8df2d89bc87fd7ba2b2a4322c730 100644 (file)
@@ -831,6 +831,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
 
+   LINXY(__NR_pidfd_open,        sys_pidfd_open),        // 434
    GENX_(__NR_clone3,            sys_ni_syscall),        // 435
    LINXY(__NR_close_range,       sys_close_range),       // 436
 
index 34d4cf1f55408e6ebcfa3d7c642366adcba54b01..26f1fbee3cce4bb16ccbe87209858e0ed896b5b2 100644 (file)
@@ -13605,6 +13605,22 @@ POST(sys_openat2)
    }
 }
 
+PRE(sys_pidfd_open)
+{
+  PRINT("sys_pidfd_open ( %ld, %lu )", SARG1, ARG2);
+}
+
+POST(sys_pidfd_open)
+{
+   if (!ML_(fd_allowed)(RES, "pidfd", tid, True)) {
+      VG_(close)(RES);
+      SET_STATUS_Failure( VKI_EMFILE );
+   } else {
+      if (VG_(clo_track_fds))
+         ML_(record_fd_open_nameless) (tid, RES);
+   }
+}
+
 #undef PRE
 #undef POST
 
index f556e063f084637856ddc343aa510f2c44383b93..de27998b3fe36b2576faa31cd80151b928eee340 100644 (file)
@@ -1136,6 +1136,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY(__NR_io_uring_enter,          sys_io_uring_enter),          // 426
    LINXY(__NR_io_uring_register,       sys_io_uring_register),       // 427
 
+   LINXY(__NR_pidfd_open,              sys_pidfd_open),              // 434
    GENX_(__NR_clone3,                  sys_ni_syscall),              // 435
    LINXY(__NR_close_range,       sys_close_range),       // 436
 
index 41a5404c559c4dffe3d0a89769422b6cf993d8b1..67e7c2c2f6bc446c800b317c49e010f7322bd75b 100644 (file)
@@ -815,6 +815,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY (__NR_io_uring_setup, sys_io_uring_setup),
    LINXY (__NR_io_uring_enter, sys_io_uring_enter),
    LINXY (__NR_io_uring_register, sys_io_uring_register),
+   LINXY (__NR_pidfd_open, sys_pidfd_open),
    GENX_ (__NR_clone3, sys_ni_syscall),
    LINXY (__NR_close_range, sys_close_range),
    LINX_ (__NR_faccessat2, sys_faccessat2),
index f9d4b19f4af5dfe4ea059feb30791ed9f6927d24..9c535c68eadabe7e41b8590e12ae1e865553fee3 100644 (file)
@@ -824,6 +824,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY (__NR_io_uring_setup,         sys_io_uring_setup),
    LINXY (__NR_io_uring_enter,         sys_io_uring_enter),
    LINXY (__NR_io_uring_register,      sys_io_uring_register),
+   LINXY (__NR_pidfd_open,             sys_pidfd_open),
    GENX_ (__NR_clone3,                 sys_ni_syscall),
    LINXY (__NR_close_range,            sys_close_range),
    LINX_ (__NR_faccessat2,             sys_faccessat2),
index 637b2504e1c1fdeb0d4d77e94f88fbc3b14a4627..12c07302717add8862830e488595ff2fdf783a9e 100644 (file)
@@ -1056,6 +1056,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
 
+   LINXY(__NR_pidfd_open,        sys_pidfd_open),        // 434
    GENX_(__NR_clone3,            sys_ni_syscall),        // 435
    LINXY(__NR_close_range,       sys_close_range),       // 436
 
index 93956d3cc295cd429484af7bcf86d4e54fca15d4..3c33d1267e700446d6bea1824ee668b358582013 100644 (file)
@@ -1025,6 +1025,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
 
+   LINXY(__NR_pidfd_open,        sys_pidfd_open),        // 434
    GENX_(__NR_clone3,            sys_ni_syscall),        // 435
    LINXY(__NR_close_range,       sys_close_range),       // 436
 
index 73f9684c46756bc33aa968d686205c865ded9e17..a377cb73152d9aa3db7ecec83803c74b50b8d6db 100644 (file)
@@ -866,6 +866,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_io_uring_enter, sys_io_uring_enter),                    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register),              // 427
 
+   LINXY(__NR_pidfd_open, sys_pidfd_open),                            // 434
    GENX_(__NR_clone3, sys_ni_syscall),                                // 435
    LINXY(__NR_close_range, sys_close_range),                          // 436
 
index 5968d49dbfb6f69da80a9bd390eb6ddaa0574ffd..a9ba15dfe6a07ad5139ad04a75f04da2c936eebb 100644 (file)
@@ -1647,6 +1647,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),   // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register),// 427
 
+   LINXY(__NR_pidfd_open,        sys_pidfd_open),       // 434
    GENX_(__NR_clone3,            sys_ni_syscall),       // 435
    LINXY(__NR_close_range,       sys_close_range),      // 436
    LINXY(__NR_openat2,           sys_openat2),          // 437
index 048460d0b280990dc5c561060cd241306d633335..d90cdd31242bdcdbcdc1dad97578a5f620ffa5bb 100644 (file)
@@ -39,6 +39,7 @@
 #define __NR_fsmount           432
 #define __NR_fspick            433
 
+#define __NR_pidfd_open                434
 #define __NR_clone3            435
 #define __NR_close_range       436
 #define __NR_openat2        437