uringmachine 0.2 → 0.4
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/CHANGELOG.md +15 -0
- data/README.md +85 -0
- data/TODO.md +5 -0
- data/examples/echo_server.rb +18 -40
- data/examples/inout.rb +19 -0
- data/examples/nc.rb +36 -0
- data/ext/um/extconf.rb +6 -15
- data/ext/um/um.c +340 -53
- data/ext/um/um.h +33 -11
- data/ext/um/um_class.c +101 -119
- data/ext/um/um_const.c +184 -0
- data/ext/um/um_op.c +39 -18
- data/ext/um/um_utils.c +48 -3
- data/lib/uringmachine/version.rb +1 -1
- data/lib/uringmachine.rb +12 -0
- data/test/helper.rb +13 -12
- data/test/test_um.rb +301 -3
- data/vendor/liburing/.github/workflows/build.yml +29 -1
- data/vendor/liburing/.gitignore +1 -0
- data/vendor/liburing/CHANGELOG +15 -0
- data/vendor/liburing/CONTRIBUTING.md +165 -0
- data/vendor/liburing/configure +32 -0
- data/vendor/liburing/examples/Makefile +8 -1
- data/vendor/liburing/examples/kdigest.c +405 -0
- data/vendor/liburing/examples/proxy.c +75 -8
- data/vendor/liburing/liburing.pc.in +1 -1
- data/vendor/liburing/src/Makefile +16 -2
- data/vendor/liburing/src/include/liburing/io_uring.h +31 -0
- data/vendor/liburing/src/include/liburing/sanitize.h +39 -0
- data/vendor/liburing/src/include/liburing.h +31 -4
- data/vendor/liburing/src/liburing-ffi.map +5 -0
- data/vendor/liburing/src/liburing.map +1 -0
- data/vendor/liburing/src/queue.c +3 -0
- data/vendor/liburing/src/register.c +36 -0
- data/vendor/liburing/src/sanitize.c +176 -0
- data/vendor/liburing/src/setup.c +1 -1
- data/vendor/liburing/test/35fa71a030ca.c +7 -0
- data/vendor/liburing/test/500f9fbadef8.c +2 -0
- data/vendor/liburing/test/7ad0e4b2f83c.c +0 -25
- data/vendor/liburing/test/917257daa0fe.c +7 -0
- data/vendor/liburing/test/Makefile +31 -4
- data/vendor/liburing/test/a0908ae19763.c +7 -0
- data/vendor/liburing/test/a4c0b3decb33.c +7 -0
- data/vendor/liburing/test/accept.c +14 -4
- data/vendor/liburing/test/b19062a56726.c +7 -0
- data/vendor/liburing/test/bind-listen.c +2 -2
- data/vendor/liburing/test/buf-ring-nommap.c +10 -3
- data/vendor/liburing/test/buf-ring.c +2 -0
- data/vendor/liburing/test/coredump.c +7 -0
- data/vendor/liburing/test/cq-overflow.c +13 -1
- data/vendor/liburing/test/d4ae271dfaae.c +11 -3
- data/vendor/liburing/test/defer-taskrun.c +2 -2
- data/vendor/liburing/test/defer-tw-timeout.c +4 -1
- data/vendor/liburing/test/defer.c +2 -2
- data/vendor/liburing/test/double-poll-crash.c +1 -1
- data/vendor/liburing/test/eeed8b54e0df.c +2 -0
- data/vendor/liburing/test/eventfd.c +0 -1
- data/vendor/liburing/test/exit-no-cleanup.c +11 -0
- data/vendor/liburing/test/fadvise.c +9 -26
- data/vendor/liburing/test/fdinfo.c +9 -1
- data/vendor/liburing/test/file-register.c +14 -2
- data/vendor/liburing/test/file-update.c +1 -1
- data/vendor/liburing/test/file-verify.c +27 -16
- data/vendor/liburing/test/files-exit-hang-timeout.c +1 -2
- data/vendor/liburing/test/fixed-buf-iter.c +3 -1
- data/vendor/liburing/test/fixed-hugepage.c +12 -1
- data/vendor/liburing/test/fsnotify.c +1 -0
- data/vendor/liburing/test/futex.c +16 -4
- data/vendor/liburing/test/helpers.c +47 -0
- data/vendor/liburing/test/helpers.h +6 -0
- data/vendor/liburing/test/init-mem.c +5 -3
- data/vendor/liburing/test/io-cancel.c +0 -24
- data/vendor/liburing/test/io_uring_passthrough.c +2 -0
- data/vendor/liburing/test/io_uring_register.c +25 -6
- data/vendor/liburing/test/iopoll-leak.c +4 -0
- data/vendor/liburing/test/iopoll-overflow.c +1 -1
- data/vendor/liburing/test/iopoll.c +3 -3
- data/vendor/liburing/test/kallsyms.c +203 -0
- data/vendor/liburing/test/link-timeout.c +159 -0
- data/vendor/liburing/test/linked-defer-close.c +224 -0
- data/vendor/liburing/test/madvise.c +12 -25
- data/vendor/liburing/test/min-timeout-wait.c +0 -25
- data/vendor/liburing/test/min-timeout.c +0 -25
- data/vendor/liburing/test/mkdir.c +6 -0
- data/vendor/liburing/test/msg-ring.c +8 -2
- data/vendor/liburing/test/napi-test.c +15 -2
- data/vendor/liburing/test/no-mmap-inval.c +2 -0
- data/vendor/liburing/test/nop.c +44 -0
- data/vendor/liburing/test/ooo-file-unreg.c +1 -1
- data/vendor/liburing/test/open-close.c +40 -0
- data/vendor/liburing/test/openat2.c +37 -14
- data/vendor/liburing/test/poll-many.c +13 -7
- data/vendor/liburing/test/poll-mshot-update.c +17 -10
- data/vendor/liburing/test/poll-v-poll.c +6 -3
- data/vendor/liburing/test/pollfree.c +148 -0
- data/vendor/liburing/test/read-mshot-empty.c +156 -153
- data/vendor/liburing/test/read-mshot.c +276 -27
- data/vendor/liburing/test/read-write.c +78 -13
- data/vendor/liburing/test/recv-msgall-stream.c +3 -0
- data/vendor/liburing/test/recv-msgall.c +5 -0
- data/vendor/liburing/test/recvsend_bundle-inc.c +680 -0
- data/vendor/liburing/test/recvsend_bundle.c +92 -29
- data/vendor/liburing/test/reg-fd-only.c +14 -4
- data/vendor/liburing/test/regbuf-clone.c +187 -0
- data/vendor/liburing/test/regbuf-merge.c +7 -0
- data/vendor/liburing/test/register-restrictions.c +86 -85
- data/vendor/liburing/test/rename.c +59 -1
- data/vendor/liburing/test/ringbuf-read.c +5 -0
- data/vendor/liburing/test/ringbuf-status.c +5 -1
- data/vendor/liburing/test/runtests.sh +16 -1
- data/vendor/liburing/test/send-zerocopy.c +59 -0
- data/vendor/liburing/test/short-read.c +1 -0
- data/vendor/liburing/test/socket.c +43 -0
- data/vendor/liburing/test/splice.c +3 -1
- data/vendor/liburing/test/sq-poll-dup.c +1 -1
- data/vendor/liburing/test/sq-poll-share.c +2 -0
- data/vendor/liburing/test/sqpoll-disable-exit.c +8 -0
- data/vendor/liburing/test/sqpoll-exit-hang.c +1 -25
- data/vendor/liburing/test/sqpoll-sleep.c +1 -25
- data/vendor/liburing/test/statx.c +89 -0
- data/vendor/liburing/test/stdout.c +2 -0
- data/vendor/liburing/test/submit-and-wait.c +1 -25
- data/vendor/liburing/test/submit-reuse.c +4 -26
- data/vendor/liburing/test/symlink.c +12 -1
- data/vendor/liburing/test/sync-cancel.c +48 -21
- data/vendor/liburing/test/thread-exit.c +5 -0
- data/vendor/liburing/test/timeout-new.c +1 -26
- data/vendor/liburing/test/timeout.c +12 -26
- data/vendor/liburing/test/unlink.c +94 -1
- data/vendor/liburing/test/uring_cmd_ublk.c +1252 -0
- data/vendor/liburing/test/waitid.c +62 -8
- data/vendor/liburing/test/wq-aff.c +35 -0
- data/vendor/liburing/test/xfail_prep_link_timeout_out_of_scope.c +46 -0
- data/vendor/liburing/test/xfail_register_buffers_out_of_scope.c +51 -0
- metadata +17 -4
- data/examples/event_loop.rb +0 -69
- data/examples/fibers.rb +0 -105
|
@@ -27,6 +27,10 @@ ifdef CONFIG_HAVE_ARRAY_BOUNDS
|
|
|
27
27
|
XCFLAGS += -Warray-bounds=0
|
|
28
28
|
endif
|
|
29
29
|
|
|
30
|
+
ifeq ($(CONFIG_USE_SANITIZER),y)
|
|
31
|
+
XCFLAGS += -fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
32
|
+
endif
|
|
33
|
+
|
|
30
34
|
CXXFLAGS ?= $(CFLAGS)
|
|
31
35
|
override CFLAGS += $(XCFLAGS) -DLIBURING_BUILD_TEST
|
|
32
36
|
override CXXFLAGS += $(XCFLAGS) -std=c++11 -DLIBURING_BUILD_TEST
|
|
@@ -114,11 +118,13 @@ test_srcs := \
|
|
|
114
118
|
io_uring_passthrough.c \
|
|
115
119
|
io_uring_register.c \
|
|
116
120
|
io_uring_setup.c \
|
|
121
|
+
kallsyms.c \
|
|
117
122
|
lfs-openat.c \
|
|
118
123
|
lfs-openat-write.c \
|
|
119
124
|
link.c \
|
|
120
125
|
link_drain.c \
|
|
121
126
|
link-timeout.c \
|
|
127
|
+
linked-defer-close.c \
|
|
122
128
|
madvise.c \
|
|
123
129
|
min-timeout.c \
|
|
124
130
|
min-timeout-wait.c \
|
|
@@ -130,7 +136,6 @@ test_srcs := \
|
|
|
130
136
|
multicqes_drain.c \
|
|
131
137
|
napi-test.c \
|
|
132
138
|
no-mmap-inval.c \
|
|
133
|
-
nolibc.c \
|
|
134
139
|
nop-all-sizes.c \
|
|
135
140
|
nop.c \
|
|
136
141
|
ooo-file-unreg.c \
|
|
@@ -154,6 +159,7 @@ test_srcs := \
|
|
|
154
159
|
poll-race-mshot.c \
|
|
155
160
|
poll-ring.c \
|
|
156
161
|
poll-v-poll.c \
|
|
162
|
+
pollfree.c \
|
|
157
163
|
probe.c \
|
|
158
164
|
read-before-exit.c \
|
|
159
165
|
read-mshot.c \
|
|
@@ -165,6 +171,7 @@ test_srcs := \
|
|
|
165
171
|
reg-fd-only.c \
|
|
166
172
|
reg-hint.c \
|
|
167
173
|
reg-reg-ring.c \
|
|
174
|
+
regbuf-clone.c \
|
|
168
175
|
regbuf-merge.c \
|
|
169
176
|
register-restrictions.c \
|
|
170
177
|
rename.c \
|
|
@@ -176,6 +183,7 @@ test_srcs := \
|
|
|
176
183
|
rw_merge_test.c \
|
|
177
184
|
self.c \
|
|
178
185
|
recvsend_bundle.c \
|
|
186
|
+
recvsend_bundle-inc.c \
|
|
179
187
|
send_recv.c \
|
|
180
188
|
send_recvmsg.c \
|
|
181
189
|
send-zerocopy.c \
|
|
@@ -215,6 +223,7 @@ test_srcs := \
|
|
|
215
223
|
truncate.c \
|
|
216
224
|
tty-write-dpoll.c \
|
|
217
225
|
unlink.c \
|
|
226
|
+
uring_cmd_ublk.c \
|
|
218
227
|
version.c \
|
|
219
228
|
waitid.c \
|
|
220
229
|
wait-timeout.c \
|
|
@@ -223,9 +232,19 @@ test_srcs := \
|
|
|
223
232
|
xattr.c \
|
|
224
233
|
# EOL
|
|
225
234
|
|
|
235
|
+
# Please keep this list sorted alphabetically.
|
|
236
|
+
asan_test_srcs := \
|
|
237
|
+
xfail_prep_link_timeout_out_of_scope.c \
|
|
238
|
+
xfail_register_buffers_out_of_scope.c \
|
|
239
|
+
# EOL
|
|
240
|
+
|
|
226
241
|
all_targets :=
|
|
227
242
|
include ../Makefile.quiet
|
|
228
243
|
|
|
244
|
+
ifeq ($(CONFIG_NOLIBC),y)
|
|
245
|
+
test_srcs += nolibc.c
|
|
246
|
+
endif
|
|
247
|
+
|
|
229
248
|
ifdef CONFIG_HAVE_STATX
|
|
230
249
|
test_srcs += statx.c
|
|
231
250
|
else ifdef CONFIG_HAVE_GLIBC_STATX
|
|
@@ -246,7 +265,15 @@ test_targets := $(patsubst %,%.t,$(test_targets))
|
|
|
246
265
|
all_targets += $(test_targets)
|
|
247
266
|
helpers = helpers.o
|
|
248
267
|
|
|
249
|
-
|
|
268
|
+
ifeq ($(CONFIG_USE_SANITIZER),y)
|
|
269
|
+
asan_test_targets := $(patsubst %.c,%,$(asan_test_srcs))
|
|
270
|
+
asan_test_targets := $(patsubst %.cc,%,$(asan_test_targets))
|
|
271
|
+
asan_run_test_targets := $(patsubst %,%.run_test,$(asan_test_targets))
|
|
272
|
+
asan_test_targets := $(patsubst %,%.t,$(asan_test_targets))
|
|
273
|
+
all_targets += $(asan_test_targets)
|
|
274
|
+
endif
|
|
275
|
+
|
|
276
|
+
all: $(test_targets) $(asan_test_targets)
|
|
250
277
|
|
|
251
278
|
helpers.o: helpers.c
|
|
252
279
|
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
|
@@ -283,10 +310,10 @@ clean:
|
|
|
283
310
|
@rm -rf output/
|
|
284
311
|
|
|
285
312
|
runtests: all
|
|
286
|
-
@./runtests.sh $(test_targets)
|
|
313
|
+
@./runtests.sh $(test_targets) $(asan_test_targets)
|
|
287
314
|
|
|
288
315
|
runtests-loop: all
|
|
289
|
-
@./runtests-loop.sh $(test_targets)
|
|
316
|
+
@./runtests-loop.sh $(test_targets) $(asan_test_targets)
|
|
290
317
|
|
|
291
318
|
%.run_test: %.t
|
|
292
319
|
@./runtests-quiet.sh $<
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include "helpers.h"
|
|
15
15
|
#include "../src/syscall.h"
|
|
16
16
|
|
|
17
|
+
#ifndef CONFIG_USE_SANITIZER
|
|
17
18
|
static uint64_t r[1] = {0xffffffffffffffff};
|
|
18
19
|
|
|
19
20
|
int main(int argc, char *argv[])
|
|
@@ -57,3 +58,9 @@ int main(int argc, char *argv[])
|
|
|
57
58
|
__sys_io_uring_register(r[0], 2, (const void *) 0x20000280, 1);
|
|
58
59
|
return T_EXIT_PASS;
|
|
59
60
|
}
|
|
61
|
+
#else
|
|
62
|
+
int main(int argc, char *argv[])
|
|
63
|
+
{
|
|
64
|
+
return T_EXIT_SKIP;
|
|
65
|
+
}
|
|
66
|
+
#endif
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
#include "helpers.h"
|
|
25
25
|
#include "../src/syscall.h"
|
|
26
26
|
|
|
27
|
+
#ifndef CONFIG_USE_SANITIZER
|
|
27
28
|
static void sleep_ms(uint64_t ms)
|
|
28
29
|
{
|
|
29
30
|
usleep(ms * 1000);
|
|
@@ -179,3 +180,9 @@ int main(int argc, char *argv[])
|
|
|
179
180
|
loop();
|
|
180
181
|
return T_EXIT_PASS;
|
|
181
182
|
}
|
|
183
|
+
#else
|
|
184
|
+
int main(int argc, char *argv[])
|
|
185
|
+
{
|
|
186
|
+
return T_EXIT_SKIP;
|
|
187
|
+
}
|
|
188
|
+
#endif
|
|
@@ -60,7 +60,7 @@ static void close_sock_fds(int s_fd[], int c_fd[], int nr, bool fixed)
|
|
|
60
60
|
close_fds(c_fd, nr);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
static void queue_send(struct io_uring *ring, int fd)
|
|
63
|
+
static void *queue_send(struct io_uring *ring, int fd)
|
|
64
64
|
{
|
|
65
65
|
struct io_uring_sqe *sqe;
|
|
66
66
|
struct data *d;
|
|
@@ -72,9 +72,11 @@ static void queue_send(struct io_uring *ring, int fd)
|
|
|
72
72
|
sqe = io_uring_get_sqe(ring);
|
|
73
73
|
io_uring_prep_writev(sqe, fd, &d->iov, 1, 0);
|
|
74
74
|
sqe->user_data = 1;
|
|
75
|
+
|
|
76
|
+
return d;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
static void queue_recv(struct io_uring *ring, int fd, bool fixed)
|
|
79
|
+
static void *queue_recv(struct io_uring *ring, int fd, bool fixed)
|
|
78
80
|
{
|
|
79
81
|
struct io_uring_sqe *sqe;
|
|
80
82
|
struct data *d;
|
|
@@ -88,6 +90,8 @@ static void queue_recv(struct io_uring *ring, int fd, bool fixed)
|
|
|
88
90
|
sqe->user_data = 2;
|
|
89
91
|
if (fixed)
|
|
90
92
|
sqe->flags |= IOSQE_FIXED_FILE;
|
|
93
|
+
|
|
94
|
+
return d;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
static void queue_accept_multishot(struct io_uring *ring, int fd,
|
|
@@ -274,6 +278,8 @@ static int test_loop(struct io_uring *ring,
|
|
|
274
278
|
int nr_fds = multishot ? MAX_FDS : 1;
|
|
275
279
|
int multishot_idx = multishot ? INITIAL_USER_DATA : 0;
|
|
276
280
|
int err_ret = T_EXIT_FAIL;
|
|
281
|
+
void* send_d = 0;
|
|
282
|
+
void* recv_d = 0;
|
|
277
283
|
|
|
278
284
|
if (args.overflow)
|
|
279
285
|
cause_overflow(ring);
|
|
@@ -340,8 +346,8 @@ static int test_loop(struct io_uring *ring,
|
|
|
340
346
|
goto out;
|
|
341
347
|
}
|
|
342
348
|
|
|
343
|
-
queue_send(ring, c_fd[0]);
|
|
344
|
-
queue_recv(ring, s_fd[0], fixed);
|
|
349
|
+
send_d = queue_send(ring, c_fd[0]);
|
|
350
|
+
recv_d = queue_recv(ring, s_fd[0], fixed);
|
|
345
351
|
|
|
346
352
|
ret = io_uring_submit_and_wait(ring, 2);
|
|
347
353
|
assert(ret != -1);
|
|
@@ -365,9 +371,13 @@ static int test_loop(struct io_uring *ring,
|
|
|
365
371
|
}
|
|
366
372
|
|
|
367
373
|
out:
|
|
374
|
+
free(send_d);
|
|
375
|
+
free(recv_d);
|
|
368
376
|
close_sock_fds(s_fd, c_fd, nr_fds, fixed);
|
|
369
377
|
return T_EXIT_PASS;
|
|
370
378
|
err:
|
|
379
|
+
free(send_d);
|
|
380
|
+
free(recv_d);
|
|
371
381
|
close_sock_fds(s_fd, c_fd, nr_fds, fixed);
|
|
372
382
|
return err_ret;
|
|
373
383
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include "helpers.h"
|
|
15
15
|
#include "../src/syscall.h"
|
|
16
16
|
|
|
17
|
+
#ifndef CONFIG_USE_SANITIZER
|
|
17
18
|
int main(int argc, char *argv[])
|
|
18
19
|
{
|
|
19
20
|
if (argc > 1)
|
|
@@ -52,3 +53,9 @@ int main(int argc, char *argv[])
|
|
|
52
53
|
__sys_io_uring_setup(0xc9f, (struct io_uring_params *) 0x20000200);
|
|
53
54
|
return T_EXIT_PASS;
|
|
54
55
|
}
|
|
56
|
+
#else
|
|
57
|
+
int main(int argc, char *argv[])
|
|
58
|
+
{
|
|
59
|
+
return T_EXIT_SKIP;
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
@@ -54,7 +54,7 @@ static int connect_client(struct io_uring *ring, unsigned short peer_port)
|
|
|
54
54
|
|
|
55
55
|
sqe = io_uring_get_sqe(ring);
|
|
56
56
|
io_uring_prep_send(sqe, CLI_INDEX, magic, strlen(magic), 0);
|
|
57
|
-
sqe->flags |= IOSQE_FIXED_FILE
|
|
57
|
+
sqe->flags |= IOSQE_FIXED_FILE;
|
|
58
58
|
|
|
59
59
|
submitted = ret = io_uring_submit(ring);
|
|
60
60
|
if (ret < 0)
|
|
@@ -180,7 +180,7 @@ static int test_good_server(unsigned int ring_flags)
|
|
|
180
180
|
io_uring_cqe_seen(&ring, cqe);
|
|
181
181
|
|
|
182
182
|
sqe = io_uring_get_sqe(&ring);
|
|
183
|
-
io_uring_prep_recv(sqe, CONN_INDEX, buf,
|
|
183
|
+
io_uring_prep_recv(sqe, CONN_INDEX, buf, sizeof(buf), 0);
|
|
184
184
|
sqe->flags |= IOSQE_FIXED_FILE;
|
|
185
185
|
|
|
186
186
|
io_uring_submit(&ring);
|
|
@@ -46,8 +46,10 @@ int main(int argc, char *argv[])
|
|
|
46
46
|
p.flags = IORING_SETUP_NO_MMAP;
|
|
47
47
|
ret = io_uring_queue_init_mem(1, &ring, &p, ring_mem, 16384);
|
|
48
48
|
if (ret < 0) {
|
|
49
|
-
if (ret == -EINVAL || ret == -ENOMEM)
|
|
49
|
+
if (ret == -EINVAL || ret == -ENOMEM) {
|
|
50
|
+
free(ring_mem);
|
|
50
51
|
return T_EXIT_SKIP;
|
|
52
|
+
}
|
|
51
53
|
fprintf(stderr, "queue init failed %d\n", ret);
|
|
52
54
|
return T_EXIT_FAIL;
|
|
53
55
|
}
|
|
@@ -62,8 +64,10 @@ int main(int argc, char *argv[])
|
|
|
62
64
|
|
|
63
65
|
ret = io_uring_register_buf_ring(&ring, ®, 0);
|
|
64
66
|
if (ret) {
|
|
65
|
-
if (ret == -EINVAL)
|
|
67
|
+
if (ret == -EINVAL) {
|
|
68
|
+
free(ring_mem);
|
|
66
69
|
return T_EXIT_SKIP;
|
|
70
|
+
}
|
|
67
71
|
fprintf(stderr, "reg buf ring: %d\n", ret);
|
|
68
72
|
return T_EXIT_FAIL;
|
|
69
73
|
}
|
|
@@ -73,8 +77,10 @@ int main(int argc, char *argv[])
|
|
|
73
77
|
br = mmap(NULL, ring_size, PROT_READ | PROT_WRITE,
|
|
74
78
|
MAP_SHARED | MAP_POPULATE, ring.ring_fd, off);
|
|
75
79
|
if (br == MAP_FAILED) {
|
|
76
|
-
if (errno == ENOMEM)
|
|
80
|
+
if (errno == ENOMEM) {
|
|
81
|
+
free(ring_mem);
|
|
77
82
|
return T_EXIT_SKIP;
|
|
83
|
+
}
|
|
78
84
|
perror("mmap");
|
|
79
85
|
return T_EXIT_FAIL;
|
|
80
86
|
}
|
|
@@ -119,5 +125,6 @@ int main(int argc, char *argv[])
|
|
|
119
125
|
io_uring_cqe_seen(&ring, cqe);
|
|
120
126
|
|
|
121
127
|
io_uring_queue_exit(&ring);
|
|
128
|
+
free(ring_mem);
|
|
122
129
|
return T_EXIT_PASS;
|
|
123
130
|
}
|
|
@@ -57,6 +57,7 @@ static int test_mixed_reg2(int bgid)
|
|
|
57
57
|
|
|
58
58
|
io_uring_free_buf_ring(&ring, br, 32, bgid);
|
|
59
59
|
io_uring_queue_exit(&ring);
|
|
60
|
+
free(bufs);
|
|
60
61
|
return 0;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -99,6 +100,7 @@ static int test_mixed_reg(int bgid)
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
io_uring_queue_exit(&ring);
|
|
103
|
+
free(bufs);
|
|
102
104
|
return 0;
|
|
103
105
|
}
|
|
104
106
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include "liburing.h"
|
|
17
17
|
#include "helpers.h"
|
|
18
18
|
|
|
19
|
+
#ifndef CONFIG_USE_SANITIZER
|
|
19
20
|
static void test(void)
|
|
20
21
|
{
|
|
21
22
|
struct io_uring_sqe *sqe;
|
|
@@ -58,3 +59,9 @@ int main(int argc, char *argv[])
|
|
|
58
59
|
unlink("core");
|
|
59
60
|
return T_EXIT_PASS;
|
|
60
61
|
}
|
|
62
|
+
#else
|
|
63
|
+
int main(int argc, char *argv[])
|
|
64
|
+
{
|
|
65
|
+
return T_EXIT_SKIP;
|
|
66
|
+
}
|
|
67
|
+
#endif
|
|
@@ -88,8 +88,10 @@ static int test_io(const char *file, unsigned long usecs, unsigned *drops,
|
|
|
88
88
|
goto err;
|
|
89
89
|
}
|
|
90
90
|
offset = BS * (rand() % BUFFERS);
|
|
91
|
-
if (fault && i == ENTRIES + 4)
|
|
91
|
+
if (fault && i == ENTRIES + 4) {
|
|
92
|
+
free(vecs[i].iov_base);
|
|
92
93
|
vecs[i].iov_base = NULL;
|
|
94
|
+
}
|
|
93
95
|
io_uring_prep_readv(sqe, fd, &vecs[i], 1, offset);
|
|
94
96
|
|
|
95
97
|
ret = io_uring_submit(&ring);
|
|
@@ -523,8 +525,18 @@ int main(int argc, char *argv[])
|
|
|
523
525
|
}
|
|
524
526
|
|
|
525
527
|
unlink(fname);
|
|
528
|
+
if(vecs != NULL) {
|
|
529
|
+
for (i = 0; i < BUFFERS; i++)
|
|
530
|
+
free(vecs[i].iov_base);
|
|
531
|
+
}
|
|
532
|
+
free(vecs);
|
|
526
533
|
return T_EXIT_PASS;
|
|
527
534
|
err:
|
|
528
535
|
unlink(fname);
|
|
536
|
+
if(vecs != NULL) {
|
|
537
|
+
for (i = 0; i < BUFFERS; i++)
|
|
538
|
+
free(vecs[i].iov_base);
|
|
539
|
+
}
|
|
540
|
+
free(vecs);
|
|
529
541
|
return T_EXIT_FAIL;
|
|
530
542
|
}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
int main(int argc, char *argv[])
|
|
20
20
|
{
|
|
21
21
|
struct io_uring ring;
|
|
22
|
-
int i, fd, ret;
|
|
22
|
+
int i, fd, ret, __e;
|
|
23
23
|
struct io_uring_sqe *sqe;
|
|
24
24
|
struct io_uring_cqe *cqe;
|
|
25
|
-
struct iovec *iovecs;
|
|
25
|
+
struct iovec *iovecs = NULL;
|
|
26
26
|
struct io_uring_params p;
|
|
27
27
|
char *fname;
|
|
28
28
|
void *buf;
|
|
@@ -43,10 +43,13 @@ int main(int argc, char *argv[])
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
fd = open(fname, O_RDONLY | O_DIRECT);
|
|
46
|
+
__e = errno;
|
|
46
47
|
if (fname != argv[1])
|
|
47
48
|
unlink(fname);
|
|
48
49
|
if (fd < 0) {
|
|
49
|
-
|
|
50
|
+
if (__e == EINVAL || __e == EPERM || __e == EACCES)
|
|
51
|
+
return T_EXIT_SKIP;
|
|
52
|
+
fprintf(stderr, "open: %s\n", strerror(__e));
|
|
50
53
|
goto out;
|
|
51
54
|
}
|
|
52
55
|
|
|
@@ -92,5 +95,10 @@ int main(int argc, char *argv[])
|
|
|
92
95
|
close(fd);
|
|
93
96
|
out:
|
|
94
97
|
io_uring_queue_exit(&ring);
|
|
98
|
+
if (iovecs != NULL) { //
|
|
99
|
+
for (i = 0; i < 10; i++)
|
|
100
|
+
free(iovecs[i].iov_base);
|
|
101
|
+
free(iovecs);
|
|
102
|
+
}
|
|
95
103
|
return ret;
|
|
96
104
|
}
|
|
@@ -196,12 +196,12 @@ static int test_exec(const char *filename)
|
|
|
196
196
|
|
|
197
197
|
if (filename) {
|
|
198
198
|
fd = open(filename, O_RDONLY | O_DIRECT);
|
|
199
|
-
if (fd < 0 && errno == EINVAL)
|
|
199
|
+
if (fd < 0 && (errno == EINVAL || errno == EPERM || errno == EACCES))
|
|
200
200
|
return T_EXIT_SKIP;
|
|
201
201
|
} else {
|
|
202
202
|
t_create_file(EXEC_FILENAME, EXEC_FILESIZE);
|
|
203
203
|
fd = open(EXEC_FILENAME, O_RDONLY | O_DIRECT);
|
|
204
|
-
if (fd < 0 && errno == EINVAL) {
|
|
204
|
+
if (fd < 0 && (errno == EINVAL || errno == EPERM || errno == EACCES)) {
|
|
205
205
|
unlink(EXEC_FILENAME);
|
|
206
206
|
return T_EXIT_SKIP;
|
|
207
207
|
}
|
|
@@ -99,7 +99,7 @@ static int test_file(struct io_uring *ring, char *__fname)
|
|
|
99
99
|
|
|
100
100
|
fd = open(fname, O_RDONLY | O_DIRECT);
|
|
101
101
|
if (fd < 0) {
|
|
102
|
-
if (errno == EINVAL) {
|
|
102
|
+
if (errno == EINVAL || errno == EPERM || errno == EACCES) {
|
|
103
103
|
if (!__fname)
|
|
104
104
|
unlink(fname);
|
|
105
105
|
return T_EXIT_SKIP;
|
|
@@ -128,6 +128,7 @@ static int test_file(struct io_uring *ring, char *__fname)
|
|
|
128
128
|
if (ret != 1) {
|
|
129
129
|
fprintf(stderr, "unexpected wait ret %d\n", ret);
|
|
130
130
|
close(fd);
|
|
131
|
+
free(buf);
|
|
131
132
|
return T_EXIT_FAIL;
|
|
132
133
|
}
|
|
133
134
|
|
|
@@ -141,10 +142,12 @@ static int test_file(struct io_uring *ring, char *__fname)
|
|
|
141
142
|
if (i != 1) {
|
|
142
143
|
fprintf(stderr, "Got %d request, expected 1\n", i);
|
|
143
144
|
close(fd);
|
|
145
|
+
free(buf);
|
|
144
146
|
return T_EXIT_FAIL;
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
close(fd);
|
|
150
|
+
free(buf);
|
|
148
151
|
return T_EXIT_PASS;
|
|
149
152
|
}
|
|
150
153
|
|
|
@@ -96,7 +96,7 @@ static int test_canceled_userdata(struct io_uring *ring)
|
|
|
96
96
|
if (init_context(&ctx, ring, nr, OP_NOP))
|
|
97
97
|
return 1;
|
|
98
98
|
|
|
99
|
-
for (i = 0; i < nr; i++)
|
|
99
|
+
for (i = 0; i < nr - 1; i++)
|
|
100
100
|
ctx.sqes[i]->flags |= IOSQE_IO_LINK;
|
|
101
101
|
|
|
102
102
|
ret = io_uring_submit(ring);
|
|
@@ -130,7 +130,7 @@ static int test_thread_link_cancel(struct io_uring *ring)
|
|
|
130
130
|
if (init_context(&ctx, ring, nr, OP_REMOVE_BUFFERS))
|
|
131
131
|
return 1;
|
|
132
132
|
|
|
133
|
-
for (i = 0; i < nr; i++)
|
|
133
|
+
for (i = 0; i < nr - 1; i++)
|
|
134
134
|
ctx.sqes[i]->flags |= IOSQE_IO_LINK;
|
|
135
135
|
|
|
136
136
|
ret = io_uring_submit(ring);
|
|
@@ -114,7 +114,7 @@ static uint64_t r[4] = {0xffffffffffffffff, 0x0, 0x0, 0xffffffffffffffff};
|
|
|
114
114
|
int main(int argc, char *argv[])
|
|
115
115
|
{
|
|
116
116
|
void *mmap_ret;
|
|
117
|
-
#if !defined(__i386) && !defined(__x86_64__)
|
|
117
|
+
#if (!defined(__i386) && !defined(__x86_64__)) || defined(CONFIG_USE_SANITIZER)
|
|
118
118
|
return T_EXIT_SKIP;
|
|
119
119
|
#endif
|
|
120
120
|
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
#include "liburing.h"
|
|
20
20
|
#include "helpers.h"
|
|
21
21
|
|
|
22
|
+
// on fast enough machines with enough cores, the first few threads will post
|
|
23
|
+
// enough sem's to cause the main thread to exit while some threads are half way
|
|
24
|
+
// initialization. This causes a null deference somewhere in thread cleanup,
|
|
25
|
+
// which trips ASAN.
|
|
26
|
+
#ifndef CONFIG_USE_SANITIZER
|
|
22
27
|
#define IORING_ENTRIES 8
|
|
23
28
|
|
|
24
29
|
static pthread_t *threads;
|
|
@@ -115,3 +120,9 @@ int main(int argc, char *argv[])
|
|
|
115
120
|
// Exit without resource cleanup
|
|
116
121
|
exit(EXIT_SUCCESS);
|
|
117
122
|
}
|
|
123
|
+
#else
|
|
124
|
+
int main(int argc, char *argv[])
|
|
125
|
+
{
|
|
126
|
+
return T_EXIT_SKIP;
|
|
127
|
+
}
|
|
128
|
+
#endif
|
|
@@ -18,30 +18,6 @@
|
|
|
18
18
|
#define LOOPS 100
|
|
19
19
|
#define MIN_LOOPS 10
|
|
20
20
|
|
|
21
|
-
static unsigned long long utime_since(const struct timeval *s,
|
|
22
|
-
const struct timeval *e)
|
|
23
|
-
{
|
|
24
|
-
long long sec, usec;
|
|
25
|
-
|
|
26
|
-
sec = e->tv_sec - s->tv_sec;
|
|
27
|
-
usec = (e->tv_usec - s->tv_usec);
|
|
28
|
-
if (sec > 0 && usec < 0) {
|
|
29
|
-
sec--;
|
|
30
|
-
usec += 1000000;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
sec *= 1000000;
|
|
34
|
-
return sec + usec;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static unsigned long long utime_since_now(struct timeval *tv)
|
|
38
|
-
{
|
|
39
|
-
struct timeval end;
|
|
40
|
-
|
|
41
|
-
gettimeofday(&end, NULL);
|
|
42
|
-
return utime_since(tv, &end);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
21
|
static int do_fadvise(struct io_uring *ring, int fd, off_t offset, off_t len,
|
|
46
22
|
int advice)
|
|
47
23
|
{
|
|
@@ -92,7 +68,7 @@ static long do_read(int fd, char *buf)
|
|
|
92
68
|
perror("lseek");
|
|
93
69
|
return -1;
|
|
94
70
|
}
|
|
95
|
-
|
|
71
|
+
|
|
96
72
|
gettimeofday(&tv, NULL);
|
|
97
73
|
ret = read(fd, buf, FILE_SIZE);
|
|
98
74
|
t = utime_since_now(&tv);
|
|
@@ -115,6 +91,8 @@ static int test_fadvise(struct io_uring *ring, const char *filename)
|
|
|
115
91
|
|
|
116
92
|
fd = open(filename, O_RDONLY);
|
|
117
93
|
if (fd < 0) {
|
|
94
|
+
if (errno == EPERM || errno == EACCES)
|
|
95
|
+
return T_EXIT_SKIP;
|
|
118
96
|
perror("open");
|
|
119
97
|
return 1;
|
|
120
98
|
}
|
|
@@ -148,9 +126,12 @@ static int test_fadvise(struct io_uring *ring, const char *filename)
|
|
|
148
126
|
return 1;
|
|
149
127
|
|
|
150
128
|
if (cached_read < uncached_read &&
|
|
151
|
-
|
|
129
|
+
cached_read2 < uncached_read) {
|
|
130
|
+
free(buf);
|
|
152
131
|
return 0;
|
|
132
|
+
}
|
|
153
133
|
|
|
134
|
+
free(buf);
|
|
154
135
|
return 2;
|
|
155
136
|
}
|
|
156
137
|
|
|
@@ -174,6 +155,8 @@ int main(int argc, char *argv[])
|
|
|
174
155
|
good = bad = 0;
|
|
175
156
|
for (i = 0; i < LOOPS; i++) {
|
|
176
157
|
ret = test_fadvise(&ring, fname);
|
|
158
|
+
if (ret == T_EXIT_SKIP)
|
|
159
|
+
return T_EXIT_SKIP;
|
|
177
160
|
if (ret == 1) {
|
|
178
161
|
fprintf(stderr, "read_fadvise failed\n");
|
|
179
162
|
goto err;
|
|
@@ -80,7 +80,7 @@ static int __test_io(const char *file, struct io_uring *ring, int write,
|
|
|
80
80
|
if (fixed) {
|
|
81
81
|
ret = t_register_buffers(ring, vecs, BUFFERS);
|
|
82
82
|
if (ret == T_SETUP_SKIP)
|
|
83
|
-
return
|
|
83
|
+
return T_EXIT_SKIP;
|
|
84
84
|
if (ret != T_SETUP_OK) {
|
|
85
85
|
fprintf(stderr, "buffer reg failed: %d\n", ret);
|
|
86
86
|
goto err;
|
|
@@ -91,6 +91,8 @@ static int __test_io(const char *file, struct io_uring *ring, int write,
|
|
|
91
91
|
if (fd < 0) {
|
|
92
92
|
if (errno == EINVAL)
|
|
93
93
|
return 0;
|
|
94
|
+
if (errno == EPERM || errno == EACCES)
|
|
95
|
+
return T_EXIT_SKIP;
|
|
94
96
|
perror("file open");
|
|
95
97
|
goto err;
|
|
96
98
|
}
|
|
@@ -290,6 +292,7 @@ static int has_nonvec_read(void)
|
|
|
290
292
|
if (ret == -EINVAL) {
|
|
291
293
|
out:
|
|
292
294
|
io_uring_queue_exit(&ring);
|
|
295
|
+
free(p);
|
|
293
296
|
return 0;
|
|
294
297
|
} else if (ret) {
|
|
295
298
|
fprintf(stderr, "register_probe: %d\n", ret);
|
|
@@ -301,6 +304,7 @@ out:
|
|
|
301
304
|
if (!(p->ops[IORING_OP_READ].flags & IO_URING_OP_SUPPORTED))
|
|
302
305
|
goto out;
|
|
303
306
|
io_uring_queue_exit(&ring);
|
|
307
|
+
free(p);
|
|
304
308
|
return 1;
|
|
305
309
|
}
|
|
306
310
|
|
|
@@ -318,6 +322,8 @@ static int test_eventfd_read(int flags)
|
|
|
318
322
|
if (ret == T_SETUP_SKIP)
|
|
319
323
|
return 0;
|
|
320
324
|
if (ret != T_SETUP_OK) {
|
|
325
|
+
if (ret == -EINVAL)
|
|
326
|
+
return 0;
|
|
321
327
|
fprintf(stderr, "ring create failed: %d\n", ret);
|
|
322
328
|
return 1;
|
|
323
329
|
}
|
|
@@ -384,6 +390,8 @@ int main(int argc, char *argv[])
|
|
|
384
390
|
|
|
385
391
|
ret = test_io(fname, write, buffered, sqthread, fixed, nonvec,
|
|
386
392
|
BS);
|
|
393
|
+
if (ret == T_EXIT_SKIP)
|
|
394
|
+
continue;
|
|
387
395
|
if (ret) {
|
|
388
396
|
fprintf(stderr, "test_io failed %d/%d/%d/%d/%d\n",
|
|
389
397
|
write, buffered, sqthread, fixed, nonvec);
|