polyphony 0.85 → 0.86
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/ext/polyphony/io_extensions.c +2 -3
- data/lib/polyphony/version.rb +1 -1
- data/polyphony.gemspec +1 -1
- data/test/test_backend.rb +1 -1
- data/test/test_signal.rb +3 -3
- data/vendor/liburing/.github/pull_request_template.md +86 -0
- data/vendor/liburing/.github/workflows/build.yml +85 -0
- data/vendor/liburing/.github/workflows/shellcheck.yml +20 -0
- data/vendor/liburing/.gitignore +149 -0
- data/vendor/liburing/COPYING +502 -0
- data/vendor/liburing/COPYING.GPL +339 -0
- data/vendor/liburing/LICENSE +7 -0
- data/vendor/liburing/Makefile +82 -0
- data/vendor/liburing/Makefile.common +5 -0
- data/vendor/liburing/Makefile.quiet +11 -0
- data/vendor/liburing/README +46 -0
- data/vendor/liburing/configure +486 -0
- data/vendor/liburing/debian/README.Debian +7 -0
- data/vendor/liburing/debian/changelog +27 -0
- data/vendor/liburing/debian/compat +1 -0
- data/vendor/liburing/debian/control +48 -0
- data/vendor/liburing/debian/copyright +49 -0
- data/vendor/liburing/debian/liburing-dev.install +4 -0
- data/vendor/liburing/debian/liburing-dev.manpages +6 -0
- data/vendor/liburing/debian/liburing1-udeb.install +1 -0
- data/vendor/liburing/debian/liburing1.install +1 -0
- data/vendor/liburing/debian/liburing1.symbols +32 -0
- data/vendor/liburing/debian/patches/series +1 -0
- data/vendor/liburing/debian/rules +81 -0
- data/vendor/liburing/debian/source/format +1 -0
- data/vendor/liburing/debian/source/local-options +2 -0
- data/vendor/liburing/debian/source/options +1 -0
- data/vendor/liburing/debian/watch +3 -0
- data/vendor/liburing/examples/Makefile +38 -0
- data/vendor/liburing/examples/io_uring-cp.c +282 -0
- data/vendor/liburing/examples/io_uring-test.c +112 -0
- data/vendor/liburing/examples/link-cp.c +193 -0
- data/vendor/liburing/examples/ucontext-cp.c +273 -0
- data/vendor/liburing/liburing.pc.in +12 -0
- data/vendor/liburing/liburing.spec +66 -0
- data/vendor/liburing/make-debs.sh +53 -0
- data/vendor/liburing/man/io_uring.7 +754 -0
- data/vendor/liburing/man/io_uring_cq_advance.3 +35 -0
- data/vendor/liburing/man/io_uring_cq_ready.3 +25 -0
- data/vendor/liburing/man/io_uring_cqe_get_data.3 +34 -0
- data/vendor/liburing/man/io_uring_cqe_seen.3 +32 -0
- data/vendor/liburing/man/io_uring_enter.2 +1483 -0
- data/vendor/liburing/man/io_uring_free_probe.3 +24 -0
- data/vendor/liburing/man/io_uring_get_probe.3 +29 -0
- data/vendor/liburing/man/io_uring_get_sqe.3 +38 -0
- data/vendor/liburing/man/io_uring_opcode_supported.3 +29 -0
- data/vendor/liburing/man/io_uring_prep_msg_ring.3 +58 -0
- data/vendor/liburing/man/io_uring_prep_read.3 +50 -0
- data/vendor/liburing/man/io_uring_prep_read_fixed.3 +54 -0
- data/vendor/liburing/man/io_uring_prep_readv.3 +51 -0
- data/vendor/liburing/man/io_uring_prep_readv2.3 +79 -0
- data/vendor/liburing/man/io_uring_prep_write.3 +50 -0
- data/vendor/liburing/man/io_uring_prep_write_fixed.3 +54 -0
- data/vendor/liburing/man/io_uring_prep_writev.3 +51 -0
- data/vendor/liburing/man/io_uring_prep_writev2.3 +78 -0
- data/vendor/liburing/man/io_uring_queue_exit.3 +27 -0
- data/vendor/liburing/man/io_uring_queue_init.3 +44 -0
- data/vendor/liburing/man/io_uring_register.2 +688 -0
- data/vendor/liburing/man/io_uring_register_buffers.3 +41 -0
- data/vendor/liburing/man/io_uring_register_files.3 +35 -0
- data/vendor/liburing/man/io_uring_setup.2 +534 -0
- data/vendor/liburing/man/io_uring_sq_ready.3 +25 -0
- data/vendor/liburing/man/io_uring_sq_space_left.3 +25 -0
- data/vendor/liburing/man/io_uring_sqe_set_data.3 +30 -0
- data/vendor/liburing/man/io_uring_sqe_set_flags.3 +60 -0
- data/vendor/liburing/man/io_uring_sqring_wait.3 +30 -0
- data/vendor/liburing/man/io_uring_submit.3 +29 -0
- data/vendor/liburing/man/io_uring_submit_and_wait.3 +34 -0
- data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +49 -0
- data/vendor/liburing/man/io_uring_unregister_buffers.3 +26 -0
- data/vendor/liburing/man/io_uring_unregister_files.3 +26 -0
- data/vendor/liburing/man/io_uring_wait_cqe.3 +33 -0
- data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +36 -0
- data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +39 -0
- data/vendor/liburing/man/io_uring_wait_cqes.3 +46 -0
- data/vendor/liburing/src/Makefile +89 -0
- data/vendor/liburing/src/arch/aarch64/syscall.h +95 -0
- data/vendor/liburing/src/arch/generic/lib.h +21 -0
- data/vendor/liburing/src/arch/generic/syscall.h +87 -0
- data/vendor/liburing/src/arch/syscall-defs.h +67 -0
- data/vendor/liburing/src/arch/x86/lib.h +32 -0
- data/vendor/liburing/src/arch/x86/syscall.h +160 -0
- data/vendor/liburing/src/include/liburing/barrier.h +81 -0
- data/vendor/liburing/src/include/liburing/io_uring.h +442 -0
- data/vendor/liburing/src/include/liburing.h +921 -0
- data/vendor/liburing/src/int_flags.h +8 -0
- data/vendor/liburing/src/lib.h +57 -0
- data/vendor/liburing/src/liburing.map +53 -0
- data/vendor/liburing/src/nolibc.c +48 -0
- data/vendor/liburing/src/queue.c +403 -0
- data/vendor/liburing/src/register.c +293 -0
- data/vendor/liburing/src/setup.c +332 -0
- data/vendor/liburing/src/syscall.c +47 -0
- data/vendor/liburing/src/syscall.h +103 -0
- data/vendor/liburing/test/232c93d07b74-test.c +306 -0
- data/vendor/liburing/test/35fa71a030ca-test.c +329 -0
- data/vendor/liburing/test/500f9fbadef8-test.c +89 -0
- data/vendor/liburing/test/7ad0e4b2f83c-test.c +93 -0
- data/vendor/liburing/test/8a9973408177-test.c +106 -0
- data/vendor/liburing/test/917257daa0fe-test.c +53 -0
- data/vendor/liburing/test/Makefile +244 -0
- data/vendor/liburing/test/a0908ae19763-test.c +58 -0
- data/vendor/liburing/test/a4c0b3decb33-test.c +180 -0
- data/vendor/liburing/test/accept-link.c +254 -0
- data/vendor/liburing/test/accept-reuse.c +164 -0
- data/vendor/liburing/test/accept-test.c +79 -0
- data/vendor/liburing/test/accept.c +477 -0
- data/vendor/liburing/test/across-fork.c +283 -0
- data/vendor/liburing/test/b19062a56726-test.c +53 -0
- data/vendor/liburing/test/b5837bd5311d-test.c +77 -0
- data/vendor/liburing/test/ce593a6c480a-test.c +136 -0
- data/vendor/liburing/test/close-opath.c +122 -0
- data/vendor/liburing/test/config +10 -0
- data/vendor/liburing/test/connect.c +398 -0
- data/vendor/liburing/test/cq-full.c +96 -0
- data/vendor/liburing/test/cq-overflow.c +294 -0
- data/vendor/liburing/test/cq-peek-batch.c +102 -0
- data/vendor/liburing/test/cq-ready.c +94 -0
- data/vendor/liburing/test/cq-size.c +64 -0
- data/vendor/liburing/test/d4ae271dfaae-test.c +96 -0
- data/vendor/liburing/test/d77a67ed5f27-test.c +65 -0
- data/vendor/liburing/test/defer.c +307 -0
- data/vendor/liburing/test/double-poll-crash.c +185 -0
- data/vendor/liburing/test/drop-submit.c +92 -0
- data/vendor/liburing/test/eeed8b54e0df-test.c +114 -0
- data/vendor/liburing/test/empty-eownerdead.c +45 -0
- data/vendor/liburing/test/eventfd-disable.c +151 -0
- data/vendor/liburing/test/eventfd-reg.c +76 -0
- data/vendor/liburing/test/eventfd-ring.c +97 -0
- data/vendor/liburing/test/eventfd.c +112 -0
- data/vendor/liburing/test/exec-target.c +6 -0
- data/vendor/liburing/test/exit-no-cleanup.c +117 -0
- data/vendor/liburing/test/fadvise.c +202 -0
- data/vendor/liburing/test/fallocate.c +249 -0
- data/vendor/liburing/test/fc2a85cb02ef-test.c +131 -0
- data/vendor/liburing/test/file-register.c +858 -0
- data/vendor/liburing/test/file-update.c +173 -0
- data/vendor/liburing/test/file-verify.c +629 -0
- data/vendor/liburing/test/files-exit-hang-poll.c +128 -0
- data/vendor/liburing/test/files-exit-hang-timeout.c +134 -0
- data/vendor/liburing/test/fixed-link.c +90 -0
- data/vendor/liburing/test/fpos.c +252 -0
- data/vendor/liburing/test/fsync.c +224 -0
- data/vendor/liburing/test/hardlink.c +136 -0
- data/vendor/liburing/test/helpers.c +135 -0
- data/vendor/liburing/test/helpers.h +67 -0
- data/vendor/liburing/test/io-cancel.c +550 -0
- data/vendor/liburing/test/io_uring_enter.c +296 -0
- data/vendor/liburing/test/io_uring_register.c +676 -0
- data/vendor/liburing/test/io_uring_setup.c +192 -0
- data/vendor/liburing/test/iopoll.c +372 -0
- data/vendor/liburing/test/lfs-openat-write.c +119 -0
- data/vendor/liburing/test/lfs-openat.c +275 -0
- data/vendor/liburing/test/link-timeout.c +1107 -0
- data/vendor/liburing/test/link.c +496 -0
- data/vendor/liburing/test/link_drain.c +229 -0
- data/vendor/liburing/test/madvise.c +195 -0
- data/vendor/liburing/test/mkdir.c +108 -0
- data/vendor/liburing/test/msg-ring.c +234 -0
- data/vendor/liburing/test/multicqes_drain.c +387 -0
- data/vendor/liburing/test/nop-all-sizes.c +99 -0
- data/vendor/liburing/test/nop.c +115 -0
- data/vendor/liburing/test/open-close.c +261 -0
- data/vendor/liburing/test/openat2.c +308 -0
- data/vendor/liburing/test/personality.c +204 -0
- data/vendor/liburing/test/pipe-eof.c +83 -0
- data/vendor/liburing/test/pipe-reuse.c +105 -0
- data/vendor/liburing/test/poll-cancel-ton.c +135 -0
- data/vendor/liburing/test/poll-cancel.c +228 -0
- data/vendor/liburing/test/poll-link.c +230 -0
- data/vendor/liburing/test/poll-many.c +208 -0
- data/vendor/liburing/test/poll-mshot-update.c +273 -0
- data/vendor/liburing/test/poll-ring.c +48 -0
- data/vendor/liburing/test/poll-v-poll.c +353 -0
- data/vendor/liburing/test/poll.c +109 -0
- data/vendor/liburing/test/pollfree.c +426 -0
- data/vendor/liburing/test/probe.c +135 -0
- data/vendor/liburing/test/read-write.c +876 -0
- data/vendor/liburing/test/register-restrictions.c +633 -0
- data/vendor/liburing/test/rename.c +135 -0
- data/vendor/liburing/test/ring-leak.c +173 -0
- data/vendor/liburing/test/ring-leak2.c +249 -0
- data/vendor/liburing/test/rsrc_tags.c +449 -0
- data/vendor/liburing/test/runtests-loop.sh +16 -0
- data/vendor/liburing/test/runtests.sh +170 -0
- data/vendor/liburing/test/rw_merge_test.c +97 -0
- data/vendor/liburing/test/self.c +91 -0
- data/vendor/liburing/test/send_recv.c +286 -0
- data/vendor/liburing/test/send_recvmsg.c +345 -0
- data/vendor/liburing/test/sendmsg_fs_cve.c +200 -0
- data/vendor/liburing/test/shared-wq.c +84 -0
- data/vendor/liburing/test/short-read.c +75 -0
- data/vendor/liburing/test/shutdown.c +165 -0
- data/vendor/liburing/test/sigfd-deadlock.c +74 -0
- data/vendor/liburing/test/skip-cqe.c +429 -0
- data/vendor/liburing/test/socket-rw-eagain.c +158 -0
- data/vendor/liburing/test/socket-rw-offset.c +157 -0
- data/vendor/liburing/test/socket-rw.c +145 -0
- data/vendor/liburing/test/splice.c +512 -0
- data/vendor/liburing/test/sq-full-cpp.cc +45 -0
- data/vendor/liburing/test/sq-full.c +45 -0
- data/vendor/liburing/test/sq-poll-dup.c +204 -0
- data/vendor/liburing/test/sq-poll-kthread.c +169 -0
- data/vendor/liburing/test/sq-poll-share.c +137 -0
- data/vendor/liburing/test/sq-space_left.c +159 -0
- data/vendor/liburing/test/sqpoll-cancel-hang.c +157 -0
- data/vendor/liburing/test/sqpoll-disable-exit.c +196 -0
- data/vendor/liburing/test/sqpoll-exit-hang.c +78 -0
- data/vendor/liburing/test/sqpoll-sleep.c +69 -0
- data/vendor/liburing/test/statx.c +172 -0
- data/vendor/liburing/test/stdout.c +232 -0
- data/vendor/liburing/test/submit-link-fail.c +154 -0
- data/vendor/liburing/test/submit-reuse.c +239 -0
- data/vendor/liburing/test/symlink.c +116 -0
- data/vendor/liburing/test/teardowns.c +58 -0
- data/vendor/liburing/test/thread-exit.c +143 -0
- data/vendor/liburing/test/timeout-new.c +252 -0
- data/vendor/liburing/test/timeout-overflow.c +204 -0
- data/vendor/liburing/test/timeout.c +1523 -0
- data/vendor/liburing/test/unlink.c +112 -0
- data/vendor/liburing/test/wakeup-hang.c +162 -0
- metadata +223 -2
@@ -0,0 +1,89 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Description: Single depth submit+wait poll hang test
|
4
|
+
*
|
5
|
+
*/
|
6
|
+
#include <errno.h>
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <unistd.h>
|
9
|
+
#include <stdlib.h>
|
10
|
+
#include <string.h>
|
11
|
+
#include <fcntl.h>
|
12
|
+
|
13
|
+
#include "helpers.h"
|
14
|
+
#include "liburing.h"
|
15
|
+
|
16
|
+
#define BLOCKS 4096
|
17
|
+
|
18
|
+
int main(int argc, char *argv[])
|
19
|
+
{
|
20
|
+
struct io_uring ring;
|
21
|
+
struct io_uring_sqe *sqe;
|
22
|
+
struct io_uring_cqe *cqe;
|
23
|
+
struct iovec iov;
|
24
|
+
char buf[32];
|
25
|
+
off_t offset;
|
26
|
+
unsigned blocks;
|
27
|
+
int ret, fd;
|
28
|
+
|
29
|
+
if (argc > 1)
|
30
|
+
return 0;
|
31
|
+
|
32
|
+
t_posix_memalign(&iov.iov_base, 4096, 4096);
|
33
|
+
iov.iov_len = 4096;
|
34
|
+
|
35
|
+
ret = io_uring_queue_init(1, &ring, IORING_SETUP_IOPOLL);
|
36
|
+
if (ret) {
|
37
|
+
fprintf(stderr, "ring setup failed\n");
|
38
|
+
return 1;
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
sprintf(buf, "./XXXXXX");
|
43
|
+
fd = mkostemp(buf, O_WRONLY | O_DIRECT | O_CREAT);
|
44
|
+
if (fd < 0) {
|
45
|
+
perror("mkostemp");
|
46
|
+
return 1;
|
47
|
+
}
|
48
|
+
|
49
|
+
offset = 0;
|
50
|
+
blocks = BLOCKS;
|
51
|
+
do {
|
52
|
+
sqe = io_uring_get_sqe(&ring);
|
53
|
+
if (!sqe) {
|
54
|
+
fprintf(stderr, "get sqe failed\n");
|
55
|
+
goto err;
|
56
|
+
}
|
57
|
+
io_uring_prep_writev(sqe, fd, &iov, 1, offset);
|
58
|
+
ret = io_uring_submit_and_wait(&ring, 1);
|
59
|
+
if (ret < 0) {
|
60
|
+
fprintf(stderr, "submit_and_wait: %d\n", ret);
|
61
|
+
goto err;
|
62
|
+
}
|
63
|
+
ret = io_uring_wait_cqe(&ring, &cqe);
|
64
|
+
if (ret < 0) {
|
65
|
+
fprintf(stderr, "wait completion: %d\n", ret);
|
66
|
+
goto err;
|
67
|
+
}
|
68
|
+
if (cqe->res != 4096) {
|
69
|
+
if (cqe->res == -EOPNOTSUPP)
|
70
|
+
goto skipped;
|
71
|
+
goto err;
|
72
|
+
}
|
73
|
+
io_uring_cqe_seen(&ring, cqe);
|
74
|
+
offset += 4096;
|
75
|
+
} while (--blocks);
|
76
|
+
|
77
|
+
close(fd);
|
78
|
+
unlink(buf);
|
79
|
+
return 0;
|
80
|
+
err:
|
81
|
+
close(fd);
|
82
|
+
unlink(buf);
|
83
|
+
return 1;
|
84
|
+
skipped:
|
85
|
+
fprintf(stderr, "Polling not supported in current dir, test skipped\n");
|
86
|
+
close(fd);
|
87
|
+
unlink(buf);
|
88
|
+
return 0;
|
89
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <time.h>
|
4
|
+
#include <sys/time.h>
|
5
|
+
#include "liburing.h"
|
6
|
+
|
7
|
+
static unsigned long long mtime_since(const struct timeval *s,
|
8
|
+
const struct timeval *e)
|
9
|
+
{
|
10
|
+
long long sec, usec;
|
11
|
+
|
12
|
+
sec = e->tv_sec - s->tv_sec;
|
13
|
+
usec = (e->tv_usec - s->tv_usec);
|
14
|
+
if (sec > 0 && usec < 0) {
|
15
|
+
sec--;
|
16
|
+
usec += 1000000;
|
17
|
+
}
|
18
|
+
|
19
|
+
sec *= 1000;
|
20
|
+
usec /= 1000;
|
21
|
+
return sec + usec;
|
22
|
+
}
|
23
|
+
|
24
|
+
static unsigned long long mtime_since_now(struct timeval *tv)
|
25
|
+
{
|
26
|
+
struct timeval end;
|
27
|
+
|
28
|
+
gettimeofday(&end, NULL);
|
29
|
+
return mtime_since(tv, &end);
|
30
|
+
}
|
31
|
+
|
32
|
+
int main(int argc, char *argv[])
|
33
|
+
{
|
34
|
+
struct __kernel_timespec ts1, ts2;
|
35
|
+
struct io_uring_cqe *cqe;
|
36
|
+
struct io_uring_sqe *sqe;
|
37
|
+
struct io_uring ring;
|
38
|
+
unsigned long msec;
|
39
|
+
struct timeval tv;
|
40
|
+
int ret;
|
41
|
+
|
42
|
+
if (argc > 1)
|
43
|
+
return 0;
|
44
|
+
|
45
|
+
ret = io_uring_queue_init(32, &ring, 0);
|
46
|
+
if (ret) {
|
47
|
+
fprintf(stderr, "io_uring_queue_init=%d\n", ret);
|
48
|
+
return 1;
|
49
|
+
}
|
50
|
+
|
51
|
+
sqe = io_uring_get_sqe(&ring);
|
52
|
+
io_uring_prep_nop(sqe);
|
53
|
+
ret = io_uring_submit(&ring);
|
54
|
+
if (ret != 1) {
|
55
|
+
fprintf(stderr, "io_uring_submit1=%d\n", ret);
|
56
|
+
return 1;
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
ts1.tv_sec = 5,
|
61
|
+
ts1.tv_nsec = 0;
|
62
|
+
ret = io_uring_wait_cqe_timeout(&ring, &cqe, &ts1);
|
63
|
+
if (ret) {
|
64
|
+
fprintf(stderr, "io_uring_wait_cqe_timeout=%d\n", ret);
|
65
|
+
return 1;
|
66
|
+
}
|
67
|
+
io_uring_cqe_seen(&ring, cqe);
|
68
|
+
gettimeofday(&tv, NULL);
|
69
|
+
|
70
|
+
ts2.tv_sec = 1;
|
71
|
+
ts2.tv_nsec = 0;
|
72
|
+
sqe = io_uring_get_sqe(&ring);
|
73
|
+
io_uring_prep_timeout(sqe, &ts2, 0, 0);
|
74
|
+
sqe->user_data = 89;
|
75
|
+
ret = io_uring_submit(&ring);
|
76
|
+
if (ret != 1) {
|
77
|
+
fprintf(stderr, "io_uring_submit2=%d\n", ret);
|
78
|
+
return 1;
|
79
|
+
}
|
80
|
+
|
81
|
+
io_uring_wait_cqe(&ring, &cqe);
|
82
|
+
io_uring_cqe_seen(&ring, cqe);
|
83
|
+
msec = mtime_since_now(&tv);
|
84
|
+
if (msec >= 900 && msec <= 1100) {
|
85
|
+
io_uring_queue_exit(&ring);
|
86
|
+
return 0;
|
87
|
+
}
|
88
|
+
|
89
|
+
fprintf(stderr, "%s: Timeout seems wonky (got %lu)\n", __FUNCTION__,
|
90
|
+
msec);
|
91
|
+
io_uring_queue_exit(&ring);
|
92
|
+
return 1;
|
93
|
+
}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
#include <errno.h>
|
3
|
+
#include <stdio.h>
|
4
|
+
#include <unistd.h>
|
5
|
+
#include <stdlib.h>
|
6
|
+
#include <string.h>
|
7
|
+
#include <fcntl.h>
|
8
|
+
|
9
|
+
#include "liburing.h"
|
10
|
+
|
11
|
+
static int register_file(struct io_uring *ring)
|
12
|
+
{
|
13
|
+
char buf[32];
|
14
|
+
int ret, fd;
|
15
|
+
|
16
|
+
sprintf(buf, "./XXXXXX");
|
17
|
+
fd = mkstemp(buf);
|
18
|
+
if (fd < 0) {
|
19
|
+
perror("open");
|
20
|
+
return 1;
|
21
|
+
}
|
22
|
+
|
23
|
+
ret = io_uring_register_files(ring, &fd, 1);
|
24
|
+
if (ret) {
|
25
|
+
fprintf(stderr, "file register %d\n", ret);
|
26
|
+
return 1;
|
27
|
+
}
|
28
|
+
|
29
|
+
ret = io_uring_unregister_files(ring);
|
30
|
+
if (ret) {
|
31
|
+
fprintf(stderr, "file register %d\n", ret);
|
32
|
+
return 1;
|
33
|
+
}
|
34
|
+
|
35
|
+
unlink(buf);
|
36
|
+
close(fd);
|
37
|
+
return 0;
|
38
|
+
}
|
39
|
+
|
40
|
+
static int test_single_fsync(struct io_uring *ring)
|
41
|
+
{
|
42
|
+
struct io_uring_cqe *cqe;
|
43
|
+
struct io_uring_sqe *sqe;
|
44
|
+
char buf[32];
|
45
|
+
int fd, ret;
|
46
|
+
|
47
|
+
sprintf(buf, "./XXXXXX");
|
48
|
+
fd = mkstemp(buf);
|
49
|
+
if (fd < 0) {
|
50
|
+
perror("open");
|
51
|
+
return 1;
|
52
|
+
}
|
53
|
+
|
54
|
+
sqe = io_uring_get_sqe(ring);
|
55
|
+
if (!sqe) {
|
56
|
+
printf("get sqe failed\n");
|
57
|
+
goto err;
|
58
|
+
}
|
59
|
+
|
60
|
+
io_uring_prep_fsync(sqe, fd, 0);
|
61
|
+
|
62
|
+
ret = io_uring_submit(ring);
|
63
|
+
if (ret <= 0) {
|
64
|
+
printf("sqe submit failed: %d\n", ret);
|
65
|
+
goto err;
|
66
|
+
}
|
67
|
+
|
68
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
69
|
+
if (ret < 0) {
|
70
|
+
printf("wait completion %d\n", ret);
|
71
|
+
goto err;
|
72
|
+
}
|
73
|
+
|
74
|
+
io_uring_cqe_seen(ring, cqe);
|
75
|
+
unlink(buf);
|
76
|
+
return 0;
|
77
|
+
err:
|
78
|
+
unlink(buf);
|
79
|
+
return 1;
|
80
|
+
}
|
81
|
+
|
82
|
+
int main(int argc, char *argv[])
|
83
|
+
{
|
84
|
+
struct io_uring ring;
|
85
|
+
int ret;
|
86
|
+
|
87
|
+
if (argc > 1)
|
88
|
+
return 0;
|
89
|
+
|
90
|
+
ret = io_uring_queue_init(8, &ring, 0);
|
91
|
+
if (ret) {
|
92
|
+
printf("ring setup failed\n");
|
93
|
+
return 1;
|
94
|
+
}
|
95
|
+
|
96
|
+
ret = register_file(&ring);
|
97
|
+
if (ret)
|
98
|
+
return ret;
|
99
|
+
ret = test_single_fsync(&ring);
|
100
|
+
if (ret) {
|
101
|
+
printf("test_single_fsync failed\n");
|
102
|
+
return ret;
|
103
|
+
}
|
104
|
+
|
105
|
+
return 0;
|
106
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
// autogenerated by syzkaller (https://github.com/google/syzkaller)
|
3
|
+
|
4
|
+
#include <endian.h>
|
5
|
+
#include <stdint.h>
|
6
|
+
#include <stdio.h>
|
7
|
+
#include <stdlib.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <sys/types.h>
|
10
|
+
#include <sys/mman.h>
|
11
|
+
#include <unistd.h>
|
12
|
+
|
13
|
+
#include "liburing.h"
|
14
|
+
#include "../src/syscall.h"
|
15
|
+
|
16
|
+
int main(int argc, char *argv[])
|
17
|
+
{
|
18
|
+
if (argc > 1)
|
19
|
+
return 0;
|
20
|
+
|
21
|
+
mmap((void *) 0x20000000, 0x1000000, 3, 0x32, -1, 0);
|
22
|
+
|
23
|
+
*(uint32_t*)0x20000000 = 0;
|
24
|
+
*(uint32_t*)0x20000004 = 0;
|
25
|
+
*(uint32_t*)0x20000008 = 6;
|
26
|
+
*(uint32_t*)0x2000000c = 0;
|
27
|
+
*(uint32_t*)0x20000010 = 0x3af;
|
28
|
+
*(uint32_t*)0x20000014 = 0;
|
29
|
+
*(uint32_t*)0x20000018 = 0;
|
30
|
+
*(uint32_t*)0x2000001c = 0;
|
31
|
+
*(uint32_t*)0x20000020 = 0;
|
32
|
+
*(uint32_t*)0x20000024 = 0;
|
33
|
+
*(uint32_t*)0x20000028 = 0;
|
34
|
+
*(uint32_t*)0x2000002c = 0;
|
35
|
+
*(uint32_t*)0x20000030 = 0;
|
36
|
+
*(uint32_t*)0x20000034 = 0;
|
37
|
+
*(uint32_t*)0x20000038 = 0;
|
38
|
+
*(uint32_t*)0x2000003c = 0;
|
39
|
+
*(uint32_t*)0x20000040 = 0;
|
40
|
+
*(uint32_t*)0x20000044 = 0;
|
41
|
+
*(uint64_t*)0x20000048 = 0;
|
42
|
+
*(uint32_t*)0x20000050 = 0;
|
43
|
+
*(uint32_t*)0x20000054 = 0;
|
44
|
+
*(uint32_t*)0x20000058 = 0;
|
45
|
+
*(uint32_t*)0x2000005c = 0;
|
46
|
+
*(uint32_t*)0x20000060 = 0;
|
47
|
+
*(uint32_t*)0x20000064 = 0;
|
48
|
+
*(uint32_t*)0x20000068 = 0;
|
49
|
+
*(uint32_t*)0x2000006c = 0;
|
50
|
+
*(uint64_t*)0x20000070 = 0;
|
51
|
+
__sys_io_uring_setup(0x7a6, (struct io_uring_params *) 0x20000000UL);
|
52
|
+
return 0;
|
53
|
+
}
|
@@ -0,0 +1,244 @@
|
|
1
|
+
prefix ?= /usr
|
2
|
+
datadir ?= $(prefix)/share
|
3
|
+
|
4
|
+
INSTALL=install
|
5
|
+
|
6
|
+
ifneq ($(MAKECMDGOALS),clean)
|
7
|
+
include ../config-host.mak
|
8
|
+
endif
|
9
|
+
|
10
|
+
CPPFLAGS ?=
|
11
|
+
|
12
|
+
override CPPFLAGS += \
|
13
|
+
-D_GNU_SOURCE \
|
14
|
+
-D__SANE_USERSPACE_TYPES__ \
|
15
|
+
-I../src/include/ \
|
16
|
+
-include ../config-host.h
|
17
|
+
|
18
|
+
CFLAGS ?= -g -O2 -Wall -Wextra
|
19
|
+
XCFLAGS = -Wno-unused-parameter -Wno-sign-compare
|
20
|
+
|
21
|
+
ifdef CONFIG_HAVE_STRINGOP_OVERFLOW
|
22
|
+
XCFLAGS += -Wstringop-overflow=0
|
23
|
+
endif
|
24
|
+
|
25
|
+
ifdef CONFIG_HAVE_ARRAY_BOUNDS
|
26
|
+
XCFLAGS += -Warray-bounds=0
|
27
|
+
endif
|
28
|
+
|
29
|
+
CXXFLAGS ?= $(CFLAGS)
|
30
|
+
override CFLAGS += $(XCFLAGS) -DLIBURING_BUILD_TEST
|
31
|
+
override CXXFLAGS += $(XCFLAGS) -std=c++11 -DLIBURING_BUILD_TEST
|
32
|
+
|
33
|
+
LDFLAGS ?=
|
34
|
+
override LDFLAGS += -L../src/ -luring
|
35
|
+
|
36
|
+
test_srcs := \
|
37
|
+
232c93d07b74-test.c \
|
38
|
+
35fa71a030ca-test.c \
|
39
|
+
500f9fbadef8-test.c \
|
40
|
+
7ad0e4b2f83c-test.c \
|
41
|
+
8a9973408177-test.c \
|
42
|
+
917257daa0fe-test.c \
|
43
|
+
a0908ae19763-test.c \
|
44
|
+
a4c0b3decb33-test.c \
|
45
|
+
accept.c \
|
46
|
+
accept-link.c \
|
47
|
+
accept-reuse.c \
|
48
|
+
accept-test.c \
|
49
|
+
across-fork.c \
|
50
|
+
b19062a56726-test.c \
|
51
|
+
b5837bd5311d-test.c \
|
52
|
+
ce593a6c480a-test.c \
|
53
|
+
close-opath.c \
|
54
|
+
connect.c \
|
55
|
+
cq-full.c \
|
56
|
+
cq-overflow.c \
|
57
|
+
cq-peek-batch.c \
|
58
|
+
cq-ready.c \
|
59
|
+
cq-size.c \
|
60
|
+
d4ae271dfaae-test.c \
|
61
|
+
d77a67ed5f27-test.c \
|
62
|
+
defer.c \
|
63
|
+
double-poll-crash.c \
|
64
|
+
drop-submit.c \
|
65
|
+
eeed8b54e0df-test.c \
|
66
|
+
empty-eownerdead.c \
|
67
|
+
eventfd.c \
|
68
|
+
eventfd-disable.c \
|
69
|
+
eventfd-reg.c \
|
70
|
+
eventfd-ring.c \
|
71
|
+
exec-target.c \
|
72
|
+
exit-no-cleanup.c \
|
73
|
+
fadvise.c \
|
74
|
+
fallocate.c \
|
75
|
+
fc2a85cb02ef-test.c \
|
76
|
+
file-register.c \
|
77
|
+
files-exit-hang-poll.c \
|
78
|
+
files-exit-hang-timeout.c \
|
79
|
+
file-update.c \
|
80
|
+
file-verify.c \
|
81
|
+
fixed-link.c \
|
82
|
+
fpos.c \
|
83
|
+
fsync.c \
|
84
|
+
hardlink.c \
|
85
|
+
io-cancel.c \
|
86
|
+
iopoll.c \
|
87
|
+
io_uring_enter.c \
|
88
|
+
io_uring_register.c \
|
89
|
+
io_uring_setup.c \
|
90
|
+
lfs-openat.c \
|
91
|
+
lfs-openat-write.c \
|
92
|
+
link.c \
|
93
|
+
link_drain.c \
|
94
|
+
link-timeout.c \
|
95
|
+
madvise.c \
|
96
|
+
mkdir.c \
|
97
|
+
msg-ring.c \
|
98
|
+
multicqes_drain.c \
|
99
|
+
nop-all-sizes.c \
|
100
|
+
nop.c \
|
101
|
+
openat2.c \
|
102
|
+
open-close.c \
|
103
|
+
personality.c \
|
104
|
+
pipe-eof.c \
|
105
|
+
pipe-reuse.c \
|
106
|
+
poll.c \
|
107
|
+
poll-cancel.c \
|
108
|
+
poll-cancel-ton.c \
|
109
|
+
poll-link.c \
|
110
|
+
poll-many.c \
|
111
|
+
poll-mshot-update.c \
|
112
|
+
poll-ring.c \
|
113
|
+
poll-v-poll.c \
|
114
|
+
pollfree.c \
|
115
|
+
probe.c \
|
116
|
+
read-write.c \
|
117
|
+
register-restrictions.c \
|
118
|
+
rename.c \
|
119
|
+
ring-leak2.c \
|
120
|
+
ring-leak.c \
|
121
|
+
rsrc_tags.c \
|
122
|
+
rw_merge_test.c \
|
123
|
+
self.c \
|
124
|
+
sendmsg_fs_cve.c \
|
125
|
+
send_recv.c \
|
126
|
+
send_recvmsg.c \
|
127
|
+
shared-wq.c \
|
128
|
+
short-read.c \
|
129
|
+
shutdown.c \
|
130
|
+
sigfd-deadlock.c \
|
131
|
+
socket-rw.c \
|
132
|
+
socket-rw-eagain.c \
|
133
|
+
socket-rw-offset.c \
|
134
|
+
splice.c \
|
135
|
+
sq-full.c \
|
136
|
+
sq-full-cpp.cc \
|
137
|
+
sqpoll-cancel-hang.c \
|
138
|
+
sqpoll-disable-exit.c \
|
139
|
+
sq-poll-dup.c \
|
140
|
+
sqpoll-exit-hang.c \
|
141
|
+
sq-poll-kthread.c \
|
142
|
+
sq-poll-share.c \
|
143
|
+
sqpoll-sleep.c \
|
144
|
+
sq-space_left.c \
|
145
|
+
stdout.c \
|
146
|
+
submit-link-fail.c \
|
147
|
+
submit-reuse.c \
|
148
|
+
symlink.c \
|
149
|
+
teardowns.c \
|
150
|
+
thread-exit.c \
|
151
|
+
timeout.c \
|
152
|
+
timeout-new.c \
|
153
|
+
timeout-overflow.c \
|
154
|
+
unlink.c \
|
155
|
+
wakeup-hang.c \
|
156
|
+
skip-cqe.c \
|
157
|
+
# EOL
|
158
|
+
|
159
|
+
|
160
|
+
all_targets :=
|
161
|
+
include ../Makefile.quiet
|
162
|
+
|
163
|
+
|
164
|
+
ifdef CONFIG_HAVE_STATX
|
165
|
+
test_srcs += statx.c
|
166
|
+
endif
|
167
|
+
|
168
|
+
ifdef CONFIG_HAVE_GLIBC_STATX
|
169
|
+
test_srcs += statx.c
|
170
|
+
endif
|
171
|
+
all_targets += statx
|
172
|
+
|
173
|
+
|
174
|
+
ifdef CONFIG_HAVE_CXX
|
175
|
+
test_srcs += sq-full-cpp.cc
|
176
|
+
endif
|
177
|
+
all_targets += sq-full-cpp
|
178
|
+
|
179
|
+
|
180
|
+
test_targets := $(patsubst %.c,%,$(patsubst %.cc,%,$(test_srcs)))
|
181
|
+
all_targets += $(test_targets)
|
182
|
+
|
183
|
+
#
|
184
|
+
# Build ../src/syscall.c manually from test's Makefile to support
|
185
|
+
# liburing nolibc.
|
186
|
+
#
|
187
|
+
# Functions in ../src/syscall.c require libc to work with, if we
|
188
|
+
# build liburing without libc, we don't have those functions
|
189
|
+
# in liburing.a. So build it manually here.
|
190
|
+
#
|
191
|
+
helpers = helpers.o ../src/syscall.o
|
192
|
+
|
193
|
+
all: $(test_targets)
|
194
|
+
|
195
|
+
../src/syscall.o: ../src/syscall.c
|
196
|
+
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
197
|
+
|
198
|
+
helpers.o: helpers.c
|
199
|
+
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
200
|
+
|
201
|
+
%: %.c $(helpers) helpers.h ../src/liburing.a
|
202
|
+
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
|
203
|
+
|
204
|
+
%: %.cc $(helpers) helpers.h ../src/liburing.a
|
205
|
+
$(QUIET_CXX)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
|
206
|
+
|
207
|
+
|
208
|
+
35fa71a030ca-test: override LDFLAGS += -lpthread
|
209
|
+
232c93d07b74-test: override LDFLAGS += -lpthread
|
210
|
+
send_recv: override LDFLAGS += -lpthread
|
211
|
+
send_recvmsg: override LDFLAGS += -lpthread
|
212
|
+
poll-link: override LDFLAGS += -lpthread
|
213
|
+
accept-link: override LDFLAGS += -lpthread
|
214
|
+
submit-reuse: override LDFLAGS += -lpthread
|
215
|
+
poll-v-poll: override LDFLAGS += -lpthread
|
216
|
+
across-fork: override LDFLAGS += -lpthread
|
217
|
+
ce593a6c480a-test: override LDFLAGS += -lpthread
|
218
|
+
wakeup-hang: override LDFLAGS += -lpthread
|
219
|
+
pipe-eof: override LDFLAGS += -lpthread
|
220
|
+
timeout-new: override LDFLAGS += -lpthread
|
221
|
+
thread-exit: override LDFLAGS += -lpthread
|
222
|
+
ring-leak2: override LDFLAGS += -lpthread
|
223
|
+
poll-mshot-update: override LDFLAGS += -lpthread
|
224
|
+
exit-no-cleanup: override LDFLAGS += -lpthread
|
225
|
+
pollfree: override LDFLAGS += -lpthread
|
226
|
+
msg-ring: override LDFLAGS += -lpthread
|
227
|
+
|
228
|
+
install: $(test_targets) runtests.sh runtests-loop.sh
|
229
|
+
$(INSTALL) -D -d -m 755 $(datadir)/liburing-test/
|
230
|
+
$(INSTALL) -D -m 755 $(test_targets) $(datadir)/liburing-test/
|
231
|
+
$(INSTALL) -D -m 755 runtests.sh $(datadir)/liburing-test/
|
232
|
+
$(INSTALL) -D -m 755 runtests-loop.sh $(datadir)/liburing-test/
|
233
|
+
|
234
|
+
clean:
|
235
|
+
@rm -f $(all_targets) helpers.o output/*
|
236
|
+
@rm -rf output/
|
237
|
+
|
238
|
+
runtests: all
|
239
|
+
@./runtests.sh $(test_targets)
|
240
|
+
|
241
|
+
runtests-loop: all
|
242
|
+
@./runtests-loop.sh $(test_targets)
|
243
|
+
|
244
|
+
.PHONY: all install clean runtests runtests-loop
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
// autogenerated by syzkaller (https://github.com/google/syzkaller)
|
3
|
+
|
4
|
+
#include <endian.h>
|
5
|
+
#include <stdint.h>
|
6
|
+
#include <stdio.h>
|
7
|
+
#include <stdlib.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <sys/types.h>
|
10
|
+
#include <sys/mman.h>
|
11
|
+
#include <unistd.h>
|
12
|
+
|
13
|
+
#include "liburing.h"
|
14
|
+
#include "../src/syscall.h"
|
15
|
+
|
16
|
+
uint64_t r[1] = {0xffffffffffffffff};
|
17
|
+
|
18
|
+
int main(int argc, char *argv[])
|
19
|
+
{
|
20
|
+
if (argc > 1)
|
21
|
+
return 0;
|
22
|
+
mmap((void *) 0x20000000, 0x1000000, 3, 0x32, -1, 0);
|
23
|
+
intptr_t res = 0;
|
24
|
+
*(uint32_t*)0x20000080 = 0;
|
25
|
+
*(uint32_t*)0x20000084 = 0;
|
26
|
+
*(uint32_t*)0x20000088 = 0;
|
27
|
+
*(uint32_t*)0x2000008c = 0;
|
28
|
+
*(uint32_t*)0x20000090 = 0;
|
29
|
+
*(uint32_t*)0x20000094 = 0;
|
30
|
+
*(uint32_t*)0x20000098 = 0;
|
31
|
+
*(uint32_t*)0x2000009c = 0;
|
32
|
+
*(uint32_t*)0x200000a0 = 0;
|
33
|
+
*(uint32_t*)0x200000a4 = 0;
|
34
|
+
*(uint32_t*)0x200000a8 = 0;
|
35
|
+
*(uint32_t*)0x200000ac = 0;
|
36
|
+
*(uint32_t*)0x200000b0 = 0;
|
37
|
+
*(uint32_t*)0x200000b4 = 0;
|
38
|
+
*(uint32_t*)0x200000b8 = 0;
|
39
|
+
*(uint32_t*)0x200000bc = 0;
|
40
|
+
*(uint32_t*)0x200000c0 = 0;
|
41
|
+
*(uint32_t*)0x200000c4 = 0;
|
42
|
+
*(uint64_t*)0x200000c8 = 0;
|
43
|
+
*(uint32_t*)0x200000d0 = 0;
|
44
|
+
*(uint32_t*)0x200000d4 = 0;
|
45
|
+
*(uint32_t*)0x200000d8 = 0;
|
46
|
+
*(uint32_t*)0x200000dc = 0;
|
47
|
+
*(uint32_t*)0x200000e0 = 0;
|
48
|
+
*(uint32_t*)0x200000e4 = 0;
|
49
|
+
*(uint32_t*)0x200000e8 = 0;
|
50
|
+
*(uint32_t*)0x200000ec = 0;
|
51
|
+
*(uint64_t*)0x200000f0 = 0;
|
52
|
+
res = __sys_io_uring_setup(0xa4, (struct io_uring_params *) 0x20000080);
|
53
|
+
if (res != -1)
|
54
|
+
r[0] = res;
|
55
|
+
*(uint32_t*)0x20000280 = -1;
|
56
|
+
__sys_io_uring_register(r[0], 2, (const void *) 0x20000280, 1);
|
57
|
+
return 0;
|
58
|
+
}
|