From: Mark Wielaard Date: Sat, 19 Jul 2025 20:19:08 +0000 (+0200) Subject: Just set filename ARG to handle /proc/self/exe in open, openat and openat2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=769ca880912f26f3b6033bfe08e7417580b02c25;p=thirdparty%2Fvalgrind.git Just set filename ARG to handle /proc/self/exe in open, openat and openat2 This simplifies the logic a little and makes reasoning about how the PRE handler works slightly simpler. --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 280b1ccb6..7ac86fbbc 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -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) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d1cfdad69..552fceee8 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -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 */