polyphony 0.98 → 0.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -1
- data/.rubocop.yml +3 -3
- data/.yardopts +30 -0
- data/CHANGELOG.md +11 -0
- data/LICENSE +1 -1
- data/README.md +63 -29
- data/Rakefile +1 -5
- data/TODO.md +0 -4
- data/docs/{main-concepts/concurrency.md → concurrency.md} +2 -9
- data/docs/{main-concepts/design-principles.md → design-principles.md} +3 -9
- data/docs/{main-concepts/exception-handling.md → exception-handling.md} +2 -9
- data/docs/{main-concepts/extending.md → extending.md} +2 -9
- data/docs/faq.md +3 -16
- data/docs/{main-concepts/fiber-scheduling.md → fiber-scheduling.md} +1 -9
- data/docs/link_rewriter.rb +16 -0
- data/docs/{getting-started/overview.md → overview.md} +1 -30
- data/docs/{getting-started/tutorial.md → tutorial.md} +3 -28
- data/docs/{_posts/2020-07-26-polyphony-0.44.md → whats-new.md} +3 -1
- data/examples/adapters/redis_client.rb +3 -2
- data/examples/io/echo_server.rb +1 -1
- data/examples/io/echo_server_plain_ruby.rb +26 -0
- data/examples/io/https_server_sni_2.rb +14 -8
- data/ext/polyphony/backend_io_uring.c +154 -9
- data/ext/polyphony/backend_io_uring_context.c +21 -12
- data/ext/polyphony/backend_io_uring_context.h +12 -7
- data/ext/polyphony/backend_libev.c +1 -1
- data/ext/polyphony/extconf.rb +25 -8
- data/ext/polyphony/fiber.c +79 -2
- data/ext/polyphony/io_extensions.c +53 -0
- data/ext/polyphony/libev.h +0 -2
- data/ext/polyphony/pipe.c +42 -2
- data/ext/polyphony/polyphony.c +345 -31
- data/ext/polyphony/polyphony.h +9 -2
- data/ext/polyphony/queue.c +181 -0
- data/ext/polyphony/ring_buffer.c +0 -1
- data/ext/polyphony/runqueue.c +8 -1
- data/ext/polyphony/runqueue_ring_buffer.c +13 -0
- data/ext/polyphony/runqueue_ring_buffer.h +2 -1
- data/ext/polyphony/socket_extensions.c +6 -0
- data/ext/polyphony/thread.c +34 -2
- data/lib/polyphony/adapters/process.rb +11 -1
- data/lib/polyphony/adapters/sequel.rb +1 -1
- data/lib/polyphony/core/channel.rb +2 -0
- data/lib/polyphony/core/debug.rb +1 -1
- data/lib/polyphony/core/global_api.rb +25 -24
- data/lib/polyphony/core/resource_pool.rb +7 -6
- data/lib/polyphony/core/sync.rb +55 -2
- data/lib/polyphony/core/thread_pool.rb +3 -3
- data/lib/polyphony/core/timer.rb +8 -8
- data/lib/polyphony/extensions/exception.rb +2 -0
- data/lib/polyphony/extensions/fiber.rb +15 -13
- data/lib/polyphony/extensions/io.rb +161 -16
- data/lib/polyphony/extensions/kernel.rb +20 -2
- data/lib/polyphony/extensions/openssl.rb +101 -12
- data/lib/polyphony/extensions/pipe.rb +103 -7
- data/lib/polyphony/extensions/process.rb +13 -1
- data/lib/polyphony/extensions/socket.rb +93 -27
- data/lib/polyphony/extensions/thread.rb +9 -1
- data/lib/polyphony/extensions/timeout.rb +1 -1
- data/lib/polyphony/version.rb +2 -1
- data/lib/polyphony.rb +27 -7
- data/polyphony.gemspec +1 -8
- data/test/stress.rb +1 -1
- data/test/test_global_api.rb +45 -7
- data/test/test_io.rb +6 -7
- data/test/test_socket.rb +157 -0
- data/test/test_sync.rb +42 -1
- data/test/test_timer.rb +5 -5
- data/vendor/liburing/.github/workflows/build.yml +7 -16
- data/vendor/liburing/.gitignore +5 -0
- data/vendor/liburing/CHANGELOG +23 -1
- data/vendor/liburing/Makefile +4 -3
- data/vendor/liburing/Makefile.common +1 -0
- data/vendor/liburing/README +48 -0
- data/vendor/liburing/configure +76 -6
- data/vendor/liburing/debian/changelog +11 -0
- data/vendor/liburing/debian/control +7 -16
- data/vendor/liburing/debian/liburing-dev.manpages +3 -6
- data/vendor/liburing/debian/liburing2.install +1 -0
- data/vendor/liburing/debian/liburing2.symbols +56 -0
- data/vendor/liburing/debian/rules +15 -68
- data/vendor/liburing/examples/Makefile +4 -0
- data/vendor/liburing/examples/io_uring-close-test.c +123 -0
- data/vendor/liburing/examples/io_uring-udp.c +1 -1
- data/vendor/liburing/examples/send-zerocopy.c +315 -56
- data/vendor/liburing/examples/ucontext-cp.c +2 -17
- data/vendor/liburing/liburing-ffi.pc.in +12 -0
- data/vendor/liburing/liburing.pc.in +1 -1
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/make-debs.sh +3 -3
- data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +1 -0
- data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +1 -0
- data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +1 -0
- data/vendor/liburing/man/io_uring_buf_ring_add.3 +6 -6
- data/vendor/liburing/man/io_uring_check_version.3 +72 -0
- data/vendor/liburing/man/io_uring_close_ring_fd.3 +43 -0
- data/vendor/liburing/man/io_uring_major_version.3 +1 -0
- data/vendor/liburing/man/io_uring_minor_version.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_accept.3 +1 -1
- data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_getxattr.3 +61 -0
- data/vendor/liburing/man/io_uring_prep_link_timeout.3 +94 -0
- data/vendor/liburing/man/io_uring_prep_msg_ring.3 +22 -2
- data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_add.3 +1 -1
- data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +18 -9
- data/vendor/liburing/man/io_uring_prep_readv.3 +3 -3
- data/vendor/liburing/man/io_uring_prep_readv2.3 +3 -3
- data/vendor/liburing/man/io_uring_prep_recv.3 +5 -5
- data/vendor/liburing/man/io_uring_prep_recvmsg.3 +4 -4
- data/vendor/liburing/man/io_uring_prep_send.3 +9 -0
- data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +38 -0
- data/vendor/liburing/man/io_uring_prep_send_zc.3 +39 -7
- data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_sendmsg.3 +20 -0
- data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_setxattr.3 +64 -0
- data/vendor/liburing/man/io_uring_prep_splice.3 +40 -0
- data/vendor/liburing/man/io_uring_prep_writev.3 +2 -2
- data/vendor/liburing/man/io_uring_prep_writev2.3 +2 -2
- data/vendor/liburing/man/io_uring_recvmsg_out.3 +13 -9
- data/vendor/liburing/man/io_uring_register.2 +15 -9
- data/vendor/liburing/man/io_uring_register_buf_ring.3 +4 -4
- data/vendor/liburing/man/io_uring_register_buffers.3 +49 -6
- data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +1 -0
- data/vendor/liburing/man/io_uring_register_buffers_tags.3 +1 -0
- data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +1 -0
- data/vendor/liburing/man/io_uring_register_files.3 +60 -5
- data/vendor/liburing/man/io_uring_register_files_tags.3 +1 -0
- data/vendor/liburing/man/io_uring_register_files_update.3 +1 -0
- data/vendor/liburing/man/io_uring_register_files_update_tag.3 +1 -0
- data/vendor/liburing/man/io_uring_setup.2 +31 -2
- data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +1 -1
- data/vendor/liburing/src/Makefile +25 -3
- data/vendor/liburing/src/ffi.c +15 -0
- data/vendor/liburing/src/include/liburing/io_uring.h +30 -7
- data/vendor/liburing/src/include/liburing.h +190 -148
- data/vendor/liburing/src/int_flags.h +1 -0
- data/vendor/liburing/src/lib.h +5 -16
- data/vendor/liburing/src/liburing-ffi.map +172 -0
- data/vendor/liburing/src/liburing.map +11 -0
- data/vendor/liburing/src/nolibc.c +9 -2
- data/vendor/liburing/src/queue.c +2 -2
- data/vendor/liburing/src/register.c +66 -96
- data/vendor/liburing/src/setup.c +5 -4
- data/vendor/liburing/src/version.c +21 -0
- data/vendor/liburing/test/232c93d07b74.c +3 -3
- data/vendor/liburing/test/35fa71a030ca.c +3 -3
- data/vendor/liburing/test/500f9fbadef8.c +2 -0
- data/vendor/liburing/test/917257daa0fe.c +1 -1
- data/vendor/liburing/test/Makefile +27 -7
- data/vendor/liburing/test/a0908ae19763.c +2 -2
- data/vendor/liburing/test/a4c0b3decb33.c +2 -2
- data/vendor/liburing/test/accept-link.c +4 -4
- data/vendor/liburing/test/accept-reuse.c +5 -7
- data/vendor/liburing/test/accept.c +34 -31
- data/vendor/liburing/test/b19062a56726.c +1 -1
- data/vendor/liburing/test/buf-ring.c +58 -4
- data/vendor/liburing/test/ce593a6c480a.c +2 -2
- data/vendor/liburing/test/close-opath.c +2 -1
- data/vendor/liburing/test/connect.c +8 -0
- data/vendor/liburing/test/cq-overflow.c +14 -8
- data/vendor/liburing/test/d4ae271dfaae.c +1 -1
- data/vendor/liburing/test/defer-taskrun.c +64 -9
- data/vendor/liburing/test/defer.c +1 -1
- data/vendor/liburing/test/double-poll-crash.c +3 -3
- data/vendor/liburing/test/eeed8b54e0df.c +8 -3
- data/vendor/liburing/test/eploop.c +74 -0
- data/vendor/liburing/test/eventfd-ring.c +1 -1
- data/vendor/liburing/test/eventfd.c +1 -1
- data/vendor/liburing/test/evloop.c +73 -0
- data/vendor/liburing/test/exit-no-cleanup.c +1 -1
- data/vendor/liburing/test/fadvise.c +1 -1
- data/vendor/liburing/test/fc2a85cb02ef.c +3 -3
- data/vendor/liburing/test/fd-pass.c +35 -16
- data/vendor/liburing/test/file-register.c +61 -0
- data/vendor/liburing/test/file-verify.c +2 -2
- data/vendor/liburing/test/files-exit-hang-timeout.c +2 -2
- data/vendor/liburing/test/fixed-link.c +1 -1
- data/vendor/liburing/test/fsnotify.c +118 -0
- data/vendor/liburing/test/hardlink.c +1 -1
- data/vendor/liburing/test/helpers.c +54 -2
- data/vendor/liburing/test/helpers.h +4 -0
- data/vendor/liburing/test/io-cancel.c +3 -1
- data/vendor/liburing/test/io_uring_passthrough.c +39 -8
- data/vendor/liburing/test/io_uring_setup.c +3 -80
- data/vendor/liburing/test/iopoll-overflow.c +118 -0
- data/vendor/liburing/test/iopoll.c +90 -4
- data/vendor/liburing/test/lfs-openat-write.c +7 -9
- data/vendor/liburing/test/lfs-openat.c +6 -8
- data/vendor/liburing/test/link_drain.c +31 -5
- data/vendor/liburing/test/madvise.c +1 -1
- data/vendor/liburing/test/msg-ring-flags.c +192 -0
- data/vendor/liburing/test/msg-ring-overflow.c +159 -0
- data/vendor/liburing/test/msg-ring.c +173 -13
- data/vendor/liburing/test/multicqes_drain.c +22 -19
- data/vendor/liburing/test/nvme.h +4 -3
- data/vendor/liburing/test/pipe-bug.c +95 -0
- data/vendor/liburing/test/poll-link.c +3 -3
- data/vendor/liburing/test/poll-many.c +41 -19
- data/vendor/liburing/test/poll-mshot-overflow.c +105 -2
- data/vendor/liburing/test/poll-race-mshot.c +292 -0
- data/vendor/liburing/test/poll-race.c +105 -0
- data/vendor/liburing/test/poll.c +244 -26
- data/vendor/liburing/test/pollfree.c +5 -5
- data/vendor/liburing/test/read-before-exit.c +20 -3
- data/vendor/liburing/test/read-write.c +2 -0
- data/vendor/liburing/test/recv-multishot.c +96 -3
- data/vendor/liburing/test/reg-reg-ring.c +90 -0
- data/vendor/liburing/test/rename.c +1 -1
- data/vendor/liburing/test/ring-leak.c +0 -1
- data/vendor/liburing/test/ring-leak2.c +1 -1
- data/vendor/liburing/test/ringbuf-read.c +10 -6
- data/vendor/liburing/test/send-zerocopy.c +273 -103
- data/vendor/liburing/test/send_recv.c +7 -4
- data/vendor/liburing/test/sendmsg_fs_cve.c +2 -2
- data/vendor/liburing/test/single-issuer.c +7 -9
- data/vendor/liburing/test/skip-cqe.c +3 -4
- data/vendor/liburing/test/socket.c +0 -1
- data/vendor/liburing/test/sq-poll-dup.c +10 -3
- data/vendor/liburing/test/sq-poll-kthread.c +1 -1
- data/vendor/liburing/test/sq-poll-share.c +3 -2
- data/vendor/liburing/test/sqpoll-cancel-hang.c +17 -6
- data/vendor/liburing/test/sqpoll-disable-exit.c +4 -4
- data/vendor/liburing/test/symlink.c +2 -1
- data/vendor/liburing/test/test.h +2 -1
- data/vendor/liburing/test/timeout-new.c +11 -7
- data/vendor/liburing/test/timeout.c +1 -2
- data/vendor/liburing/test/unlink.c +1 -1
- data/vendor/liburing/test/version.c +25 -0
- data/vendor/liburing/test/wakeup-hang.c +1 -1
- data/vendor/liburing/test/xattr.c +8 -4
- metadata +57 -44
- data/docs/_config.yml +0 -64
- data/docs/_includes/head.html +0 -40
- data/docs/_includes/title.html +0 -1
- data/docs/_sass/custom/custom.scss +0 -10
- data/docs/_sass/overrides.scss +0 -0
- data/docs/api-reference/exception.md +0 -31
- data/docs/api-reference/fiber.md +0 -425
- data/docs/api-reference/index.md +0 -9
- data/docs/api-reference/io.md +0 -36
- data/docs/api-reference/object.md +0 -99
- data/docs/api-reference/polyphony-baseexception.md +0 -33
- data/docs/api-reference/polyphony-cancel.md +0 -26
- data/docs/api-reference/polyphony-moveon.md +0 -24
- data/docs/api-reference/polyphony-net.md +0 -20
- data/docs/api-reference/polyphony-process.md +0 -28
- data/docs/api-reference/polyphony-resourcepool.md +0 -59
- data/docs/api-reference/polyphony-restart.md +0 -18
- data/docs/api-reference/polyphony-terminate.md +0 -18
- data/docs/api-reference/polyphony-threadpool.md +0 -67
- data/docs/api-reference/polyphony-throttler.md +0 -77
- data/docs/api-reference/polyphony.md +0 -36
- data/docs/api-reference/thread.md +0 -88
- data/docs/favicon.ico +0 -0
- data/docs/getting-started/index.md +0 -10
- data/docs/getting-started/installing.md +0 -34
- data/vendor/liburing/debian/compat +0 -1
- data/vendor/liburing/debian/liburing1-udeb.install +0 -1
- data/vendor/liburing/debian/liburing1.install +0 -1
- data/vendor/liburing/debian/liburing1.symbols +0 -32
- /data/{docs/assets/img → assets}/echo-fibers.svg +0 -0
- /data/{docs → assets}/polyphony-logo.png +0 -0
- /data/{docs/assets/img → assets}/sleeping-fiber.svg +0 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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 <
|
|
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
|
-
|
|
58
|
+
t_error(1, ret, "submit %i", ret);
|
|
60
59
|
ret = io_uring_wait_cqe(ring, &cqe);
|
|
61
60
|
if (ret)
|
|
62
|
-
|
|
61
|
+
t_error(1, ret, "wait fail %i", ret);
|
|
63
62
|
|
|
64
63
|
if (cqe->res || cqe->user_data != 42)
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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");
|
|
@@ -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,
|
|
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,
|
|
192
|
-
mmap((void *)0x20000000ul, 0x1000000ul, 7ul,
|
|
193
|
-
mmap((void *)0x21000000ul, 0x1000ul, 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,
|
|
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);
|
data/vendor/liburing/test/test.h
CHANGED
|
@@ -14,7 +14,8 @@ typedef struct io_uring_test_config {
|
|
|
14
14
|
const char *description;
|
|
15
15
|
} io_uring_test_config;
|
|
16
16
|
|
|
17
|
-
|
|
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,
|
|
@@ -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
|
+
}
|
|
@@ -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
|
|
55
|
-
|
|
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
|
|