https://bugs.kde.org/show_bug.cgi?id=505673
--- Comment #18 from Paul Floyd <pjfl...@wanadoo.fr> --- A first stab for Linux openat: /* And for /proc/self/exe or /proc/<pid>/exe case. */ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); vg_assert(VG_(resolved_exename) && VG_(resolved_exename)[0] == '/'); const HChar* path = (const HChar*)ARG2; if (ML_(safe_to_deref)( path, 1 )) { HChar tmp[VKI_PATH_MAX]; VG_(realpath)(path, tmp); if (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0 || !VG_(strcmp)(tmp, VG_(resolved_exename))) { if ((ARG3 & VKI_O_WRONLY) || (ARG3 & VKI_O_RDWR)) { SET_STATUS_Failure( VKI_ETXTBSY ); return; } sres = VG_(dup)( VG_(cl_exec_fd) ); SET_STATUS_from_SysRes( sres ); if (!sr_isError(sres)) { OffT off = VG_(lseek)( sr_Res(sres), 0, VKI_SEEK_SET ); if (off < 0) SET_STATUS_Failure( VKI_EMFILE ); } return; } } I don't like this much. We are just doing a dup of VG_(cl_exec_fd). As far as I can see cl_exec_fd is already a dup (or 2) ultimately originating from VG_(pre_exec_check) which does res = VG_(open)(exe_name, VKI_O_RDONLY, 0); Probably mostly harmless but it does mean that we will lose any O_ flags like O_NOATIME or O_CLOEXEC. I think that I should make a common function for openat and openat2 for all the flag handling. -- You are receiving this mail because: You are watching all bug changes.