Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[qemu-usermode] make sure scratchbox2 can hook fcntl(64). JB#48738
- Loading branch information
Showing
2 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
136 changes: 136 additions & 0 deletions
136
rpm/0017-Revert-linux-user-Use-safe_syscall-wrapper-for-fcntl.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
From 4a3009c3e98c7c67cf3ba1aacca8a533f0b960e0 Mon Sep 17 00:00:00 2001 | ||
From: Frajo Haider <f_haider@gmx.at> | ||
Date: Wed, 29 Jan 2020 12:42:08 +0000 | ||
Subject: [PATCH 17/17] Revert "linux-user: Use safe_syscall wrapper for fcntl" | ||
|
||
This reverts commit 435da5e7092aa54e12044b9401b42c4a9333c74d. | ||
|
||
Conflicts: | ||
linux-user/syscall.c | ||
slirp | ||
--- | ||
linux-user/syscall.c | 36 ++++++++++++------------------------ | ||
1 file changed, 12 insertions(+), 24 deletions(-) | ||
|
||
diff --git a/linux-user/syscall.c b/linux-user/syscall.c | ||
index 26c80f6..859cce2 100644 | ||
--- a/linux-user/syscall.c | ||
+++ b/linux-user/syscall.c | ||
@@ -808,16 +808,6 @@ safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr, | ||
* 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) | ||
{ | ||
@@ -6223,7 +6213,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); | ||
} | ||
@@ -6235,7 +6225,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: | ||
@@ -6243,7 +6233,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); | ||
} | ||
@@ -6254,25 +6244,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; | ||
@@ -6290,7 +6278,7 @@ 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 | ||
|
||
@@ -6302,11 +6290,11 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) | ||
case TARGET_F_GETLEASE: | ||
case TARGET_F_SETPIPE_SZ: | ||
case TARGET_F_GETPIPE_SZ: | ||
- 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; | ||
@@ -11070,7 +11058,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); | ||
} | ||
@@ -11082,7 +11070,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); | ||
-- | ||
1.8.3-rc3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters