linux-user: implement execveat
v5 cover linux-user: implement execveat
As I was reviewing this patch from Drew:
https://lore.kernel.org/qemu-devel/[email protected]/
and it was too big for my review standards, I split it into smaller steps. Since the result can help the other reviewers, post it.
Since v4:
- Constify struct flags
- Split Drew's patch in 4
Drew DeVault (4):
linux-user/strace: Extract print_execve_argv() from print_execve() linux-user/strace: Add output for execveat() syscall linux-user/syscall: Extract do_execve() from do_syscall1() linux-user/syscall: Implement execveat()
Philippe Mathieu-Daudé (1):
linux-user/strace: Constify struct flags
linux-user/strace.c | 134 +++++++++++++++---------- linux-user/strace.list | 2 +- linux-user/syscall.c | 216 ++++++++++++++++++++++------------------- 3 files changed, 201 insertions(+), 151 deletions(-)
Signature · 1 line
2.38.1
PATCH v5 1/5 linux-user/strace: Constify struct flags
print_flags() takes a const pointer.
--- linux-user/strace.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
linux-user/strace.c +20 -20
@@ -945,7 +945,7 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const struct syscallname *name, }#endif -UNUSED static struct flags access_flags[] = { +UNUSED static const struct flags access_flags[] = {FLAG_GENERIC (F_OK ),FLAG_GENERIC (R_OK ),FLAG_GENERIC (W_OK ),
@@ -953,7 +953,7 @@ UNUSED static struct flags access_flags[] = { FLAG_END, }; -UNUSED static struct flags at_file_flags[] = { +UNUSED static const struct flags at_file_flags[] = {#ifdef AT_EACCESS FLAG_GENERIC(AT_EACCESS),#endif
@@ -963,14 +963,14 @@ UNUSED static struct flags at_file_flags[] = { FLAG_END, }; -UNUSED static struct flags unlinkat_flags[] = { +UNUSED static const struct flags unlinkat_flags[] = { #ifdef AT_REMOVEDIR FLAG_GENERIC(AT_REMOVEDIR), #endif FLAG_END, }; -UNUSED static struct flags mode_flags[] = { +UNUSED static const struct flags mode_flags[] = { FLAG_GENERIC(S_IFSOCK), FLAG_GENERIC(S_IFLNK), FLAG_GENERIC(S_IFREG),
@@ -981,14 +981,14 @@ UNUSED static struct flags mode_flags[] = { FLAG_END, }; -UNUSED static struct flags open_access_flags[] = { +UNUSED static const struct flags open_access_flags[] = {FLAG_TARGET (O_RDONLY ),FLAG_TARGET (O_WRONLY ),FLAG_TARGET (O_RDWR ),FLAG_END , }; -UNUSED static struct flags open_flags[] = { +UNUSED static const struct flags open_flags[] = {FLAG_TARGET (O_APPEND ),FLAG_TARGET (O_CREAT ),FLAG_TARGET (O_DIRECTORY ),
@@ -1019,7 +1019,7 @@ UNUSED static struct flags open_flags[] = { FLAG_END, }; -UNUSED static struct flags mount_flags[] = { +UNUSED static const struct flags mount_flags[] = {#ifdef MS_BIND FLAG_GENERIC(MS_BIND),#endif
@@ -1044,7 +1044,7 @@ UNUSED static struct flags mount_flags[] = { FLAG_END, }; -UNUSED static struct flags umount2_flags[] = { +UNUSED static const struct flags umount2_flags[] = {#ifdef MNT_FORCE FLAG_GENERIC(MNT_FORCE),#endif
@@ -1057,7 +1057,7 @@ UNUSED static struct flags umount2_flags[] = { FLAG_END, }; -UNUSED static struct flags mmap_prot_flags[] = { +UNUSED static const struct flags mmap_prot_flags[] = {FLAG_GENERIC (PROT_NONE ),FLAG_GENERIC (PROT_EXEC ),FLAG_GENERIC (PROT_READ ),
@@ -1068,7 +1068,7 @@ UNUSED static struct flags mmap_prot_flags[] = { FLAG_END, }; -UNUSED static struct flags mmap_flags[] = { +UNUSED static const struct flags mmap_flags[] = {FLAG_TARGET (MAP_SHARED ),FLAG_TARGET (MAP_PRIVATE ),FLAG_TARGET (MAP_ANONYMOUS ),
@@ -1092,7 +1092,7 @@ UNUSED static struct flags mmap_flags[] = { FLAG_END, }; -UNUSED static struct flags clone_flags[] = { +UNUSED static const struct flags clone_flags[] = {FLAG_GENERIC (CLONE_VM ),FLAG_GENERIC (CLONE_FS ),FLAG_GENERIC (CLONE_FILES ),
@@ -1136,7 +1136,7 @@ UNUSED static struct flags clone_flags[] = { FLAG_END, }; -UNUSED static struct flags msg_flags[] = { +UNUSED static const struct flags msg_flags[] = {/* send */ FLAG_GENERIC (MSG_CONFIRM ),FLAG_GENERIC (MSG_DONTROUTE ),
@@ -1156,7 +1156,7 @@ UNUSED static struct flags msg_flags[] = { FLAG_END, }; -UNUSED static struct flags statx_flags[] = { +UNUSED static const struct flags statx_flags[] = {#ifdef AT_EMPTY_PATH FLAG_GENERIC(AT_EMPTY_PATH),#endif
@@ -1178,7 +1178,7 @@ UNUSED static struct flags statx_flags[] = { FLAG_END, }; -UNUSED static struct flags statx_mask[] = { +UNUSED static const struct flags statx_mask[] = {/* This must come first, because it includes everything. */ #ifdef STATX_ALL FLAG_GENERIC(STATX_ALL),
@@ -1226,7 +1226,7 @@ UNUSED static struct flags statx_mask[] = { FLAG_END, }; -UNUSED static struct flags falloc_flags[] = { +UNUSED static const struct flags falloc_flags[] = {FLAG_GENERIC (FALLOC_FL_KEEP_SIZE ),FLAG_GENERIC (FALLOC_FL_PUNCH_HOLE ), #ifdef FALLOC_FL_NO_HIDE_STALE
@@ -1246,7 +1246,7 @@ UNUSED static struct flags falloc_flags[] = {#endif }; -UNUSED static struct flags termios_iflags[] = { +UNUSED static const struct flags termios_iflags[] = {FLAG_TARGET (IGNBRK ),FLAG_TARGET (BRKINT ),FLAG_TARGET (IGNPAR ),
@@ -1265,7 +1265,7 @@ UNUSED static struct flags termios_iflags[] = { FLAG_END, }; -UNUSED static struct flags termios_oflags[] = { +UNUSED static const struct flags termios_oflags[] = {FLAG_TARGET (OPOST ),FLAG_TARGET (OLCUC ),FLAG_TARGET (ONLCR ),
@@ -1349,7 +1349,7 @@ UNUSED static struct enums termios_cflags_CSIZE[] = { ENUM_END, }; -UNUSED static struct flags termios_cflags[] = { +UNUSED static const struct flags termios_cflags[] = {FLAG_TARGET (CSTOPB ),FLAG_TARGET (CREAD ),FLAG_TARGET (PARENB ),
@@ -1360,7 +1360,7 @@ UNUSED static struct flags termios_cflags[] = { FLAG_END, }; -UNUSED static struct flags termios_lflags[] = { +UNUSED static const struct flags termios_lflags[] = {FLAG_TARGET (ISIG ),FLAG_TARGET (ICANON ),FLAG_TARGET (XCASE ),
@@ -1380,7 +1380,7 @@ UNUSED static struct flags termios_lflags[] = { FLAG_END, }; -UNUSED static struct flags mlockall_flags[] = { +UNUSED static const struct flags mlockall_flags[] = {FLAG_TARGET (MCL_CURRENT ),FLAG_TARGET (MCL_FUTURE ), #ifdef MCL_ONFAULT
Signature · 1 line
2.38.1
Re: [PATCH v5 1/5] linux-user/strace: Constify struct flags
Le 04/11/2022 à 18:36, Philippe Mathieu-Daudé a écrit :
Quoted 7 lines
print_flags()takes a const pointer.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- linux-user/strace.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
PATCH v5 2/5 linux-user/strace: Extract print_execve_argv() from print_execve()
In reply to Philippe Mathieu-DaudéFrom: Drew DeVault <[email protected]>
In order to add print_execveat() which re-use common code from print_execve(), extract print_execve_argv() from it.
Message-Id: <[email protected]>
--- linux-user/strace.c | 71 +++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 32 deletions(-)
linux-user/strace.c +39 -32
@@ -616,38 +616,6 @@ print_semctl(CPUArchState *cpu_env, const struct syscallname *name, }#endif -static void -print_execve (CPUArchState *cpu_env,const struct syscallname *name, -abi_long arg1,abi_long arg2,abi_long arg3, -abi_long arg4,abi_long arg5,abi_long arg6) -{ -abi_ulong arg_ptr_addr; -char *s; - -if (!(s =lock_user_string (arg1))) -return ; -qemu_log ("%s(\"%s\",{" , name->name, s); -unlock_user (s, arg1,0 ); - -for (arg_ptr_addr = arg2; ; arg_ptr_addr +=sizeof (abi_ulong)) { -abi_ulong *arg_ptr, arg_addr; - - arg_ptr =lock_user (VERIFY_READ , arg_ptr_addr,sizeof (abi_ulong),1 ); -if (!arg_ptr) -return ; - arg_addr =tswapal (*arg_ptr); -unlock_user (arg_ptr, arg_ptr_addr,0 ); -if (!arg_addr) -break ; -if ((s =lock_user_string (arg_addr))) { -qemu_log ("\"%s\"," , s); -unlock_user (s, arg_addr,0 ); - } - } - -qemu_log ("NULL})" ); -} -#ifdef TARGET_NR_ipc static void print_ipc(CPUArchState *cpu_env, const struct syscallname *name,
@@ -1969,6 +1937,45 @@ print_execv(CPUArchState *cpu_env, const struct syscallname *name, }#endif +static void +print_execve_argv (abi_long argv,int last) +{ +abi_ulong arg_ptr_addr; +char *s; + +qemu_log ("{" ); +for (arg_ptr_addr = argv; ; arg_ptr_addr +=sizeof (abi_ulong)) { +abi_ulong *arg_ptr, arg_addr; + + arg_ptr =lock_user (VERIFY_READ , arg_ptr_addr,sizeof (abi_ulong),1 ); +if (!arg_ptr) { +return ; + } + arg_addr =tswapal (*arg_ptr); +unlock_user (arg_ptr, arg_ptr_addr,0 ); +if (!arg_addr) { +break ; + } + s =lock_user_string (arg_addr); +if (s) { +qemu_log ("\"%s\"," , s); +unlock_user (s, arg_addr,0 ); + } + } +qemu_log ("NULL}%s" ,get_comma (last)); +} + +static void +print_execve (CPUArchState *cpu_env,const struct syscallname *name, +abi_long arg1,abi_long arg2,abi_long arg3, +abi_long arg4,abi_long arg5,abi_long arg6) +{ +print_syscall_prologue (name); +print_string (arg1,0 ); +print_execve_argv (arg2,1 ); +print_syscall_epilogue (name); +} +#if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2) static void print_faccessat(CPUArchState *cpu_env, const struct syscallname *name,
Signature · 1 line
2.38.1
Re: [PATCH v5 2/5] linux-user/strace: Extract print_execve_argv() from print_execve()
Le 04/11/2022 à 18:36, Philippe Mathieu-Daudé a écrit :
Quoted 5 lines
From: Drew DeVault <[email protected]>
In order to add
print_execveat()which re-use common code fromprint_execve(), extractprint_execve_argv()from it.
Quoted 7 lines
Signed-off-by Drew DeVault <[email protected]>Message-Id: <[email protected]>
[PMD: Split of bigger patch, filled description, fixed style]Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- linux-user/strace.c | 71 +++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 32 deletions(-)
PATCH v5 3/5 linux-user/strace: Add output for execveat() syscall
In reply to Philippe Mathieu-DaudéFrom: Drew DeVault <[email protected]>
Message-Id: <[email protected]>
--- linux-user/strace.c | 23 +++++++++++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-)
linux-user/strace.c +23 -0
@@ -1104,6 +1104,16 @@ UNUSED static const struct flags clone_flags[] = { FLAG_END, }; +UNUSED static const struct flags execveat_flags[] = { +#ifdef AT_EMPTY_PATH + FLAG_GENERIC(AT_EMPTY_PATH), +#endif +#ifdef AT_SYMLINK_NOFOLLOW + FLAG_GENERIC(AT_SYMLINK_NOFOLLOW), +#endif + FLAG_END, +}; + UNUSED static const struct flags msg_flags[] = { /* send */ FLAG_GENERIC(MSG_CONFIRM),
@@ -1976,6 +1986,19 @@ print_execve(CPUArchState *cpu_env, const struct syscallname *name,print_syscall_epilogue (name); } +static void +print_execveat (CPUArchState *cpu_env,const struct syscallname *name, +abi_long arg1,abi_long arg2,abi_long arg3, +abi_long arg4,abi_long arg5,abi_long arg6) +{ +print_syscall_prologue (name); +print_at_dirfd (arg1,0 ); +print_string (arg2,0 ); +print_execve_argv (arg3,0 ); +print_flags (execveat_flags, arg5,1 ); +print_syscall_epilogue (name); +} +#if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2) static void print_faccessat(CPUArchState *cpu_env, const struct syscallname *name,
linux-user/strace.list +1 -1
@@ -164,7 +164,7 @@ { TARGET_NR_execve, "execve" , NULL, print_execve, NULL }, #endif #ifdef TARGET_NR_execveat -{ TARGET_NR_execveat, "execveat" , NULL, NULL, NULL }, +{ TARGET_NR_execveat, "execveat" , NULL, print_execveat, NULL }, #endif #ifdef TARGET_NR_exec_with_loader { TARGET_NR_exec_with_loader, "exec_with_loader" , NULL, NULL, NULL },
Signature · 1 line
2.38.1
Re: [PATCH v5 3/5] linux-user/strace: Add output for execveat() syscall
Le 04/11/2022 à 18:36, Philippe Mathieu-Daudé a écrit :
Quoted 11 lines
From: Drew DeVault <[email protected]>
Signed-off-by Drew DeVault <[email protected]>Message-Id: <[email protected]>
Suggested-by Helge Deller <[email protected]>[PMD: Split of bigger patch]Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- linux-user/strace.c | 23 +++++++++++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-)
PATCH v5 4/5 linux-user/syscall: Extract do_execve() from do_syscall1()
In reply to Philippe Mathieu-DaudéFrom: Drew DeVault <[email protected]>
execve() is a particular case of execveat(). In order to add do_execveat(), first factor do_execve() out.
Message-Id: <[email protected]>
--- linux-user/syscall.c | 211 +++++++++++++++++++++++-------------------- 1 file changed, 114 insertions(+), 97 deletions(-)
linux-user/syscall.c +114 -97
@@ -8357,6 +8357,119 @@ static int do_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, intreturn safe_openat (dirfd,path (pathname), flags, mode); } +static int do_execve (CPUArchState *cpu_env, +abi_long pathname,abi_long guest_argp, +abi_long guest_envp) +{ +int ret; +char **argp, **envp; +int argc, envc; +abi_ulong gp; +abi_ulong addr; +char **q; +void *p; + + argc =0 ; + +for (gp = guest_argp; gp; gp +=sizeof (abi_ulong)) { +if (get_user_ual (addr, gp)) { +return -TARGET_EFAULT ; + } +if (!addr) { +break ; + } + argc++; + } + envc =0 ; +for (gp = guest_envp; gp; gp +=sizeof (abi_ulong)) { +if (get_user_ual (addr, gp)) { +return -TARGET_EFAULT ; + } +if (!addr) { +break ; + } + envc++; + } + + argp = g_new0(char *, argc + 1); + envp = g_new0(char *, envc + 1); + +for (gp = guest_argp, q = argp; gp; gp +=sizeof (abi_ulong), q++) { +if (get_user_ual (addr, gp)) { + goto execve_efault; + } +if (!addr) { +break ; + } + *q =lock_user_string (addr); +if (!*q) { + goto execve_efault; + } + } + *q =NULL ; + +for (gp = guest_envp, q = envp; gp; gp +=sizeof (abi_ulong), q++) { +if (get_user_ual (addr, gp)) { + goto execve_efault; + } +if (!addr) { +break ; + } + *q =lock_user_string (addr); +if (!*q) { + goto execve_efault; + } + } + *q =NULL ; + +/* +* Although execve() is not an interruptible syscall it is +* a special case where we must use the safe_syscall wrapper: +* if we allow a signal to happen before we make the host +* syscall then we will 'lose' it, because at the point of +* execve the process leaves QEMU's control. So we use the +* safe syscall wrapper to ensure that we either take the +* signal as a guest signal, or else it does not happen +* before the execve completes and makes it the other +* program's problem. +*/ + p =lock_user_string (pathname); +if (!p) { + goto execve_efault; + } + +if (is_proc_myself (p,"exe" )) { + ret =get_errno (safe_execve (exec_path, argp, envp)); + }else { + ret =get_errno (safe_execve (p, argp, envp)); + } + +unlock_user (p, pathname,0 ); + + goto execve_end; + +execve_efault: + ret = -TARGET_EFAULT ; + +execve_end: +for (gp = guest_argp, q = argp; *q; gp +=sizeof (abi_ulong), q++) { +if (get_user_ual (addr, gp) || !addr) { +break ; + } +unlock_user (*q, addr,0 ); + } +for (gp = guest_envp, q = envp; *q; gp +=sizeof (abi_ulong), q++) { +if (get_user_ual (addr, gp) || !addr) { +break ; + } +unlock_user (*q, addr,0 ); + } + +g_free (argp); +g_free (envp); +return ret; +} +#define TIMER_MAGIC 0x0caf0000#define TIMER_MAGIC_MASK 0xffff0000
@@ -8867,103 +8980,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,return ret;#endif case TARGET_NR_execve: - { -char **argp, **envp; -int argc, envc; -abi_ulong gp; -abi_ulong guest_argp; -abi_ulong guest_envp; -abi_ulong addr; -char **q; - - argc =0 ; - guest_argp = arg2; -for (gp = guest_argp; gp; gp +=sizeof (abi_ulong)) { -if (get_user_ual (addr, gp)) -return -TARGET_EFAULT ; -if (!addr) -break ; - argc++; - } - envc =0 ; - guest_envp = arg3; -for (gp = guest_envp; gp; gp +=sizeof (abi_ulong)) { -if (get_user_ual (addr, gp)) -return -TARGET_EFAULT ; -if (!addr) -break ; - envc++; - } - - argp = g_new0(char *, argc + 1); - envp = g_new0(char *, envc + 1); - -for (gp = guest_argp, q = argp; gp; - gp +=sizeof (abi_ulong), q++) { -if (get_user_ual (addr, gp)) - goto execve_efault; -if (!addr) -break ; -if (!(*q =lock_user_string (addr))) - goto execve_efault; - } - *q =NULL ; - -for (gp = guest_envp, q = envp; gp; - gp +=sizeof (abi_ulong), q++) { -if (get_user_ual (addr, gp)) - goto execve_efault; -if (!addr) -break ; -if (!(*q =lock_user_string (addr))) - goto execve_efault; - } - *q =NULL ; - -if (!(p =lock_user_string (arg1))) - goto execve_efault; -/* Although execve() is not an interruptible syscall it is -* a special case where we must use the safe_syscall wrapper: -* if we allow a signal to happen before we make the host -* syscall then we will 'lose' it, because at the point of -* execve the process leaves QEMU's control. So we use the -* safe syscall wrapper to ensure that we either take the -* signal as a guest signal, or else it does not happen -* before the execve completes and makes it the other -* program's problem. -*/ -if (is_proc_myself (p,"exe" )) { - ret =get_errno (safe_execve (exec_path, argp, envp)); - }else { - ret =get_errno (safe_execve (p, argp, envp)); - } -unlock_user (p, arg1,0 ); - - goto execve_end; - - execve_efault: - ret = -TARGET_EFAULT ; - - execve_end: -for (gp = guest_argp, q = argp; *q; - gp +=sizeof (abi_ulong), q++) { -if (get_user_ual (addr, gp) - || !addr) -break ; -unlock_user (*q, addr,0 ); - } -for (gp = guest_envp, q = envp; *q; - gp +=sizeof (abi_ulong), q++) { -if (get_user_ual (addr, gp) - || !addr) -break ; -unlock_user (*q, addr,0 ); - } - -g_free (argp); -g_free (envp); - } -return ret; +return do_execve (cpu_env, arg1, arg2, arg3);case TARGET_NR_chdir:if (!(p =lock_user_string (arg1)))return -TARGET_EFAULT ;
Signature · 1 line
2.38.1
Re: [PATCH v5 4/5] linux-user/syscall: Extract do_execve() from do_syscall1()
Le 04/11/2022 à 18:36, Philippe Mathieu-Daudé a écrit :
Quoted 5 lines
From: Drew DeVault <[email protected]>
execve()is a particular case ofexecveat(). In order to adddo_execveat(), first factordo_execve()out.
Quoted 8 lines
Signed-off-by Drew DeVault <[email protected]>Message-Id: <[email protected]>
[PMD: Split of bigger patch, filled description, fixed style]Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- linux-user/syscall.c | 211 +++++++++++++++++++++++-------------------- 1 file changed, 114 insertions(+), 97 deletions(-)
PATCH v5 5/5 linux-user/syscall: Implement execveat()
In reply to Philippe Mathieu-DaudéFrom: Drew DeVault <[email protected]>
References: https://gitlab.com/qemu-project/qemu/-/issues/1007
Message-Id: <[email protected]>
--- linux-user/syscall.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
linux-user/syscall.c +9 -6
@@ -696,7 +696,8 @@ safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \#endif safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop, \ int, options, struct rusage *, rusage) -safe_syscall3(int, execve, const char *, filename, char **, argv, char **, envp) +safe_syscall5(int, execveat, int, dirfd, const char *, filename, + char **, argv, char **, envp, int, flags)#if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \ defined(TARGET_NR_pselect6) || defined(TARGET_NR_pselect6_time64) safe_syscall6(int, pselect6, int, nfds, fd_set *, readfds, fd_set *, writefds, \
@@ -8357,9 +8358,9 @@ static int do_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, intreturn safe_openat (dirfd,path (pathname), flags, mode); } -static int do_execve (CPUArchState *cpu_env, +static int do_execveat (CPUArchState *cpu_env,int dirfd,abi_long pathname,abi_long guest_argp, -abi_long guest_envp) +abi_long guest_envp,int flags) {int ret;char **argp, **envp;
@@ -8439,9 +8440,9 @@ static int do_execve(CPUArchState *cpu_env, }if (is_proc_myself (p,"exe" )) { - ret =get_errno (safe_execve (exec_path, argp, envp)); + ret =get_errno (safe_execveat (dirfd, exec_path, argp, envp, flags)); }else { - ret =get_errno (safe_execve (p, argp, envp)); + ret =get_errno (safe_execveat (dirfd, p, argp, envp, flags)); }unlock_user (p, pathname,0 );
@@ -8979,8 +8980,10 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,unlock_user (p, arg2,0 );return ret;#endif +case TARGET_NR_execveat: +return do_execveat (cpu_env, arg1, arg2, arg3, arg4, arg5);case TARGET_NR_execve: -return do_execve (cpu_env, arg1, arg2, arg3); +return do_execveat (cpu_env,AT_FDCWD , arg1, arg2, arg3,0 );case TARGET_NR_chdir:if (!(p =lock_user_string (arg1)))return -TARGET_EFAULT ;
Signature · 1 line
2.38.1
Laurent Vivier
AppliedLe 04/11/2022 à 18:36, Philippe Mathieu-Daudé a écrit :
Quoted 15 lines
As I was reviewing this patch from Drew:
https://lore.kernel.org/qemu-devel/[email protected]/
and it was too big for my review standards, I split it into smaller steps. Since the result can help the other reviewers, post it.Since v4:
- Constify struct flags
- Split Drew's patch in 4Drew DeVault (4):
linux-user/strace: Extractprint_execve_argv()fromprint_execve()linux-user/strace: Add output forexecveat()syscall linux-user/syscall: Extractdo_execve()fromdo_syscall1()linux-user/syscall: Implementexecveat()
Quoted 8 lines
Philippe Mathieu-Daudé (1):
linux-user/strace: Constify struct flagslinux-user/strace.c | 134 +++++++++++++++---------- linux-user/strace.list | 2 +- linux-user/syscall.c | 216 ++++++++++++++++++++++------------------- 3 files changed, 201 insertions(+), 151 deletions(-)
Applied to my linux-user-for-8.0 branch.
Thanks,
Laurent
Quoted 1 line · Laurent Vivier
Applied to my linux-user-for-8.0 branch.
Thanks!