]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
sys_statx: support for statx(fd, NULL, AT_EMPTY_PATH)
authorMiao Wang <shankerwangmiao@gmail.com>
Mon, 26 Aug 2024 14:08:43 +0000 (22:08 +0800)
committerMark Wielaard <mark@klomp.org>
Fri, 30 Aug 2024 11:49:40 +0000 (13:49 +0200)
statx(fd, NULL, AT_EMPTY_PATH) is supported since Linux 6.11 and this
patch adds the support to valgrind, so that it won't complain when
NULL is used as |filename| and |flags| includes AT_EMPTY_PATH.

Ref: commit 0ef625bba6fb ("vfs: support statx(..., NULL, AT_EMPTY_PATH, ...)")

Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
coregrind/m_syswrap/syswrap-linux.c

index 9f3c51c17948378e501f2200be8b141aa13016b6..4533855998183631667fbeae96839ec81f5b63dc 100644 (file)
@@ -4209,8 +4209,12 @@ PRE(sys_statx)
    // in which it passes NULL for both filename and buf, and then looks at the
    // return value, so as to determine whether or not this syscall is supported.
    Bool both_filename_and_buf_are_null = ARG2 == 0 && ARG5 == 0;
+   Bool statx_null_path = (ARG2 == 0) && (ARG3 & VKI_AT_EMPTY_PATH);
    if (!both_filename_and_buf_are_null) {
-      PRE_MEM_RASCIIZ( "statx(filename)", ARG2 );
+      // Since Linux 6.11, the kernel allows passing a NULL filename when
+      // the AT_EMPTY_PATH flag is set.
+      if (!statx_null_path)
+         PRE_MEM_RASCIIZ( "statx(filename)", ARG2 );
       PRE_MEM_WRITE( "statx(buf)", ARG5, sizeof(struct vki_statx) );
    }
 }