summaryrefslogtreecommitdiff
path: root/pkg/bubblewrap/patch/0004-Revert-Handle-EINTR-when-doing-I-O-on-files-or-socke.patch
blob: f6bfaf5178fcb5760ad173b730878b8fe026e361 (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
From bbe8e2f75800633c251adbb34f7f9a1632a0d22a Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sun, 2 Feb 2025 01:34:54 -0800
Subject: [PATCH] Revert "Handle EINTR when doing I/O on files or sockets"

This reverts commit 0c9646573f140d415cf790310ed17c2ab89f64a3.
---
 bind-mount.c |  2 +-
 bubblewrap.c | 26 +++++++++++++-------------
 network.c    |  6 +++---
 utils.c      | 16 ++++++++--------
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/bind-mount.c b/bind-mount.c
index a2e1ac6..c1aa9ce 100644
--- a/bind-mount.c
+++ b/bind-mount.c
@@ -405,7 +405,7 @@ bind_mount (int           proc_fd,
   if (resolved_dest == NULL)
     return BIND_MOUNT_ERROR_REALPATH_DEST;
 
-  dest_fd = TEMP_FAILURE_RETRY (open (resolved_dest, O_PATH | O_CLOEXEC));
+  dest_fd = open (resolved_dest, O_PATH | O_CLOEXEC);
   if (dest_fd < 0)
     {
       if (failing_path != NULL)
diff --git a/bubblewrap.c b/bubblewrap.c
index bc53891..4848713 100644
--- a/bubblewrap.c
+++ b/bubblewrap.c
@@ -608,7 +608,7 @@ do_init (int event_fd, pid_t initial_pid)
 
   for (lock = lock_files; lock != NULL; lock = lock->next)
     {
-      int fd = TEMP_FAILURE_RETRY (open (lock->path, O_RDONLY | O_CLOEXEC));
+      int fd = open (lock->path, O_RDONLY | O_CLOEXEC);
       if (fd == -1)
         die_with_error ("Unable to open lock file %s", lock->path);
 
@@ -619,7 +619,7 @@ do_init (int event_fd, pid_t initial_pid)
         .l_len = 0
       };
 
-      if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &l)) < 0)
+      if (fcntl (fd, F_SETLK, &l) < 0)
         die_with_error ("Unable to lock file %s", lock->path);
 
       /* Keep fd open to hang on to lock */
@@ -636,7 +636,7 @@ do_init (int event_fd, pid_t initial_pid)
       pid_t child;
       int status;
 
-      child = TEMP_FAILURE_RETRY (wait (&status));
+      child = wait (&status);
       if (child == initial_pid)
         {
           initial_exit_status = propagate_exit_status (status);
@@ -647,7 +647,7 @@ do_init (int event_fd, pid_t initial_pid)
               int res UNUSED;
 
               val = initial_exit_status + 1;
-              res = TEMP_FAILURE_RETRY (write (event_fd, &val, 8));
+              res = write (event_fd, &val, 8);
               /* Ignore res, if e.g. the parent died and closed event_fd
                  we don't want to error out here */
             }
@@ -1071,10 +1071,10 @@ privileged_op (int         privileged_op_socket,
       if (arg2 != NULL)
         strcpy ((char *) buffer + arg2_offset, arg2);
 
-      if (TEMP_FAILURE_RETRY (write (privileged_op_socket, buffer, buffer_size)) != (ssize_t)buffer_size)
+      if (write (privileged_op_socket, buffer, buffer_size) != (ssize_t)buffer_size)
         die ("Can't write to privileged_op_socket");
 
-      if (TEMP_FAILURE_RETRY (read (privileged_op_socket, buffer, 1)) != 1)
+      if (read (privileged_op_socket, buffer, 1) != 1)
         die ("Can't read from privileged_op_socket");
 
       return;
@@ -2824,7 +2824,7 @@ namespace_ids_read (pid_t  pid)
   NsInfo *info;
 
   dir = xasprintf ("%d/ns", pid);
-  ns_fd = TEMP_FAILURE_RETRY (openat (proc_fd, dir, O_PATH));
+  ns_fd = openat (proc_fd, dir, O_PATH);
 
   if (ns_fd < 0)
     die_with_error ("open /proc/%s/ns failed", dir);
@@ -3046,7 +3046,7 @@ main (int    argc,
 
   /* We need to read stuff from proc during the pivot_root dance, etc.
      Lets keep a fd to it open */
-  proc_fd = TEMP_FAILURE_RETRY (open ("/proc", O_PATH));
+  proc_fd = open ("/proc", O_PATH);
   if (proc_fd == -1)
     die_with_error ("Can't open /proc");
 
@@ -3213,7 +3213,7 @@ main (int    argc,
 
       /* Let child run now that the uid maps are set up */
       val = 1;
-      res = TEMP_FAILURE_RETRY (write (child_wait_fd, &val, 8));
+      res = write (child_wait_fd, &val, 8);
       /* Ignore res, if e.g. the child died and closed child_wait_fd we don't want to error out here */
       close (child_wait_fd);
 
@@ -3393,12 +3393,12 @@ main (int    argc,
               op = read_priv_sec_op (unpriv_socket, buffer, sizeof (buffer),
                                      &flags, &perms, &size_arg, &arg1, &arg2);
               privileged_op (-1, op, flags, perms, size_arg, arg1, arg2);
-              if (TEMP_FAILURE_RETRY (write (unpriv_socket, buffer, 1)) != 1)
+              if (write (unpriv_socket, buffer, 1) != 1)
                 die ("Can't write to op_socket");
             }
           while (op != PRIV_SEP_OP_DONE);
 
-          TEMP_FAILURE_RETRY (waitpid (child, &status, 0));
+          waitpid (child, &status, 0);
           /* Continue post setup */
         }
     }
@@ -3422,7 +3422,7 @@ main (int    argc,
    * We're aiming to make /newroot the real root, and get rid of /oldroot. To do
    * that we need a temporary place to store it before we can unmount it.
    */
-  { cleanup_fd int oldrootfd = TEMP_FAILURE_RETRY (open ("/", O_DIRECTORY | O_RDONLY));
+  { cleanup_fd int oldrootfd = open ("/", O_DIRECTORY | O_RDONLY);
     if (oldrootfd < 0)
       die_with_error ("can't open /");
     if (chdir ("/newroot") != 0)
@@ -3470,7 +3470,7 @@ main (int    argc,
         {
           cleanup_fd int sysctl_fd = -1;
 
-          sysctl_fd = TEMP_FAILURE_RETRY (openat (proc_fd, "sys/user/max_user_namespaces", O_WRONLY));
+          sysctl_fd = openat (proc_fd, "sys/user/max_user_namespaces", O_WRONLY);
 
           if (sysctl_fd < 0)
             die_with_error ("cannot open /proc/sys/user/max_user_namespaces");
diff --git a/network.c b/network.c
index 373d606..f6d58a6 100644
--- a/network.c
+++ b/network.c
@@ -53,8 +53,8 @@ rtnl_send_request (int              rtnl_fd,
   struct sockaddr_nl dst_addr = { AF_NETLINK, 0 };
   ssize_t sent;
 
-  sent = TEMP_FAILURE_RETRY (sendto (rtnl_fd, (void *) header, header->nlmsg_len, 0,
-                                     (struct sockaddr *) &dst_addr, sizeof (dst_addr)));
+  sent = sendto (rtnl_fd, (void *) header, header->nlmsg_len, 0,
+                 (struct sockaddr *) &dst_addr, sizeof (dst_addr));
   if (sent < 0)
     return -1;
 
@@ -71,7 +71,7 @@ rtnl_read_reply (int          rtnl_fd,
 
   while (1)
     {
-      received = TEMP_FAILURE_RETRY (recv (rtnl_fd, buffer, sizeof (buffer), 0));
+      received = recv (rtnl_fd, buffer, sizeof (buffer), 0);
       if (received < 0)
         return -1;
 
diff --git a/utils.c b/utils.c
index 8ab89bb..ffe0a0d 100644
--- a/utils.c
+++ b/utils.c
@@ -378,7 +378,7 @@ fdwalk (int proc_fd, int (*cb)(void *data,
   int res = 0;
   DIR *d;
 
-  dfd = TEMP_FAILURE_RETRY (openat (proc_fd, "self/fd", O_DIRECTORY | O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOCTTY));
+  dfd = openat (proc_fd, "self/fd", O_DIRECTORY | O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOCTTY);
   if (dfd == -1)
     return res;
 
@@ -460,7 +460,7 @@ write_file_at (int         dfd,
   bool res;
   int errsv;
 
-  fd = TEMP_FAILURE_RETRY (openat (dfd, path, O_RDWR | O_CLOEXEC, 0));
+  fd = openat (dfd, path, O_RDWR | O_CLOEXEC, 0);
   if (fd == -1)
     return -1;
 
@@ -485,7 +485,7 @@ create_file (const char *path,
   int res;
   int errsv;
 
-  fd = TEMP_FAILURE_RETRY (creat (path, mode));
+  fd = creat (path, mode);
   if (fd == -1)
     return -1;
 
@@ -566,11 +566,11 @@ copy_file (const char *src_path,
   int res;
   int errsv;
 
-  sfd = TEMP_FAILURE_RETRY (open (src_path, O_CLOEXEC | O_RDONLY));
+  sfd = open (src_path, O_CLOEXEC | O_RDONLY);
   if (sfd == -1)
     return -1;
 
-  dfd = TEMP_FAILURE_RETRY (creat (dst_path, mode));
+  dfd = creat (dst_path, mode);
   if (dfd == -1)
     {
       errsv = errno;
@@ -647,7 +647,7 @@ load_file_at (int         dfd,
   char *data;
   int errsv;
 
-  fd = TEMP_FAILURE_RETRY (openat (dfd, path, O_CLOEXEC | O_RDONLY));
+  fd = openat (dfd, path, O_CLOEXEC | O_RDONLY);
   if (fd == -1)
     return NULL;
 
@@ -777,7 +777,7 @@ send_pid_on_socket (int sockfd)
   cred.gid = getegid ();
   memcpy (CMSG_DATA (cmsg), &cred, sizeof (cred));
 
-  if (TEMP_FAILURE_RETRY (sendmsg (sockfd, &msg, 0)) < 0)
+  if (sendmsg (sockfd, &msg, 0) < 0)
     die_with_error ("Can't send pid");
 }
 
@@ -807,7 +807,7 @@ read_pid_from_socket (int sockfd)
   msg.msg_control = control_buf_rcv;
   msg.msg_controllen = sizeof (control_buf_rcv);
 
-  if (TEMP_FAILURE_RETRY (recvmsg (sockfd, &msg, 0)) < 0)
+  if (recvmsg (sockfd, &msg, 0) < 0)
     die_with_error ("Can't read pid from socket");
 
   if (msg.msg_controllen <= 0)
-- 
2.44.0