Currently the wrapper is just doing some minimal checking on the args. Solaris also has fexecve but it seems to just overload execve. That should do as a starting point, but on FreeBSD there isn't the extra complexity of determining if ARG1 is an fd or a path. Short summary of what I think needs doing 1. Perform sanity checking on the fd 2. Get the flags and filename from the fd (will need a new function to get the flags) 3. Perform sanity checking on the flags 4. If all is OK, call handle_pre_sys_execve with check_pathptr False 5. Modify handle_pre_sys_execve slightly, changing Bool is_execveat to be something like enum ExecveType { EXECVE, EXECVEAT, FEXECVE }; and in the body of the function set 'str' accordingly.
Created attachment 143550 [details] fexecve wrapper that checks something Check the fd then calls handle_pre_sys_execve Lots of tests cos fexecve doesn't return when it succeeds :-( Small change to handle_pre_sys_execve so thatit can print fexecve as well as exeve and execveat.
Created attachment 143551 [details] fexecve wrapper that checks something This time with diff from the branch to master
The attached patch is reversed, but looking with patch -p1 -R it seems OK. Some nitpicks: - priv_syswrap-generic.h handle_sys_pwritev, please rename the argument is_execveType -> execveType. - Should resolve_filemode be in coregrind/m_syswrap/syswrap-freebsd.c since that is the only user?
Fixed with commit 83dda2b71a75bd0058ed50a32ec871b083a96f91 (HEAD -> master, origin/master, origin/HEAD) Author: Paul Floyd <pjfloyd@wanadoo.fr> Date: Sun Nov 14 22:06:14 2021 +0100 Bug 444925 fexecve syscall wrapper not properly implemented Implement fexecve and a few testcases on FreeBSD.