]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
sys_newfstatat: don't complain if |file_name| is NULL.
authorMike Hommey <mh@glandium.org>
Fri, 26 Feb 2021 08:09:52 +0000 (17:09 +0900)
committerMark Wielaard <mark@klomp.org>
Sun, 28 Feb 2021 21:31:25 +0000 (22:31 +0100)
This is a followup to 2a7d3ae76, in the case rust code runs against a
glibc that supports statx but a kernel that doesn't, in which case glibc
falls back to fstatat.

https://bugs.kde.org/show_bug.cgi?id=433641

NEWS
coregrind/m_syswrap/syswrap-linux.c

diff --git a/NEWS b/NEWS
index 19118b9dc79cf871459a7a934de49a64327bcb3b..43533fc1ad77c78873cab10971ad7bf1cf634744 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -141,6 +141,7 @@ where XXXXXX is the bug number as listed below.
 433323  Use pkglibexecdir as vglibdir
 433500  DRD regtest faulures when libstdc++ and libgcc debuginfo are installed
 433629  valgrind/README has type "abd" instead of "and"
+433641  Rust std::sys::unix::fs::try_statx Syscall param fstatat(file_name)
 n-i-bz  helgrind: If hg_cli__realloc fails, return NULL.
 
 
index 3d6939d147ad5f9e802c48f24d328fc28b6ba747..5ae4e66132d513f6f14e4e85e66ef06b1e8e93e5 100644 (file)
@@ -5885,8 +5885,14 @@ PRE(sys_newfstatat)
          SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3);
    PRE_REG_READ3(long, "fstatat",
                  int, dfd, char *, file_name, struct stat *, buf);
-   PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 );
-   PRE_MEM_WRITE( "fstatat(buf)", ARG3, sizeof(struct vki_stat) );
+   // See the comment about Rust in PRE(sys_statx). When glibc does support
+   // statx rust uses that instead of the system call, but glibc's statx is
+   // implemented in terms of fstatat, so the filename being NULL is
+   // transferred here.
+   if (ARG2 != 0) {
+      PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 );
+      PRE_MEM_WRITE( "fstatat(buf)", ARG3, sizeof(struct vki_stat) );
+   }
 }
 
 POST(sys_newfstatat)