polyphony 0.98 → 0.99

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/examples/io/https_server_sni_2.rb +14 -8
  4. data/ext/polyphony/extconf.rb +6 -5
  5. data/ext/polyphony/libev.h +0 -2
  6. data/lib/polyphony/core/sync.rb +53 -0
  7. data/lib/polyphony/extensions/io.rb +37 -14
  8. data/lib/polyphony/extensions/openssl.rb +1 -1
  9. data/lib/polyphony/version.rb +1 -1
  10. data/test/test_io.rb +6 -7
  11. data/test/test_socket.rb +61 -0
  12. data/test/test_sync.rb +42 -1
  13. data/vendor/liburing/.github/workflows/build.yml +7 -16
  14. data/vendor/liburing/.gitignore +5 -0
  15. data/vendor/liburing/CHANGELOG +23 -1
  16. data/vendor/liburing/Makefile +4 -3
  17. data/vendor/liburing/Makefile.common +1 -0
  18. data/vendor/liburing/README +48 -0
  19. data/vendor/liburing/configure +76 -6
  20. data/vendor/liburing/debian/changelog +11 -0
  21. data/vendor/liburing/debian/control +7 -16
  22. data/vendor/liburing/debian/liburing-dev.manpages +3 -6
  23. data/vendor/liburing/debian/liburing2.install +1 -0
  24. data/vendor/liburing/debian/liburing2.symbols +56 -0
  25. data/vendor/liburing/debian/rules +15 -68
  26. data/vendor/liburing/examples/Makefile +4 -0
  27. data/vendor/liburing/examples/io_uring-close-test.c +123 -0
  28. data/vendor/liburing/examples/io_uring-udp.c +1 -1
  29. data/vendor/liburing/examples/send-zerocopy.c +315 -56
  30. data/vendor/liburing/examples/ucontext-cp.c +2 -17
  31. data/vendor/liburing/liburing-ffi.pc.in +12 -0
  32. data/vendor/liburing/liburing.pc.in +1 -1
  33. data/vendor/liburing/liburing.spec +1 -1
  34. data/vendor/liburing/make-debs.sh +3 -3
  35. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +1 -0
  36. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +1 -0
  37. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +1 -0
  38. data/vendor/liburing/man/io_uring_buf_ring_add.3 +6 -6
  39. data/vendor/liburing/man/io_uring_check_version.3 +72 -0
  40. data/vendor/liburing/man/io_uring_close_ring_fd.3 +43 -0
  41. data/vendor/liburing/man/io_uring_major_version.3 +1 -0
  42. data/vendor/liburing/man/io_uring_minor_version.3 +1 -0
  43. data/vendor/liburing/man/io_uring_prep_accept.3 +1 -1
  44. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +1 -0
  45. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +1 -0
  46. data/vendor/liburing/man/io_uring_prep_getxattr.3 +61 -0
  47. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +94 -0
  48. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +22 -2
  49. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +1 -0
  50. data/vendor/liburing/man/io_uring_prep_poll_add.3 +1 -1
  51. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +18 -9
  52. data/vendor/liburing/man/io_uring_prep_readv.3 +3 -3
  53. data/vendor/liburing/man/io_uring_prep_readv2.3 +3 -3
  54. data/vendor/liburing/man/io_uring_prep_recv.3 +5 -5
  55. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +4 -4
  56. data/vendor/liburing/man/io_uring_prep_send.3 +9 -0
  57. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +38 -0
  58. data/vendor/liburing/man/io_uring_prep_send_zc.3 +39 -7
  59. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +1 -0
  60. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +20 -0
  61. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +1 -0
  62. data/vendor/liburing/man/io_uring_prep_setxattr.3 +64 -0
  63. data/vendor/liburing/man/io_uring_prep_splice.3 +40 -0
  64. data/vendor/liburing/man/io_uring_prep_writev.3 +2 -2
  65. data/vendor/liburing/man/io_uring_prep_writev2.3 +2 -2
  66. data/vendor/liburing/man/io_uring_recvmsg_out.3 +13 -9
  67. data/vendor/liburing/man/io_uring_register.2 +15 -9
  68. data/vendor/liburing/man/io_uring_register_buf_ring.3 +4 -4
  69. data/vendor/liburing/man/io_uring_register_buffers.3 +49 -6
  70. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +1 -0
  71. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +1 -0
  72. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +1 -0
  73. data/vendor/liburing/man/io_uring_register_files.3 +60 -5
  74. data/vendor/liburing/man/io_uring_register_files_tags.3 +1 -0
  75. data/vendor/liburing/man/io_uring_register_files_update.3 +1 -0
  76. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +1 -0
  77. data/vendor/liburing/man/io_uring_setup.2 +31 -2
  78. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +1 -1
  79. data/vendor/liburing/src/Makefile +25 -3
  80. data/vendor/liburing/src/ffi.c +15 -0
  81. data/vendor/liburing/src/include/liburing/io_uring.h +30 -7
  82. data/vendor/liburing/src/include/liburing.h +190 -148
  83. data/vendor/liburing/src/int_flags.h +1 -0
  84. data/vendor/liburing/src/lib.h +5 -16
  85. data/vendor/liburing/src/liburing-ffi.map +172 -0
  86. data/vendor/liburing/src/liburing.map +11 -0
  87. data/vendor/liburing/src/nolibc.c +9 -2
  88. data/vendor/liburing/src/queue.c +2 -2
  89. data/vendor/liburing/src/register.c +66 -96
  90. data/vendor/liburing/src/setup.c +5 -4
  91. data/vendor/liburing/src/version.c +21 -0
  92. data/vendor/liburing/test/232c93d07b74.c +3 -3
  93. data/vendor/liburing/test/35fa71a030ca.c +3 -3
  94. data/vendor/liburing/test/500f9fbadef8.c +2 -0
  95. data/vendor/liburing/test/917257daa0fe.c +1 -1
  96. data/vendor/liburing/test/Makefile +27 -7
  97. data/vendor/liburing/test/a0908ae19763.c +2 -2
  98. data/vendor/liburing/test/a4c0b3decb33.c +2 -2
  99. data/vendor/liburing/test/accept-link.c +4 -4
  100. data/vendor/liburing/test/accept-reuse.c +5 -7
  101. data/vendor/liburing/test/accept.c +34 -31
  102. data/vendor/liburing/test/b19062a56726.c +1 -1
  103. data/vendor/liburing/test/buf-ring.c +58 -4
  104. data/vendor/liburing/test/ce593a6c480a.c +2 -2
  105. data/vendor/liburing/test/close-opath.c +2 -1
  106. data/vendor/liburing/test/connect.c +8 -0
  107. data/vendor/liburing/test/cq-overflow.c +14 -8
  108. data/vendor/liburing/test/d4ae271dfaae.c +1 -1
  109. data/vendor/liburing/test/defer-taskrun.c +64 -9
  110. data/vendor/liburing/test/defer.c +1 -1
  111. data/vendor/liburing/test/double-poll-crash.c +3 -3
  112. data/vendor/liburing/test/eeed8b54e0df.c +8 -3
  113. data/vendor/liburing/test/eploop.c +74 -0
  114. data/vendor/liburing/test/eventfd-ring.c +1 -1
  115. data/vendor/liburing/test/eventfd.c +1 -1
  116. data/vendor/liburing/test/evloop.c +73 -0
  117. data/vendor/liburing/test/exit-no-cleanup.c +1 -1
  118. data/vendor/liburing/test/fadvise.c +1 -1
  119. data/vendor/liburing/test/fc2a85cb02ef.c +3 -3
  120. data/vendor/liburing/test/fd-pass.c +35 -16
  121. data/vendor/liburing/test/file-register.c +61 -0
  122. data/vendor/liburing/test/file-verify.c +2 -2
  123. data/vendor/liburing/test/files-exit-hang-timeout.c +2 -2
  124. data/vendor/liburing/test/fixed-link.c +1 -1
  125. data/vendor/liburing/test/fsnotify.c +118 -0
  126. data/vendor/liburing/test/hardlink.c +1 -1
  127. data/vendor/liburing/test/helpers.c +54 -2
  128. data/vendor/liburing/test/helpers.h +4 -0
  129. data/vendor/liburing/test/io-cancel.c +3 -1
  130. data/vendor/liburing/test/io_uring_passthrough.c +39 -8
  131. data/vendor/liburing/test/io_uring_setup.c +3 -80
  132. data/vendor/liburing/test/iopoll-overflow.c +118 -0
  133. data/vendor/liburing/test/iopoll.c +90 -4
  134. data/vendor/liburing/test/lfs-openat-write.c +7 -9
  135. data/vendor/liburing/test/lfs-openat.c +6 -8
  136. data/vendor/liburing/test/link_drain.c +31 -5
  137. data/vendor/liburing/test/madvise.c +1 -1
  138. data/vendor/liburing/test/msg-ring-flags.c +192 -0
  139. data/vendor/liburing/test/msg-ring-overflow.c +159 -0
  140. data/vendor/liburing/test/msg-ring.c +173 -13
  141. data/vendor/liburing/test/multicqes_drain.c +22 -19
  142. data/vendor/liburing/test/nvme.h +4 -3
  143. data/vendor/liburing/test/pipe-bug.c +95 -0
  144. data/vendor/liburing/test/poll-link.c +3 -3
  145. data/vendor/liburing/test/poll-many.c +41 -19
  146. data/vendor/liburing/test/poll-mshot-overflow.c +105 -2
  147. data/vendor/liburing/test/poll-race-mshot.c +292 -0
  148. data/vendor/liburing/test/poll-race.c +105 -0
  149. data/vendor/liburing/test/poll.c +244 -26
  150. data/vendor/liburing/test/pollfree.c +5 -5
  151. data/vendor/liburing/test/read-before-exit.c +20 -3
  152. data/vendor/liburing/test/read-write.c +2 -0
  153. data/vendor/liburing/test/recv-multishot.c +96 -3
  154. data/vendor/liburing/test/reg-reg-ring.c +90 -0
  155. data/vendor/liburing/test/rename.c +1 -1
  156. data/vendor/liburing/test/ring-leak.c +0 -1
  157. data/vendor/liburing/test/ring-leak2.c +1 -1
  158. data/vendor/liburing/test/ringbuf-read.c +10 -6
  159. data/vendor/liburing/test/send-zerocopy.c +273 -103
  160. data/vendor/liburing/test/send_recv.c +7 -4
  161. data/vendor/liburing/test/sendmsg_fs_cve.c +2 -2
  162. data/vendor/liburing/test/single-issuer.c +7 -9
  163. data/vendor/liburing/test/skip-cqe.c +3 -4
  164. data/vendor/liburing/test/socket.c +0 -1
  165. data/vendor/liburing/test/sq-poll-dup.c +10 -3
  166. data/vendor/liburing/test/sq-poll-kthread.c +1 -1
  167. data/vendor/liburing/test/sq-poll-share.c +3 -2
  168. data/vendor/liburing/test/sqpoll-cancel-hang.c +17 -6
  169. data/vendor/liburing/test/sqpoll-disable-exit.c +4 -4
  170. data/vendor/liburing/test/symlink.c +2 -1
  171. data/vendor/liburing/test/test.h +2 -1
  172. data/vendor/liburing/test/timeout-new.c +11 -7
  173. data/vendor/liburing/test/timeout.c +1 -2
  174. data/vendor/liburing/test/unlink.c +1 -1
  175. data/vendor/liburing/test/version.c +25 -0
  176. data/vendor/liburing/test/wakeup-hang.c +1 -1
  177. data/vendor/liburing/test/xattr.c +8 -4
  178. metadata +42 -6
  179. data/vendor/liburing/debian/compat +0 -1
  180. data/vendor/liburing/debian/liburing1-udeb.install +0 -1
  181. data/vendor/liburing/debian/liburing1.install +0 -1
  182. data/vendor/liburing/debian/liburing1.symbols +0 -32
@@ -192,13 +192,13 @@ static int do_send(void)
192
192
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
193
193
  if (sockfd < 0) {
194
194
  perror("socket");
195
- return 1;
195
+ goto err2;
196
196
  }
197
197
 
198
198
  ret = connect(sockfd, (struct sockaddr *)&saddr, sizeof(saddr));
199
199
  if (ret < 0) {
200
200
  perror("connect");
201
- return 1;
201
+ goto err;
202
202
  }
203
203
 
204
204
  sqe = io_uring_get_sqe(&ring);
@@ -214,8 +214,7 @@ static int do_send(void)
214
214
  ret = io_uring_wait_cqe(&ring, &cqe);
215
215
  if (cqe->res == -EINVAL) {
216
216
  fprintf(stdout, "send not supported, skipping\n");
217
- close(sockfd);
218
- return 0;
217
+ goto err;
219
218
  }
220
219
  if (cqe->res != iov.iov_len) {
221
220
  fprintf(stderr, "failed cqe: %d\n", cqe->res);
@@ -223,9 +222,13 @@ static int do_send(void)
223
222
  }
224
223
 
225
224
  close(sockfd);
225
+ io_uring_queue_exit(&ring);
226
226
  return 0;
227
+
227
228
  err:
228
229
  close(sockfd);
230
+ err2:
231
+ io_uring_queue_exit(&ring);
229
232
  return 1;
230
233
  }
231
234
 
@@ -1,4 +1,4 @@
1
- /* SPDX-License-Identifier: MIT */
1
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
2
2
  /*
3
3
  * repro-CVE-2020-29373 -- Reproducer for CVE-2020-29373.
4
4
  *
@@ -16,7 +16,7 @@
16
16
  * GNU General Public License for more details.
17
17
  *
18
18
  * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
19
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
21
 
22
22
  #include <unistd.h>
@@ -5,7 +5,6 @@
5
5
  #include <stdlib.h>
6
6
  #include <string.h>
7
7
  #include <fcntl.h>
8
- #include <error.h>
9
8
  #include <sys/types.h>
10
9
  #include <sys/wait.h>
11
10
 
@@ -56,13 +55,13 @@ static int try_submit(struct io_uring *ring)
56
55
  return ret;
57
56
 
58
57
  if (ret != 1)
59
- error(1, ret, "submit %i", ret);
58
+ t_error(1, ret, "submit %i", ret);
60
59
  ret = io_uring_wait_cqe(ring, &cqe);
61
60
  if (ret)
62
- error(1, ret, "wait fail %i", ret);
61
+ t_error(1, ret, "wait fail %i", ret);
63
62
 
64
63
  if (cqe->res || cqe->user_data != 42)
65
- error(1, ret, "invalid cqe");
64
+ t_error(1, ret, "invalid cqe");
66
65
 
67
66
  io_uring_cqe_seen(ring, cqe);
68
67
  return 0;
@@ -78,7 +77,6 @@ int main(int argc, char *argv[])
78
77
 
79
78
  ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER);
80
79
  if (ret == -EINVAL) {
81
- fprintf(stderr, "SETUP_SINGLE_ISSUER is not supported, skip\n");
82
80
  return T_EXIT_SKIP;
83
81
  } else if (ret) {
84
82
  fprintf(stderr, "io_uring_queue_init() failed %i\n", ret);
@@ -106,7 +104,7 @@ int main(int argc, char *argv[])
106
104
  ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
107
105
  IORING_SETUP_R_DISABLED);
108
106
  if (ret)
109
- error(1, ret, "ring init (2) %i", ret);
107
+ t_error(1, ret, "ring init (2) %i", ret);
110
108
 
111
109
  if (!fork_t()) {
112
110
  io_uring_enable_rings(&ring);
@@ -122,7 +120,7 @@ int main(int argc, char *argv[])
122
120
  ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
123
121
  IORING_SETUP_R_DISABLED);
124
122
  if (ret)
125
- error(1, ret, "ring init (3) %i", ret);
123
+ t_error(1, ret, "ring init (3) %i", ret);
126
124
 
127
125
  io_uring_enable_rings(&ring);
128
126
  if (!fork_t()) {
@@ -137,7 +135,7 @@ int main(int argc, char *argv[])
137
135
  /* test that anyone can submit to a SQPOLL|SINGLE_ISSUER ring */
138
136
  ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_SQPOLL);
139
137
  if (ret)
140
- error(1, ret, "ring init (4) %i", ret);
138
+ t_error(1, ret, "ring init (4) %i", ret);
141
139
 
142
140
  ret = try_submit(&ring);
143
141
  if (ret) {
@@ -157,7 +155,7 @@ int main(int argc, char *argv[])
157
155
  /* test that IORING_ENTER_REGISTERED_RING doesn't break anything */
158
156
  ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER);
159
157
  if (ret)
160
- error(1, ret, "ring init (5) %i", ret);
158
+ t_error(1, ret, "ring init (5) %i", ret);
161
159
 
162
160
  if (!fork_t()) {
163
161
  ret = try_submit(&ring);
@@ -8,6 +8,7 @@
8
8
  #include <assert.h>
9
9
 
10
10
  #include "liburing.h"
11
+ #include "helpers.h"
11
12
 
12
13
  #define LINK_SIZE 6
13
14
  #define TIMEOUT_USER_DATA (-1)
@@ -323,10 +324,8 @@ int main(int argc, char *argv[])
323
324
  return 1;
324
325
  }
325
326
 
326
- if (!(ring.features & IORING_FEAT_CQE_SKIP)) {
327
- printf("IOSQE_CQE_SKIP_SUCCESS is not supported, skip\n");
328
- return 0;
329
- }
327
+ if (!(ring.features & IORING_FEAT_CQE_SKIP))
328
+ return T_EXIT_SKIP;
330
329
 
331
330
  for (i = 0; i < 4; i++) {
332
331
  bool skip_last = i & 1;
@@ -272,7 +272,6 @@ static int do_send(int socket_direct, int alloc)
272
272
  }
273
273
  if (cqe->res < 0) {
274
274
  if (cqe->res == -EINVAL) {
275
- fprintf(stdout, "No socket support, skipping\n");
276
275
  no_socket = 1;
277
276
  io_uring_cqe_seen(&ring, cqe);
278
277
  return fallback_send(&ring, &saddr);
@@ -171,14 +171,21 @@ int main(int argc, char *argv[])
171
171
  vecs = t_create_buffers(BUFFERS, BS);
172
172
 
173
173
  fd = open(fname, O_RDONLY | O_DIRECT);
174
- if (fname != argv[1])
175
- unlink(fname);
176
-
177
174
  if (fd < 0) {
175
+ int __e = errno;
176
+
177
+ if (fname != argv[1])
178
+ unlink(fname);
179
+
180
+ if (__e == EINVAL)
181
+ return T_EXIT_SKIP;
178
182
  perror("open");
179
183
  return -1;
180
184
  }
181
185
 
186
+ if (fname != argv[1])
187
+ unlink(fname);
188
+
182
189
  ret = test(fd, 0, 0);
183
190
  if (ret) {
184
191
  fprintf(stderr, "test 0 0 failed\n");
@@ -117,7 +117,7 @@ err_pipe:
117
117
  return ret;
118
118
  }
119
119
 
120
- int test_sq_poll_kthread_stopped(bool do_exit)
120
+ static int test_sq_poll_kthread_stopped(bool do_exit)
121
121
  {
122
122
  pid_t pid;
123
123
  int status = 0;
@@ -89,13 +89,14 @@ int main(int argc, char *argv[])
89
89
  vecs = t_create_buffers(BUFFERS, BS);
90
90
 
91
91
  fd = open(fname, O_RDONLY | O_DIRECT);
92
- if (fname != argv[1])
93
- unlink(fname);
94
92
  if (fd < 0) {
95
93
  perror("open");
96
94
  return -1;
97
95
  }
98
96
 
97
+ if (fname != argv[1])
98
+ unlink(fname);
99
+
99
100
  for (i = 0; i < NR_RINGS; i++) {
100
101
  struct io_uring_params p = { };
101
102
 
@@ -9,8 +9,16 @@
9
9
  #include <time.h>
10
10
  #include <unistd.h>
11
11
  #include "liburing.h"
12
+ #include "helpers.h"
12
13
  #include "../src/syscall.h"
13
14
 
15
+ /*
16
+ * This syzbot test is known broken on some archs, just allow the ones that
17
+ * are regularly tested.
18
+ */
19
+ #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
20
+ defined(__aarch64__)
21
+
14
22
  static uint64_t current_time_ms(void)
15
23
  {
16
24
  struct timespec ts;
@@ -39,7 +47,7 @@ static void kill_and_wait(int pid, int* status)
39
47
 
40
48
  #define WAIT_FLAGS __WALL
41
49
 
42
- uint64_t r[3] = {0xffffffffffffffff, 0x0, 0x0};
50
+ static uint64_t r[3] = {0xffffffffffffffff, 0x0, 0x0};
43
51
 
44
52
  static long syz_io_uring_setup(volatile long a0, volatile long a1,
45
53
  volatile long a2, volatile long a3, volatile long a4, volatile long
@@ -92,7 +100,7 @@ SIZEOF_IO_URING_CQE + 63) & ~63;
92
100
  }
93
101
 
94
102
 
95
- void trigger_bug(void)
103
+ static void trigger_bug(void)
96
104
  {
97
105
  intptr_t res = 0;
98
106
  *(uint32_t*)0x20000204 = 0;
@@ -133,7 +141,7 @@ void trigger_bug(void)
133
141
  }
134
142
  int main(void)
135
143
  {
136
- mmap((void *)0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
144
+ mmap((void *)0x20000000ul, 0x1000000ul, 7ul, MAP_ANON|MAP_PRIVATE, -1, 0ul);
137
145
  int pid = fork();
138
146
  if (pid < 0)
139
147
  exit(1);
@@ -152,6 +160,9 @@ int main(void)
152
160
  }
153
161
  return 0;
154
162
  }
155
-
156
-
157
-
163
+ #else
164
+ int main(void)
165
+ {
166
+ return T_EXIT_SKIP;
167
+ }
168
+ #endif
@@ -136,7 +136,7 @@ static void kill_and_wait(int pid, int* status)
136
136
  }
137
137
  }
138
138
 
139
- static void setup_test()
139
+ static void setup_test(void)
140
140
  {
141
141
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
142
142
  setpgrp();
@@ -188,9 +188,9 @@ void execute_one(void)
188
188
  }
189
189
  int main(void)
190
190
  {
191
- mmap((void *)0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
192
- mmap((void *)0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
193
- mmap((void *)0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
191
+ mmap((void *)0x1ffff000ul, 0x1000ul, 0ul, MAP_ANON|MAP_PRIVATE, -1, 0ul);
192
+ mmap((void *)0x20000000ul, 0x1000000ul, 7ul, MAP_ANON|MAP_PRIVATE, -1, 0ul);
193
+ mmap((void *)0x21000000ul, 0x1000ul, 0ul, MAP_ANON|MAP_PRIVATE, -1, 0ul);
194
194
  loop();
195
195
  return 0;
196
196
  }
@@ -43,7 +43,8 @@ err:
43
43
  return 1;
44
44
  }
45
45
 
46
- int test_link_contents(const char* linkname, const char *expected_contents)
46
+ static int test_link_contents(const char* linkname,
47
+ const char *expected_contents)
47
48
  {
48
49
  char buf[128];
49
50
  int ret = readlink(linkname, buf, 127);
@@ -14,7 +14,8 @@ typedef struct io_uring_test_config {
14
14
  const char *description;
15
15
  } io_uring_test_config;
16
16
 
17
- io_uring_test_config io_uring_test_configs[] = {
17
+ __attribute__((__unused__))
18
+ static io_uring_test_config io_uring_test_configs[] = {
18
19
  { 0, "default" },
19
20
  { IORING_SETUP_SQE128, "large SQE"},
20
21
  { IORING_SETUP_CQE32, "large CQE"},
@@ -12,9 +12,9 @@
12
12
  #define TIMEOUT_MSEC 200
13
13
  #define TIMEOUT_SEC 10
14
14
 
15
- int thread_ret0, thread_ret1;
16
- int cnt = 0;
17
- pthread_mutex_t mutex;
15
+ static int thread_ret0, thread_ret1;
16
+ static int cnt = 0;
17
+ static pthread_mutex_t mutex;
18
18
 
19
19
  static void msec_to_ts(struct __kernel_timespec *ts, unsigned int msec)
20
20
  {
@@ -111,7 +111,8 @@ static int test_return_after_timeout(struct io_uring *ring)
111
111
  return 0;
112
112
  }
113
113
 
114
- int __reap_thread_fn(void *data) {
114
+ static int __reap_thread_fn(void *data)
115
+ {
115
116
  struct io_uring *ring = (struct io_uring *)data;
116
117
  struct io_uring_cqe *cqe;
117
118
  struct __kernel_timespec ts;
@@ -123,12 +124,14 @@ int __reap_thread_fn(void *data) {
123
124
  return io_uring_wait_cqe_timeout(ring, &cqe, &ts);
124
125
  }
125
126
 
126
- void *reap_thread_fn0(void *data) {
127
+ static void *reap_thread_fn0(void *data)
128
+ {
127
129
  thread_ret0 = __reap_thread_fn(data);
128
130
  return NULL;
129
131
  }
130
132
 
131
- void *reap_thread_fn1(void *data) {
133
+ static void *reap_thread_fn1(void *data)
134
+ {
132
135
  thread_ret1 = __reap_thread_fn(data);
133
136
  return NULL;
134
137
  }
@@ -137,7 +140,8 @@ void *reap_thread_fn1(void *data) {
137
140
  * This is to test issuing a sqe in main thread and reaping it in two child-thread
138
141
  * at the same time. To see if timeout feature works or not.
139
142
  */
140
- int test_multi_threads_timeout() {
143
+ static int test_multi_threads_timeout(void)
144
+ {
141
145
  struct io_uring ring;
142
146
  int ret;
143
147
  bool both_wait = false;
@@ -176,7 +176,7 @@ static int test_single_timeout_nr(struct io_uring *ring, int nr)
176
176
  goto err;
177
177
  }
178
178
  i++;
179
- };
179
+ }
180
180
 
181
181
  return 0;
182
182
  err:
@@ -1303,7 +1303,6 @@ static int test_not_failing_links(void)
1303
1303
  fprintf(stderr, "%s: wait completion %d\n", __FUNCTION__, ret);
1304
1304
  return 1;
1305
1305
  } else if (cqe->user_data == 1 && cqe->res == -EINVAL) {
1306
- fprintf(stderr, "ETIME_SUCCESS is not supported, skip\n");
1307
1306
  goto done;
1308
1307
  } else if (cqe->res != -ETIME || cqe->user_data != 1) {
1309
1308
  fprintf(stderr, "timeout failed %i %i\n", cqe->res,
@@ -1,6 +1,6 @@
1
1
  /* SPDX-License-Identifier: MIT */
2
2
  /*
3
- * Description: run various nop tests
3
+ * Description: run various unlink tests
4
4
  *
5
5
  */
6
6
  #include <errno.h>
@@ -0,0 +1,25 @@
1
+ /* SPDX-License-Identifier: MIT */
2
+ /*
3
+ * Description: check version macros and runtime checks work
4
+ *
5
+ */
6
+ #include "liburing.h"
7
+ #include "helpers.h"
8
+
9
+ int main(int argc, char *argv[])
10
+ {
11
+ if (!IO_URING_CHECK_VERSION(io_uring_major_version(), io_uring_minor_version()))
12
+ return T_EXIT_FAIL;
13
+
14
+ if (io_uring_major_version() != IO_URING_VERSION_MAJOR)
15
+ return T_EXIT_FAIL;
16
+
17
+ if (io_uring_minor_version() != IO_URING_VERSION_MINOR)
18
+ return T_EXIT_FAIL;
19
+
20
+ #if !IO_URING_CHECK_VERSION(IO_URING_VERSION_MAJOR, IO_URING_VERSION_MINOR)
21
+ return T_EXIT_FAIL;
22
+ #endif
23
+
24
+ return T_EXIT_PASS;
25
+ }
@@ -5,10 +5,10 @@
5
5
  #include <stdlib.h>
6
6
  #include <string.h>
7
7
  #include <pthread.h>
8
- #include <liburing.h>
9
8
  #include <fcntl.h>
10
9
  #include <poll.h>
11
10
  #include <sys/time.h>
11
+ #include "liburing.h"
12
12
 
13
13
  struct thread_data {
14
14
  struct io_uring *ring;
@@ -51,10 +51,11 @@ static int io_uring_fsetxattr(struct io_uring *ring, int fd, const char *name,
51
51
  }
52
52
 
53
53
  ret = cqe->res;
54
- if (ret == -EINVAL)
55
- no_xattr = 1;
54
+ if (ret < 0) {
55
+ if (cqe->res == -EINVAL || cqe->res == -EOPNOTSUPP)
56
+ no_xattr = 1;
57
+ }
56
58
  io_uring_cqe_seen(ring, cqe);
57
-
58
59
  return ret;
59
60
  }
60
61
 
@@ -126,8 +127,11 @@ static int io_uring_setxattr(struct io_uring *ring, const char *path,
126
127
  }
127
128
 
128
129
  ret = cqe->res;
130
+ if (ret < 0) {
131
+ if (ret == -EINVAL || ret == -EOPNOTSUPP)
132
+ no_xattr = 1;
133
+ }
129
134
  io_uring_cqe_seen(ring, cqe);
130
-
131
135
  return ret;
132
136
  }
133
137
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyphony
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.98'
4
+ version: '0.99'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-08 00:00:00.000000000 Z
11
+ date: 2023-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -424,14 +424,12 @@ files:
424
424
  - vendor/liburing/configure
425
425
  - vendor/liburing/debian/README.Debian
426
426
  - vendor/liburing/debian/changelog
427
- - vendor/liburing/debian/compat
428
427
  - vendor/liburing/debian/control
429
428
  - vendor/liburing/debian/copyright
430
429
  - vendor/liburing/debian/liburing-dev.install
431
430
  - vendor/liburing/debian/liburing-dev.manpages
432
- - vendor/liburing/debian/liburing1-udeb.install
433
- - vendor/liburing/debian/liburing1.install
434
- - vendor/liburing/debian/liburing1.symbols
431
+ - vendor/liburing/debian/liburing2.install
432
+ - vendor/liburing/debian/liburing2.symbols
435
433
  - vendor/liburing/debian/patches/series
436
434
  - vendor/liburing/debian/rules
437
435
  - vendor/liburing/debian/source/format
@@ -439,6 +437,7 @@ files:
439
437
  - vendor/liburing/debian/source/options
440
438
  - vendor/liburing/debian/watch
441
439
  - vendor/liburing/examples/Makefile
440
+ - vendor/liburing/examples/io_uring-close-test.c
442
441
  - vendor/liburing/examples/io_uring-cp.c
443
442
  - vendor/liburing/examples/io_uring-test.c
444
443
  - vendor/liburing/examples/io_uring-udp.c
@@ -446,15 +445,21 @@ files:
446
445
  - vendor/liburing/examples/poll-bench.c
447
446
  - vendor/liburing/examples/send-zerocopy.c
448
447
  - vendor/liburing/examples/ucontext-cp.c
448
+ - vendor/liburing/liburing-ffi.pc.in
449
449
  - vendor/liburing/liburing.pc.in
450
450
  - vendor/liburing/liburing.spec
451
451
  - vendor/liburing/make-debs.sh
452
+ - vendor/liburing/man/IO_URING_CHECK_VERSION.3
453
+ - vendor/liburing/man/IO_URING_VERSION_MAJOR.3
454
+ - vendor/liburing/man/IO_URING_VERSION_MINOR.3
452
455
  - vendor/liburing/man/io_uring.7
453
456
  - vendor/liburing/man/io_uring_buf_ring_add.3
454
457
  - vendor/liburing/man/io_uring_buf_ring_advance.3
455
458
  - vendor/liburing/man/io_uring_buf_ring_cq_advance.3
456
459
  - vendor/liburing/man/io_uring_buf_ring_init.3
457
460
  - vendor/liburing/man/io_uring_buf_ring_mask.3
461
+ - vendor/liburing/man/io_uring_check_version.3
462
+ - vendor/liburing/man/io_uring_close_ring_fd.3
458
463
  - vendor/liburing/man/io_uring_cq_advance.3
459
464
  - vendor/liburing/man/io_uring_cq_has_overflow.3
460
465
  - vendor/liburing/man/io_uring_cq_ready.3
@@ -467,6 +472,8 @@ files:
467
472
  - vendor/liburing/man/io_uring_get_events.3
468
473
  - vendor/liburing/man/io_uring_get_probe.3
469
474
  - vendor/liburing/man/io_uring_get_sqe.3
475
+ - vendor/liburing/man/io_uring_major_version.3
476
+ - vendor/liburing/man/io_uring_minor_version.3
470
477
  - vendor/liburing/man/io_uring_opcode_supported.3
471
478
  - vendor/liburing/man/io_uring_peek_cqe.3
472
479
  - vendor/liburing/man/io_uring_prep_accept.3
@@ -478,14 +485,19 @@ files:
478
485
  - vendor/liburing/man/io_uring_prep_connect.3
479
486
  - vendor/liburing/man/io_uring_prep_fadvise.3
480
487
  - vendor/liburing/man/io_uring_prep_fallocate.3
488
+ - vendor/liburing/man/io_uring_prep_fgetxattr.3
481
489
  - vendor/liburing/man/io_uring_prep_files_update.3
490
+ - vendor/liburing/man/io_uring_prep_fsetxattr.3
482
491
  - vendor/liburing/man/io_uring_prep_fsync.3
492
+ - vendor/liburing/man/io_uring_prep_getxattr.3
483
493
  - vendor/liburing/man/io_uring_prep_link.3
494
+ - vendor/liburing/man/io_uring_prep_link_timeout.3
484
495
  - vendor/liburing/man/io_uring_prep_linkat.3
485
496
  - vendor/liburing/man/io_uring_prep_madvise.3
486
497
  - vendor/liburing/man/io_uring_prep_mkdir.3
487
498
  - vendor/liburing/man/io_uring_prep_mkdirat.3
488
499
  - vendor/liburing/man/io_uring_prep_msg_ring.3
500
+ - vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3
489
501
  - vendor/liburing/man/io_uring_prep_multishot_accept.3
490
502
  - vendor/liburing/man/io_uring_prep_multishot_accept_direct.3
491
503
  - vendor/liburing/man/io_uring_prep_nop.3
@@ -510,8 +522,12 @@ files:
510
522
  - vendor/liburing/man/io_uring_prep_rename.3
511
523
  - vendor/liburing/man/io_uring_prep_renameat.3
512
524
  - vendor/liburing/man/io_uring_prep_send.3
525
+ - vendor/liburing/man/io_uring_prep_send_set_addr.3
513
526
  - vendor/liburing/man/io_uring_prep_send_zc.3
527
+ - vendor/liburing/man/io_uring_prep_send_zc_fixed.3
514
528
  - vendor/liburing/man/io_uring_prep_sendmsg.3
529
+ - vendor/liburing/man/io_uring_prep_sendmsg_zc.3
530
+ - vendor/liburing/man/io_uring_prep_setxattr.3
515
531
  - vendor/liburing/man/io_uring_prep_shutdown.3
516
532
  - vendor/liburing/man/io_uring_prep_socket.3
517
533
  - vendor/liburing/man/io_uring_prep_socket_direct.3
@@ -544,11 +560,17 @@ files:
544
560
  - vendor/liburing/man/io_uring_register.2
545
561
  - vendor/liburing/man/io_uring_register_buf_ring.3
546
562
  - vendor/liburing/man/io_uring_register_buffers.3
563
+ - vendor/liburing/man/io_uring_register_buffers_sparse.3
564
+ - vendor/liburing/man/io_uring_register_buffers_tags.3
565
+ - vendor/liburing/man/io_uring_register_buffers_update_tag.3
547
566
  - vendor/liburing/man/io_uring_register_eventfd.3
548
567
  - vendor/liburing/man/io_uring_register_eventfd_async.3
549
568
  - vendor/liburing/man/io_uring_register_file_alloc_range.3
550
569
  - vendor/liburing/man/io_uring_register_files.3
551
570
  - vendor/liburing/man/io_uring_register_files_sparse.3
571
+ - vendor/liburing/man/io_uring_register_files_tags.3
572
+ - vendor/liburing/man/io_uring_register_files_update.3
573
+ - vendor/liburing/man/io_uring_register_files_update_tag.3
552
574
  - vendor/liburing/man/io_uring_register_iowq_aff.3
553
575
  - vendor/liburing/man/io_uring_register_iowq_max_workers.3
554
576
  - vendor/liburing/man/io_uring_register_ring_fd.3
@@ -582,11 +604,13 @@ files:
582
604
  - vendor/liburing/src/arch/syscall-defs.h
583
605
  - vendor/liburing/src/arch/x86/lib.h
584
606
  - vendor/liburing/src/arch/x86/syscall.h
607
+ - vendor/liburing/src/ffi.c
585
608
  - vendor/liburing/src/include/liburing.h
586
609
  - vendor/liburing/src/include/liburing/barrier.h
587
610
  - vendor/liburing/src/include/liburing/io_uring.h
588
611
  - vendor/liburing/src/int_flags.h
589
612
  - vendor/liburing/src/lib.h
613
+ - vendor/liburing/src/liburing-ffi.map
590
614
  - vendor/liburing/src/liburing.map
591
615
  - vendor/liburing/src/nolibc.c
592
616
  - vendor/liburing/src/queue.c
@@ -594,6 +618,7 @@ files:
594
618
  - vendor/liburing/src/setup.c
595
619
  - vendor/liburing/src/syscall.c
596
620
  - vendor/liburing/src/syscall.h
621
+ - vendor/liburing/src/version.c
597
622
  - vendor/liburing/test/232c93d07b74.c
598
623
  - vendor/liburing/test/35fa71a030ca.c
599
624
  - vendor/liburing/test/500f9fbadef8.c
@@ -628,10 +653,12 @@ files:
628
653
  - vendor/liburing/test/drop-submit.c
629
654
  - vendor/liburing/test/eeed8b54e0df.c
630
655
  - vendor/liburing/test/empty-eownerdead.c
656
+ - vendor/liburing/test/eploop.c
631
657
  - vendor/liburing/test/eventfd-disable.c
632
658
  - vendor/liburing/test/eventfd-reg.c
633
659
  - vendor/liburing/test/eventfd-ring.c
634
660
  - vendor/liburing/test/eventfd.c
661
+ - vendor/liburing/test/evloop.c
635
662
  - vendor/liburing/test/exec-target.c
636
663
  - vendor/liburing/test/exit-no-cleanup.c
637
664
  - vendor/liburing/test/fadvise.c
@@ -647,6 +674,7 @@ files:
647
674
  - vendor/liburing/test/fixed-link.c
648
675
  - vendor/liburing/test/fixed-reuse.c
649
676
  - vendor/liburing/test/fpos.c
677
+ - vendor/liburing/test/fsnotify.c
650
678
  - vendor/liburing/test/fsync.c
651
679
  - vendor/liburing/test/hardlink.c
652
680
  - vendor/liburing/test/helpers.c
@@ -657,6 +685,7 @@ files:
657
685
  - vendor/liburing/test/io_uring_register.c
658
686
  - vendor/liburing/test/io_uring_setup.c
659
687
  - vendor/liburing/test/iopoll-leak.c
688
+ - vendor/liburing/test/iopoll-overflow.c
660
689
  - vendor/liburing/test/iopoll.c
661
690
  - vendor/liburing/test/lfs-openat-write.c
662
691
  - vendor/liburing/test/lfs-openat.c
@@ -665,6 +694,8 @@ files:
665
694
  - vendor/liburing/test/link_drain.c
666
695
  - vendor/liburing/test/madvise.c
667
696
  - vendor/liburing/test/mkdir.c
697
+ - vendor/liburing/test/msg-ring-flags.c
698
+ - vendor/liburing/test/msg-ring-overflow.c
668
699
  - vendor/liburing/test/msg-ring.c
669
700
  - vendor/liburing/test/multicqes_drain.c
670
701
  - vendor/liburing/test/nolibc.c
@@ -676,6 +707,7 @@ files:
676
707
  - vendor/liburing/test/open-direct-pick.c
677
708
  - vendor/liburing/test/openat2.c
678
709
  - vendor/liburing/test/personality.c
710
+ - vendor/liburing/test/pipe-bug.c
679
711
  - vendor/liburing/test/pipe-eof.c
680
712
  - vendor/liburing/test/pipe-reuse.c
681
713
  - vendor/liburing/test/poll-cancel-all.c
@@ -685,6 +717,8 @@ files:
685
717
  - vendor/liburing/test/poll-many.c
686
718
  - vendor/liburing/test/poll-mshot-overflow.c
687
719
  - vendor/liburing/test/poll-mshot-update.c
720
+ - vendor/liburing/test/poll-race-mshot.c
721
+ - vendor/liburing/test/poll-race.c
688
722
  - vendor/liburing/test/poll-ring.c
689
723
  - vendor/liburing/test/poll-v-poll.c
690
724
  - vendor/liburing/test/poll.c
@@ -695,6 +729,7 @@ files:
695
729
  - vendor/liburing/test/recv-msgall-stream.c
696
730
  - vendor/liburing/test/recv-msgall.c
697
731
  - vendor/liburing/test/recv-multishot.c
732
+ - vendor/liburing/test/reg-reg-ring.c
698
733
  - vendor/liburing/test/register-restrictions.c
699
734
  - vendor/liburing/test/rename.c
700
735
  - vendor/liburing/test/ring-leak.c
@@ -746,6 +781,7 @@ files:
746
781
  - vendor/liburing/test/timeout.c
747
782
  - vendor/liburing/test/tty-write-dpoll.c
748
783
  - vendor/liburing/test/unlink.c
784
+ - vendor/liburing/test/version.c
749
785
  - vendor/liburing/test/wakeup-hang.c
750
786
  - vendor/liburing/test/xattr.c
751
787
  homepage: https://digital-fabric.github.io/polyphony
@@ -1 +0,0 @@
1
- 9
@@ -1 +0,0 @@
1
- lib/*/lib*.so.*
@@ -1 +0,0 @@
1
- lib/*/lib*.so.*