]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Just set filename ARG to handle /proc/self/exe in open, openat and openat2
authorMark Wielaard <mark@klomp.org>
Sat, 19 Jul 2025 20:19:08 +0000 (22:19 +0200)
committerMark Wielaard <mark@klomp.org>
Sat, 19 Jul 2025 20:47:18 +0000 (22:47 +0200)
This simplifies the logic a little and makes reasoning about how the
PRE handler works slightly simpler.

coregrind/m_syswrap/syswrap-generic.c
coregrind/m_syswrap/syswrap-linux.c

index 280b1ccb6aac36421ecf21645a4ab73337f0348b..7ac86fbbc02f1987132770635422f09736d2c739 100644 (file)
@@ -4692,8 +4692,7 @@ PRE(sys_open)
 
    if (proc_self_exe) {
       // do the syscall with VG_(resolved_exename)
-      SET_STATUS_from_SysRes(VG_(do_syscall3)(SYSNO, (Word)VG_(resolved_exename), ARG2, ARG3));
-      return;
+      ARG1 = (Word)VG_(resolved_exename);
    }
 #endif // defined(VGO_linux)
 
index d1cfdad69addf70e8f1724547c38935eaedbcfc2..552fceee8d04a31d36ba7d78d171137762d1b510 100644 (file)
@@ -6094,8 +6094,7 @@ no_client_write:
    if (proc_self_exe) {
 
       // do the syscall with VG_(resolved_exename)
-      SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4));
-      return;
+      ARG2 = (Word)VG_(resolved_exename);
    }
 
    /* Otherwise handle normally */
@@ -14095,8 +14094,7 @@ PRE(sys_openat2)
 
    if (proc_self_exe) {
       // do the syscall with VG_(resolved_exename)
-      SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4));
-      return;
+      ARG2 = (Word)VG_(resolved_exename);
    }
 
    /* Otherwise handle normally */