File path.patch of Package qemu
Index: qemu-10.2.0/linux-user/syscall.c
===================================================================
--- qemu-10.2.0.orig/linux-user/syscall.c
+++ qemu-10.2.0/linux-user/syscall.c
@@ -8811,6 +8811,7 @@ static int do_execv(CPUArchState *cpu_en
if (is_proc_myself(p, "exe")) {
exe = exec_path;
}
+ exe = path(exe);
ret = is_execveat
? safe_execveat(dirfd, exe, argp, envp, flags)
: safe_execve(exe, argp, envp);
@@ -10010,7 +10011,7 @@ static abi_long do_syscall1(CPUArchState
if (!(p = lock_user_string(arg2))) {
return -TARGET_EFAULT;
}
- ret = get_errno(faccessat(arg1, p, arg3, 0));
+ ret = get_errno(faccessat(arg1, path(p), arg3, 0));
unlock_user(p, arg2, 0);
return ret;
#endif
@@ -10019,7 +10020,7 @@ static abi_long do_syscall1(CPUArchState
if (!(p = lock_user_string(arg2))) {
return -TARGET_EFAULT;
}
- ret = get_errno(faccessat(arg1, p, arg3, arg4));
+ ret = get_errno(faccessat(arg1, path(p), arg3, arg4));
unlock_user(p, arg2, 0);
return ret;
#endif
@@ -10045,7 +10046,7 @@ static abi_long do_syscall1(CPUArchState
if (!p || !p2)
ret = -TARGET_EFAULT;
else
- ret = get_errno(rename(p, p2));
+ ret = get_errno(rename(path(p), p2));
unlock_user(p2, arg2, 0);
unlock_user(p, arg1, 0);
}
@@ -10060,7 +10061,7 @@ static abi_long do_syscall1(CPUArchState
if (!p || !p2)
ret = -TARGET_EFAULT;
else
- ret = get_errno(renameat(arg1, p, arg3, p2));
+ ret = get_errno(renameat(arg1, path(p), arg3, p2));
unlock_user(p2, arg4, 0);
unlock_user(p, arg2, 0);
}
@@ -10075,7 +10076,7 @@ static abi_long do_syscall1(CPUArchState
if (!p || !p2) {
ret = -TARGET_EFAULT;
} else {
- ret = get_errno(sys_renameat2(arg1, p, arg3, p2, arg5));
+ ret = get_errno(sys_renameat2(arg1, path(p), arg3, p2, arg5));
}
unlock_user(p2, arg4, 0);
unlock_user(p, arg2, 0);
@@ -10086,7 +10087,7 @@ static abi_long do_syscall1(CPUArchState
case TARGET_NR_mkdir:
if (!(p = lock_user_string(arg1)))
return -TARGET_EFAULT;
- ret = get_errno(mkdir(p, arg2));
+ ret = get_errno(mkdir(path(p), arg2));
unlock_user(p, arg1, 0);
return ret;
#endif
@@ -10094,7 +10095,7 @@ static abi_long do_syscall1(CPUArchState
case TARGET_NR_mkdirat:
if (!(p = lock_user_string(arg2)))
return -TARGET_EFAULT;
- ret = get_errno(mkdirat(arg1, p, arg3));
+ ret = get_errno(mkdirat(arg1, path(p), arg3));
unlock_user(p, arg2, 0);
return ret;
#endif
@@ -10102,7 +10103,7 @@ static abi_long do_syscall1(CPUArchState
case TARGET_NR_rmdir:
if (!(p = lock_user_string(arg1)))
return -TARGET_EFAULT;
- ret = get_errno(rmdir(p));
+ ret = get_errno(rmdir(path(p)));
unlock_user(p, arg1, 0);
return ret;
#endif
@@ -10154,7 +10155,7 @@ static abi_long do_syscall1(CPUArchState
case TARGET_NR_umount2:
if (!(p = lock_user_string(arg1)))
return -TARGET_EFAULT;
- ret = get_errno(umount2(p, arg2));
+ ret = get_errno(umount2(path(p), arg2));
unlock_user(p, arg1, 0);
return ret;
#endif
@@ -10171,7 +10172,7 @@ static abi_long do_syscall1(CPUArchState
case TARGET_NR_chroot:
if (!(p = lock_user_string(arg1)))
return -TARGET_EFAULT;
- ret = get_errno(chroot(p));
+ ret = get_errno(chroot(path(p)));
unlock_user(p, arg1, 0);
return ret;
#ifdef TARGET_NR_dup2
@@ -12158,7 +12159,7 @@ static abi_long do_syscall1(CPUArchState
struct target_statx host_stx;
int mask = arg4;
- ret = get_errno(sys_statx(dirfd, p, flags, mask, &host_stx));
+ ret = get_errno(sys_statx(dirfd, path(p), flags, mask, &host_stx));
if (!is_error(ret)) {
if (host_to_target_statx(&host_stx, arg5) != 0) {
unlock_user(p, arg2, 0);