summarylogtreecommitdiffstats
path: root/0008-Revert-linux-user-Use-safe_syscall-wrapper-for-fcntl.patch
blob: a1defa6f5f02ea2695d2c768b42cf4dcfd7fe99d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
From 0000000000000000000000000000000000000000 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] 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);