From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Frajo Haider Date: Wed, 29 Jan 2020 12:42:08 +0000 Subject: [PATCH] Revert "linux-user: Use safe_syscall wrapper for fcntl" This reverts commit 435da5e7092aa54e12044b9401b42c4a9333c74d. Conflicts: linux-user/syscall.c slirp --- linux-user/syscall.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 925c6111a59832300dd1fc93cef06e7bedce5c64..847fa04b71ac2a94343539adb97d77d2b2e38661 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -732,16 +732,6 @@ safe_syscall6(ssize_t, copy_file_range, int, infd, loff_t *, pinoff, * the libc function. */ #define safe_ioctl(...) safe_syscall(__NR_ioctl, __VA_ARGS__) -/* Similarly for fcntl. Note that callers must always: - * pass the F_GETLK64 etc constants rather than the unsuffixed F_GETLK - * use the flock64 struct rather than unsuffixed flock - * This will then work and use a 64-bit offset for both 32-bit and 64-bit hosts. - */ -#ifdef __NR_fcntl64 -#define safe_fcntl(...) safe_syscall(__NR_fcntl64, __VA_ARGS__) -#else -#define safe_fcntl(...) safe_syscall(__NR_fcntl, __VA_ARGS__) -#endif static inline int host_to_target_sock_type(int host_type) { @@ -7018,7 +7008,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) if (ret) { return ret; } - ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); + ret = get_errno(fcntl(fd, host_cmd, &fl64)); if (ret == 0) { ret = copy_to_user_flock(arg, &fl64); } @@ -7030,7 +7020,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) if (ret) { return ret; } - ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); + ret = get_errno(fcntl(fd, host_cmd, &fl64)); break; case TARGET_F_GETLK64: @@ -7039,7 +7029,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) if (ret) { return ret; } - ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); + ret = get_errno(fcntl(fd, host_cmd, &fl64)); if (ret == 0) { ret = copy_to_user_flock64(arg, &fl64); } @@ -7052,25 +7042,23 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) if (ret) { return ret; } - ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); + ret = get_errno(fcntl(fd, host_cmd, &fl64)); break; case TARGET_F_GETFL: - ret = get_errno(safe_fcntl(fd, host_cmd, arg)); + ret = get_errno(fcntl(fd, host_cmd, arg)); if (ret >= 0) { ret = host_to_target_bitmask(ret, fcntl_flags_tbl); } break; case TARGET_F_SETFL: - ret = get_errno(safe_fcntl(fd, host_cmd, - target_to_host_bitmask(arg, - fcntl_flags_tbl))); + ret = get_errno(fcntl(fd, host_cmd, target_to_host_bitmask(arg, fcntl_flags_tbl))); break; #ifdef F_GETOWN_EX case TARGET_F_GETOWN_EX: - ret = get_errno(safe_fcntl(fd, host_cmd, &fox)); + ret = get_errno(fcntl(fd, host_cmd, &fox)); if (ret >= 0) { if (!lock_user_struct(VERIFY_WRITE, target_fox, arg, 0)) return -TARGET_EFAULT; @@ -7088,16 +7076,16 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) fox.type = tswap32(target_fox->type); fox.pid = tswap32(target_fox->pid); unlock_user_struct(target_fox, arg, 0); - ret = get_errno(safe_fcntl(fd, host_cmd, &fox)); + ret = get_errno(fcntl(fd, host_cmd, &fox)); break; #endif case TARGET_F_SETSIG: - ret = get_errno(safe_fcntl(fd, host_cmd, target_to_host_signal(arg))); + ret = get_errno(fcntl(fd, host_cmd, target_to_host_signal(arg))); break; case TARGET_F_GETSIG: - ret = host_to_target_signal(get_errno(safe_fcntl(fd, host_cmd, arg))); + ret = host_to_target_signal(get_errno(fcntl(fd, host_cmd, arg))); break; case TARGET_F_SETOWN: @@ -7108,11 +7096,11 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) case TARGET_F_GETPIPE_SZ: case TARGET_F_ADD_SEALS: case TARGET_F_GET_SEALS: - ret = get_errno(safe_fcntl(fd, host_cmd, arg)); + ret = get_errno(fcntl(fd, host_cmd, arg)); break; default: - ret = get_errno(safe_fcntl(fd, cmd, arg)); + ret = get_errno(fcntl(fd, cmd, arg)); break; } return ret; @@ -11843,7 +11831,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, if (ret) { break; } - ret = get_errno(safe_fcntl(arg1, cmd, &fl)); + ret = get_errno(fcntl(arg1, cmd, &fl)); if (ret == 0) { ret = copyto(arg3, &fl); } @@ -11855,7 +11843,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, if (ret) { break; } - ret = get_errno(safe_fcntl(arg1, cmd, &fl)); + ret = get_errno(fcntl(arg1, cmd, &fl)); break; default: ret = do_fcntl(arg1, arg2, arg3);