iou 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +12 -0
- data/.gitignore +59 -0
- data/.gitmodules +3 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +106 -0
- data/Rakefile +39 -0
- data/TODO.md +4 -0
- data/examples/echo_server.rb +52 -0
- data/examples/event_loop.rb +69 -0
- data/examples/http_server.rb +56 -0
- data/examples/http_server_multishot.rb +59 -0
- data/ext/iou/extconf.rb +71 -0
- data/ext/iou/iou.c +729 -0
- data/ext/iou/iou.h +66 -0
- data/ext/iou/iou_ext.c +9 -0
- data/ext/iou/op_spec_data.c +61 -0
- data/iou.gemspec +27 -0
- data/lib/iou/version.rb +5 -0
- data/lib/iou.rb +3 -0
- data/test/helper.rb +59 -0
- data/test/test_iou.rb +794 -0
- data/vendor/liburing/.github/actions/codespell/stopwords +7 -0
- data/vendor/liburing/.github/pull_request_template.md +86 -0
- data/vendor/liburing/.github/workflows/build.yml +137 -0
- data/vendor/liburing/.github/workflows/codespell.yml +25 -0
- data/vendor/liburing/.github/workflows/shellcheck.yml +20 -0
- data/vendor/liburing/.gitignore +41 -0
- data/vendor/liburing/CHANGELOG +111 -0
- data/vendor/liburing/CITATION.cff +11 -0
- data/vendor/liburing/COPYING +502 -0
- data/vendor/liburing/COPYING.GPL +339 -0
- data/vendor/liburing/LICENSE +20 -0
- data/vendor/liburing/Makefile +96 -0
- data/vendor/liburing/Makefile.common +7 -0
- data/vendor/liburing/Makefile.quiet +11 -0
- data/vendor/liburing/README +106 -0
- data/vendor/liburing/SECURITY.md +6 -0
- data/vendor/liburing/configure +624 -0
- data/vendor/liburing/debian/README.Debian +7 -0
- data/vendor/liburing/debian/changelog +38 -0
- data/vendor/liburing/debian/control +39 -0
- data/vendor/liburing/debian/copyright +49 -0
- data/vendor/liburing/debian/liburing-dev.install +4 -0
- data/vendor/liburing/debian/liburing-dev.manpages +5 -0
- data/vendor/liburing/debian/liburing2.install +1 -0
- data/vendor/liburing/debian/liburing2.symbols +56 -0
- data/vendor/liburing/debian/patches/series +1 -0
- data/vendor/liburing/debian/rules +29 -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 +53 -0
- data/vendor/liburing/examples/helpers.c +62 -0
- data/vendor/liburing/examples/helpers.h +7 -0
- data/vendor/liburing/examples/io_uring-close-test.c +123 -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/io_uring-udp.c +403 -0
- data/vendor/liburing/examples/link-cp.c +193 -0
- data/vendor/liburing/examples/napi-busy-poll-client.c +509 -0
- data/vendor/liburing/examples/napi-busy-poll-server.c +450 -0
- data/vendor/liburing/examples/poll-bench.c +101 -0
- data/vendor/liburing/examples/proxy.c +2461 -0
- data/vendor/liburing/examples/proxy.h +102 -0
- data/vendor/liburing/examples/rsrc-update-bench.c +100 -0
- data/vendor/liburing/examples/send-zerocopy.c +658 -0
- data/vendor/liburing/examples/ucontext-cp.c +258 -0
- data/vendor/liburing/liburing-ffi.pc.in +12 -0
- data/vendor/liburing/liburing.pc.in +12 -0
- data/vendor/liburing/liburing.spec +66 -0
- data/vendor/liburing/make-debs.sh +55 -0
- data/vendor/liburing/src/Makefile +129 -0
- data/vendor/liburing/src/arch/aarch64/lib.h +47 -0
- data/vendor/liburing/src/arch/aarch64/syscall.h +91 -0
- data/vendor/liburing/src/arch/generic/lib.h +17 -0
- data/vendor/liburing/src/arch/generic/syscall.h +100 -0
- data/vendor/liburing/src/arch/riscv64/lib.h +48 -0
- data/vendor/liburing/src/arch/riscv64/syscall.h +100 -0
- data/vendor/liburing/src/arch/syscall-defs.h +94 -0
- data/vendor/liburing/src/arch/x86/lib.h +11 -0
- data/vendor/liburing/src/arch/x86/syscall.h +296 -0
- data/vendor/liburing/src/ffi.c +15 -0
- data/vendor/liburing/src/include/liburing/barrier.h +81 -0
- data/vendor/liburing/src/include/liburing/io_uring.h +818 -0
- data/vendor/liburing/src/include/liburing.h +1602 -0
- data/vendor/liburing/src/int_flags.h +11 -0
- data/vendor/liburing/src/lib.h +52 -0
- data/vendor/liburing/src/liburing-ffi.map +211 -0
- data/vendor/liburing/src/liburing.map +104 -0
- data/vendor/liburing/src/nolibc.c +55 -0
- data/vendor/liburing/src/queue.c +468 -0
- data/vendor/liburing/src/register.c +374 -0
- data/vendor/liburing/src/setup.c +689 -0
- data/vendor/liburing/src/setup.h +9 -0
- data/vendor/liburing/src/syscall.c +29 -0
- data/vendor/liburing/src/syscall.h +53 -0
- data/vendor/liburing/src/version.c +21 -0
- data/vendor/liburing/test/232c93d07b74.c +305 -0
- data/vendor/liburing/test/35fa71a030ca.c +329 -0
- data/vendor/liburing/test/500f9fbadef8.c +91 -0
- data/vendor/liburing/test/7ad0e4b2f83c.c +94 -0
- data/vendor/liburing/test/8a9973408177.c +107 -0
- data/vendor/liburing/test/917257daa0fe.c +54 -0
- data/vendor/liburing/test/Makefile +297 -0
- data/vendor/liburing/test/a0908ae19763.c +59 -0
- data/vendor/liburing/test/a4c0b3decb33.c +181 -0
- data/vendor/liburing/test/accept-link.c +255 -0
- data/vendor/liburing/test/accept-non-empty.c +256 -0
- data/vendor/liburing/test/accept-reuse.c +163 -0
- data/vendor/liburing/test/accept-test.c +83 -0
- data/vendor/liburing/test/accept.c +919 -0
- data/vendor/liburing/test/across-fork.c +284 -0
- data/vendor/liburing/test/b19062a56726.c +54 -0
- data/vendor/liburing/test/b5837bd5311d.c +78 -0
- data/vendor/liburing/test/bind-listen.c +408 -0
- data/vendor/liburing/test/buf-ring-nommap.c +123 -0
- data/vendor/liburing/test/buf-ring-put.c +83 -0
- data/vendor/liburing/test/buf-ring.c +473 -0
- data/vendor/liburing/test/ce593a6c480a.c +139 -0
- data/vendor/liburing/test/close-opath.c +123 -0
- data/vendor/liburing/test/config +14 -0
- data/vendor/liburing/test/connect-rep.c +204 -0
- data/vendor/liburing/test/connect.c +442 -0
- data/vendor/liburing/test/coredump.c +60 -0
- data/vendor/liburing/test/cq-full.c +97 -0
- data/vendor/liburing/test/cq-overflow.c +530 -0
- data/vendor/liburing/test/cq-peek-batch.c +103 -0
- data/vendor/liburing/test/cq-ready.c +95 -0
- data/vendor/liburing/test/cq-size.c +65 -0
- data/vendor/liburing/test/d4ae271dfaae.c +96 -0
- data/vendor/liburing/test/d77a67ed5f27.c +65 -0
- data/vendor/liburing/test/defer-taskrun.c +391 -0
- data/vendor/liburing/test/defer-tw-timeout.c +173 -0
- data/vendor/liburing/test/defer.c +319 -0
- data/vendor/liburing/test/double-poll-crash.c +195 -0
- data/vendor/liburing/test/drop-submit.c +94 -0
- data/vendor/liburing/test/eeed8b54e0df.c +120 -0
- data/vendor/liburing/test/empty-eownerdead.c +45 -0
- data/vendor/liburing/test/eploop.c +74 -0
- data/vendor/liburing/test/eventfd-disable.c +179 -0
- data/vendor/liburing/test/eventfd-reg.c +77 -0
- data/vendor/liburing/test/eventfd-ring.c +98 -0
- data/vendor/liburing/test/eventfd.c +113 -0
- data/vendor/liburing/test/evloop.c +73 -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 +265 -0
- data/vendor/liburing/test/fc2a85cb02ef.c +132 -0
- data/vendor/liburing/test/fd-install.c +500 -0
- data/vendor/liburing/test/fd-pass.c +237 -0
- data/vendor/liburing/test/fdinfo.c +419 -0
- data/vendor/liburing/test/file-register.c +1189 -0
- data/vendor/liburing/test/file-update.c +231 -0
- data/vendor/liburing/test/file-verify.c +654 -0
- data/vendor/liburing/test/files-exit-hang-poll.c +114 -0
- data/vendor/liburing/test/files-exit-hang-timeout.c +137 -0
- data/vendor/liburing/test/fixed-buf-iter.c +115 -0
- data/vendor/liburing/test/fixed-buf-merge.c +101 -0
- data/vendor/liburing/test/fixed-hugepage.c +411 -0
- data/vendor/liburing/test/fixed-link.c +90 -0
- data/vendor/liburing/test/fixed-reuse.c +160 -0
- data/vendor/liburing/test/fpos.c +255 -0
- data/vendor/liburing/test/fsnotify.c +118 -0
- data/vendor/liburing/test/fsync.c +224 -0
- data/vendor/liburing/test/futex.c +571 -0
- data/vendor/liburing/test/hardlink.c +170 -0
- data/vendor/liburing/test/helpers.c +318 -0
- data/vendor/liburing/test/helpers.h +108 -0
- data/vendor/liburing/test/ignore-single-mmap.c +48 -0
- data/vendor/liburing/test/init-mem.c +164 -0
- data/vendor/liburing/test/io-cancel.c +561 -0
- data/vendor/liburing/test/io_uring_enter.c +264 -0
- data/vendor/liburing/test/io_uring_passthrough.c +482 -0
- data/vendor/liburing/test/io_uring_register.c +503 -0
- data/vendor/liburing/test/io_uring_setup.c +110 -0
- data/vendor/liburing/test/iopoll-leak.c +85 -0
- data/vendor/liburing/test/iopoll-overflow.c +118 -0
- data/vendor/liburing/test/iopoll.c +465 -0
- data/vendor/liburing/test/lfs-openat-write.c +119 -0
- data/vendor/liburing/test/lfs-openat.c +273 -0
- data/vendor/liburing/test/link-timeout.c +1108 -0
- data/vendor/liburing/test/link.c +497 -0
- data/vendor/liburing/test/link_drain.c +255 -0
- data/vendor/liburing/test/madvise.c +195 -0
- data/vendor/liburing/test/min-timeout-wait.c +354 -0
- data/vendor/liburing/test/min-timeout.c +233 -0
- data/vendor/liburing/test/mkdir.c +112 -0
- data/vendor/liburing/test/msg-ring-fd.c +331 -0
- data/vendor/liburing/test/msg-ring-flags.c +212 -0
- data/vendor/liburing/test/msg-ring-overflow.c +159 -0
- data/vendor/liburing/test/msg-ring.c +467 -0
- data/vendor/liburing/test/multicqes_drain.c +429 -0
- data/vendor/liburing/test/napi-test.c +215 -0
- data/vendor/liburing/test/napi-test.sh +48 -0
- data/vendor/liburing/test/no-mmap-inval.c +42 -0
- data/vendor/liburing/test/nolibc.c +62 -0
- data/vendor/liburing/test/nop-all-sizes.c +99 -0
- data/vendor/liburing/test/nop.c +177 -0
- data/vendor/liburing/test/nvme.h +169 -0
- data/vendor/liburing/test/ooo-file-unreg.c +82 -0
- data/vendor/liburing/test/open-close.c +261 -0
- data/vendor/liburing/test/open-direct-link.c +188 -0
- data/vendor/liburing/test/open-direct-pick.c +180 -0
- data/vendor/liburing/test/openat2.c +312 -0
- data/vendor/liburing/test/personality.c +204 -0
- data/vendor/liburing/test/pipe-bug.c +95 -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-all.c +496 -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 +221 -0
- data/vendor/liburing/test/poll-many.c +230 -0
- data/vendor/liburing/test/poll-mshot-overflow.c +265 -0
- data/vendor/liburing/test/poll-mshot-update.c +323 -0
- data/vendor/liburing/test/poll-race-mshot.c +276 -0
- data/vendor/liburing/test/poll-race.c +105 -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 +327 -0
- data/vendor/liburing/test/probe.c +135 -0
- data/vendor/liburing/test/read-before-exit.c +129 -0
- data/vendor/liburing/test/read-mshot-empty.c +153 -0
- data/vendor/liburing/test/read-mshot.c +404 -0
- data/vendor/liburing/test/read-write.c +1013 -0
- data/vendor/liburing/test/recv-msgall-stream.c +398 -0
- data/vendor/liburing/test/recv-msgall.c +263 -0
- data/vendor/liburing/test/recv-multishot.c +602 -0
- data/vendor/liburing/test/recvsend_bundle.c +691 -0
- data/vendor/liburing/test/reg-fd-only.c +131 -0
- data/vendor/liburing/test/reg-hint.c +56 -0
- data/vendor/liburing/test/reg-reg-ring.c +90 -0
- data/vendor/liburing/test/regbuf-merge.c +91 -0
- data/vendor/liburing/test/register-restrictions.c +633 -0
- data/vendor/liburing/test/rename.c +132 -0
- data/vendor/liburing/test/ring-leak.c +283 -0
- data/vendor/liburing/test/ring-leak2.c +249 -0
- data/vendor/liburing/test/ringbuf-read.c +196 -0
- data/vendor/liburing/test/ringbuf-status.c +242 -0
- data/vendor/liburing/test/rsrc_tags.c +461 -0
- data/vendor/liburing/test/runtests-loop.sh +16 -0
- data/vendor/liburing/test/runtests-quiet.sh +11 -0
- data/vendor/liburing/test/runtests.sh +168 -0
- data/vendor/liburing/test/rw_merge_test.c +98 -0
- data/vendor/liburing/test/self.c +91 -0
- data/vendor/liburing/test/send-zerocopy.c +971 -0
- data/vendor/liburing/test/send_recv.c +412 -0
- data/vendor/liburing/test/send_recvmsg.c +444 -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 +88 -0
- data/vendor/liburing/test/single-issuer.c +169 -0
- data/vendor/liburing/test/skip-cqe.c +428 -0
- data/vendor/liburing/test/socket-getsetsock-cmd.c +346 -0
- data/vendor/liburing/test/socket-io-cmd.c +237 -0
- data/vendor/liburing/test/socket-rw-eagain.c +149 -0
- data/vendor/liburing/test/socket-rw-offset.c +149 -0
- data/vendor/liburing/test/socket-rw.c +137 -0
- data/vendor/liburing/test/socket.c +408 -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 +211 -0
- data/vendor/liburing/test/sq-poll-kthread.c +169 -0
- data/vendor/liburing/test/sq-poll-share.c +138 -0
- data/vendor/liburing/test/sq-space_left.c +159 -0
- data/vendor/liburing/test/sqpoll-disable-exit.c +196 -0
- data/vendor/liburing/test/sqpoll-exec.c +132 -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-and-wait.c +108 -0
- data/vendor/liburing/test/submit-link-fail.c +156 -0
- data/vendor/liburing/test/submit-reuse.c +237 -0
- data/vendor/liburing/test/symlink.c +117 -0
- data/vendor/liburing/test/sync-cancel.c +235 -0
- data/vendor/liburing/test/teardowns.c +58 -0
- data/vendor/liburing/test/test.h +36 -0
- data/vendor/liburing/test/thread-exit.c +143 -0
- data/vendor/liburing/test/timeout-new.c +256 -0
- data/vendor/liburing/test/timeout.c +1798 -0
- data/vendor/liburing/test/truncate.c +186 -0
- data/vendor/liburing/test/tty-write-dpoll.c +60 -0
- data/vendor/liburing/test/unlink.c +112 -0
- data/vendor/liburing/test/version.c +25 -0
- data/vendor/liburing/test/wait-timeout.c +287 -0
- data/vendor/liburing/test/waitid.c +373 -0
- data/vendor/liburing/test/wakeup-hang.c +162 -0
- data/vendor/liburing/test/wq-aff.c +146 -0
- data/vendor/liburing/test/xattr.c +442 -0
- metadata +402 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
#ifndef LIBURING_SYSCALL_H
|
3
|
+
#define LIBURING_SYSCALL_H
|
4
|
+
|
5
|
+
#include <errno.h>
|
6
|
+
#include <signal.h>
|
7
|
+
#include <stdint.h>
|
8
|
+
#include <unistd.h>
|
9
|
+
#include <stdbool.h>
|
10
|
+
#include <sys/mman.h>
|
11
|
+
#include <sys/syscall.h>
|
12
|
+
#include <sys/resource.h>
|
13
|
+
#include <liburing.h>
|
14
|
+
|
15
|
+
/*
|
16
|
+
* Don't put this below the #include "arch/$arch/syscall.h", that
|
17
|
+
* file may need it.
|
18
|
+
*/
|
19
|
+
struct io_uring_params;
|
20
|
+
|
21
|
+
static inline void *ERR_PTR(intptr_t n)
|
22
|
+
{
|
23
|
+
return (void *) n;
|
24
|
+
}
|
25
|
+
|
26
|
+
static inline int PTR_ERR(const void *ptr)
|
27
|
+
{
|
28
|
+
return (int) (intptr_t) ptr;
|
29
|
+
}
|
30
|
+
|
31
|
+
static inline bool IS_ERR(const void *ptr)
|
32
|
+
{
|
33
|
+
return uring_unlikely((uintptr_t) ptr >= (uintptr_t) -4095UL);
|
34
|
+
}
|
35
|
+
|
36
|
+
#if defined(__x86_64__) || defined(__i386__)
|
37
|
+
#include "arch/x86/syscall.h"
|
38
|
+
#elif defined(__aarch64__)
|
39
|
+
#include "arch/aarch64/syscall.h"
|
40
|
+
#elif defined(__riscv) && __riscv_xlen == 64
|
41
|
+
#include "arch/riscv64/syscall.h"
|
42
|
+
#else
|
43
|
+
/*
|
44
|
+
* We don't have native syscall wrappers
|
45
|
+
* for this arch. Must use libc!
|
46
|
+
*/
|
47
|
+
#ifdef CONFIG_NOLIBC
|
48
|
+
#error "This arch doesn't support building liburing without libc"
|
49
|
+
#endif
|
50
|
+
/* libc syscall wrappers. */
|
51
|
+
#include "arch/generic/syscall.h"
|
52
|
+
#endif
|
53
|
+
#endif
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
|
3
|
+
#include "liburing.h"
|
4
|
+
#include "liburing/io_uring_version.h"
|
5
|
+
|
6
|
+
int io_uring_major_version(void)
|
7
|
+
{
|
8
|
+
return IO_URING_VERSION_MAJOR;
|
9
|
+
}
|
10
|
+
|
11
|
+
int io_uring_minor_version(void)
|
12
|
+
{
|
13
|
+
return IO_URING_VERSION_MINOR;
|
14
|
+
}
|
15
|
+
|
16
|
+
bool io_uring_check_version(int major, int minor)
|
17
|
+
{
|
18
|
+
return major > io_uring_major_version() ||
|
19
|
+
(major == io_uring_major_version() &&
|
20
|
+
minor > io_uring_minor_version());
|
21
|
+
}
|
@@ -0,0 +1,305 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Test case for socket read/write through IORING_OP_READV and
|
4
|
+
* IORING_OP_WRITEV, using both TCP and sockets and blocking and
|
5
|
+
* non-blocking IO.
|
6
|
+
*
|
7
|
+
* Heavily based on a test case from Hrvoje Zeba <zeba.hrvoje@gmail.com>
|
8
|
+
*/
|
9
|
+
#include <stdio.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <stdint.h>
|
12
|
+
#include <assert.h>
|
13
|
+
|
14
|
+
#include <pthread.h>
|
15
|
+
#include <errno.h>
|
16
|
+
#include <fcntl.h>
|
17
|
+
#include <unistd.h>
|
18
|
+
#include <sys/socket.h>
|
19
|
+
#include <sys/un.h>
|
20
|
+
#include <netinet/tcp.h>
|
21
|
+
#include <netinet/in.h>
|
22
|
+
#include <arpa/inet.h>
|
23
|
+
|
24
|
+
#include "helpers.h"
|
25
|
+
#include "liburing.h"
|
26
|
+
|
27
|
+
#define RECV_BUFF_SIZE 2
|
28
|
+
#define SEND_BUFF_SIZE 3
|
29
|
+
|
30
|
+
struct params {
|
31
|
+
int tcp;
|
32
|
+
int non_blocking;
|
33
|
+
__be16 bind_port;
|
34
|
+
};
|
35
|
+
|
36
|
+
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
37
|
+
static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
38
|
+
static int rcv_ready = 0;
|
39
|
+
|
40
|
+
static void set_rcv_ready(void)
|
41
|
+
{
|
42
|
+
pthread_mutex_lock(&mutex);
|
43
|
+
|
44
|
+
rcv_ready = 1;
|
45
|
+
pthread_cond_signal(&cond);
|
46
|
+
|
47
|
+
pthread_mutex_unlock(&mutex);
|
48
|
+
}
|
49
|
+
|
50
|
+
static void wait_for_rcv_ready(void)
|
51
|
+
{
|
52
|
+
pthread_mutex_lock(&mutex);
|
53
|
+
|
54
|
+
while (!rcv_ready)
|
55
|
+
pthread_cond_wait(&cond, &mutex);
|
56
|
+
|
57
|
+
pthread_mutex_unlock(&mutex);
|
58
|
+
}
|
59
|
+
|
60
|
+
static void *rcv(void *arg)
|
61
|
+
{
|
62
|
+
struct params *p = arg;
|
63
|
+
int s0;
|
64
|
+
int res;
|
65
|
+
|
66
|
+
if (p->tcp) {
|
67
|
+
int ret, val = 1;
|
68
|
+
|
69
|
+
s0 = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);
|
70
|
+
res = setsockopt(s0, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
|
71
|
+
assert(res != -1);
|
72
|
+
res = setsockopt(s0, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
73
|
+
assert(res != -1);
|
74
|
+
|
75
|
+
struct sockaddr_in addr;
|
76
|
+
|
77
|
+
addr.sin_family = AF_INET;
|
78
|
+
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
79
|
+
ret = t_bind_ephemeral_port(s0, &addr);
|
80
|
+
assert(!ret);
|
81
|
+
p->bind_port = addr.sin_port;
|
82
|
+
} else {
|
83
|
+
s0 = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
84
|
+
assert(s0 != -1);
|
85
|
+
|
86
|
+
struct sockaddr_un addr;
|
87
|
+
memset(&addr, 0, sizeof(addr));
|
88
|
+
|
89
|
+
addr.sun_family = AF_UNIX;
|
90
|
+
memcpy(addr.sun_path, "\0sock", 6);
|
91
|
+
res = bind(s0, (struct sockaddr *) &addr, sizeof(addr));
|
92
|
+
assert(res != -1);
|
93
|
+
}
|
94
|
+
res = listen(s0, 128);
|
95
|
+
assert(res != -1);
|
96
|
+
|
97
|
+
set_rcv_ready();
|
98
|
+
|
99
|
+
int s1 = accept(s0, NULL, NULL);
|
100
|
+
assert(s1 != -1);
|
101
|
+
|
102
|
+
if (p->non_blocking) {
|
103
|
+
int flags = fcntl(s1, F_GETFL, 0);
|
104
|
+
assert(flags != -1);
|
105
|
+
|
106
|
+
flags |= O_NONBLOCK;
|
107
|
+
res = fcntl(s1, F_SETFL, flags);
|
108
|
+
assert(res != -1);
|
109
|
+
}
|
110
|
+
|
111
|
+
struct io_uring m_io_uring;
|
112
|
+
void *ret = NULL;
|
113
|
+
|
114
|
+
res = io_uring_queue_init(32, &m_io_uring, 0);
|
115
|
+
assert(res >= 0);
|
116
|
+
|
117
|
+
int bytes_read = 0;
|
118
|
+
int expected_byte = 0;
|
119
|
+
int done = 0;
|
120
|
+
|
121
|
+
while (!done && bytes_read != 33) {
|
122
|
+
char buff[RECV_BUFF_SIZE];
|
123
|
+
struct iovec iov;
|
124
|
+
|
125
|
+
iov.iov_base = buff;
|
126
|
+
iov.iov_len = sizeof(buff);
|
127
|
+
|
128
|
+
struct io_uring_sqe *sqe = io_uring_get_sqe(&m_io_uring);
|
129
|
+
assert(sqe != NULL);
|
130
|
+
|
131
|
+
io_uring_prep_readv(sqe, s1, &iov, 1, 0);
|
132
|
+
|
133
|
+
res = io_uring_submit(&m_io_uring);
|
134
|
+
assert(res != -1);
|
135
|
+
|
136
|
+
struct io_uring_cqe *cqe;
|
137
|
+
unsigned head;
|
138
|
+
unsigned count = 0;
|
139
|
+
|
140
|
+
while (!done && count != 1) {
|
141
|
+
io_uring_for_each_cqe(&m_io_uring, head, cqe) {
|
142
|
+
if (cqe->res < 0)
|
143
|
+
assert(cqe->res == -EAGAIN);
|
144
|
+
else {
|
145
|
+
int i;
|
146
|
+
|
147
|
+
for (i = 0; i < cqe->res; i++) {
|
148
|
+
if (buff[i] != expected_byte) {
|
149
|
+
fprintf(stderr,
|
150
|
+
"Received %d, wanted %d\n",
|
151
|
+
buff[i], expected_byte);
|
152
|
+
ret++;
|
153
|
+
done = 1;
|
154
|
+
}
|
155
|
+
expected_byte++;
|
156
|
+
}
|
157
|
+
bytes_read += cqe->res;
|
158
|
+
}
|
159
|
+
|
160
|
+
count++;
|
161
|
+
}
|
162
|
+
|
163
|
+
assert(count <= 1);
|
164
|
+
io_uring_cq_advance(&m_io_uring, count);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
shutdown(s1, SHUT_RDWR);
|
169
|
+
close(s1);
|
170
|
+
close(s0);
|
171
|
+
io_uring_queue_exit(&m_io_uring);
|
172
|
+
return ret;
|
173
|
+
}
|
174
|
+
|
175
|
+
static void *snd(void *arg)
|
176
|
+
{
|
177
|
+
struct params *p = arg;
|
178
|
+
int s0;
|
179
|
+
int ret;
|
180
|
+
|
181
|
+
wait_for_rcv_ready();
|
182
|
+
|
183
|
+
if (p->tcp) {
|
184
|
+
int val = 1;
|
185
|
+
|
186
|
+
s0 = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);
|
187
|
+
ret = setsockopt(s0, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
188
|
+
assert(ret != -1);
|
189
|
+
|
190
|
+
struct sockaddr_in addr;
|
191
|
+
|
192
|
+
addr.sin_family = AF_INET;
|
193
|
+
addr.sin_port = p->bind_port;
|
194
|
+
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
195
|
+
ret = connect(s0, (struct sockaddr*) &addr, sizeof(addr));
|
196
|
+
assert(ret != -1);
|
197
|
+
} else {
|
198
|
+
s0 = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
199
|
+
assert(s0 != -1);
|
200
|
+
|
201
|
+
struct sockaddr_un addr;
|
202
|
+
memset(&addr, 0, sizeof(addr));
|
203
|
+
|
204
|
+
addr.sun_family = AF_UNIX;
|
205
|
+
memcpy(addr.sun_path, "\0sock", 6);
|
206
|
+
ret = connect(s0, (struct sockaddr*) &addr, sizeof(addr));
|
207
|
+
assert(ret != -1);
|
208
|
+
}
|
209
|
+
|
210
|
+
if (p->non_blocking) {
|
211
|
+
int flags = fcntl(s0, F_GETFL, 0);
|
212
|
+
assert(flags != -1);
|
213
|
+
|
214
|
+
flags |= O_NONBLOCK;
|
215
|
+
ret = fcntl(s0, F_SETFL, flags);
|
216
|
+
assert(ret != -1);
|
217
|
+
}
|
218
|
+
|
219
|
+
struct io_uring m_io_uring;
|
220
|
+
|
221
|
+
ret = io_uring_queue_init(32, &m_io_uring, 0);
|
222
|
+
assert(ret >= 0);
|
223
|
+
|
224
|
+
int bytes_written = 0;
|
225
|
+
int done = 0;
|
226
|
+
|
227
|
+
while (!done && bytes_written != 33) {
|
228
|
+
char buff[SEND_BUFF_SIZE];
|
229
|
+
int i;
|
230
|
+
|
231
|
+
for (i = 0; i < SEND_BUFF_SIZE; i++)
|
232
|
+
buff[i] = i + bytes_written;
|
233
|
+
|
234
|
+
struct iovec iov;
|
235
|
+
|
236
|
+
iov.iov_base = buff;
|
237
|
+
iov.iov_len = sizeof(buff);
|
238
|
+
|
239
|
+
struct io_uring_sqe *sqe = io_uring_get_sqe(&m_io_uring);
|
240
|
+
assert(sqe != NULL);
|
241
|
+
|
242
|
+
io_uring_prep_writev(sqe, s0, &iov, 1, 0);
|
243
|
+
|
244
|
+
ret = io_uring_submit(&m_io_uring);
|
245
|
+
assert(ret != -1);
|
246
|
+
|
247
|
+
struct io_uring_cqe *cqe;
|
248
|
+
unsigned head;
|
249
|
+
unsigned count = 0;
|
250
|
+
|
251
|
+
while (!done && count != 1) {
|
252
|
+
io_uring_for_each_cqe(&m_io_uring, head, cqe) {
|
253
|
+
if (cqe->res < 0) {
|
254
|
+
if (cqe->res == -EPIPE) {
|
255
|
+
done = 1;
|
256
|
+
break;
|
257
|
+
}
|
258
|
+
assert(cqe->res == -EAGAIN);
|
259
|
+
} else {
|
260
|
+
bytes_written += cqe->res;
|
261
|
+
}
|
262
|
+
|
263
|
+
count++;
|
264
|
+
}
|
265
|
+
|
266
|
+
assert(count <= 1);
|
267
|
+
io_uring_cq_advance(&m_io_uring, count);
|
268
|
+
}
|
269
|
+
usleep(100000);
|
270
|
+
}
|
271
|
+
|
272
|
+
shutdown(s0, SHUT_RDWR);
|
273
|
+
close(s0);
|
274
|
+
io_uring_queue_exit(&m_io_uring);
|
275
|
+
return NULL;
|
276
|
+
}
|
277
|
+
|
278
|
+
int main(int argc, char *argv[])
|
279
|
+
{
|
280
|
+
struct params p;
|
281
|
+
pthread_t t1, t2;
|
282
|
+
void *res1, *res2;
|
283
|
+
int i, exit_val = T_EXIT_PASS;
|
284
|
+
|
285
|
+
if (argc > 1)
|
286
|
+
return T_EXIT_SKIP;
|
287
|
+
|
288
|
+
for (i = 0; i < 4; i++) {
|
289
|
+
p.tcp = i & 1;
|
290
|
+
p.non_blocking = (i & 2) >> 1;
|
291
|
+
|
292
|
+
rcv_ready = 0;
|
293
|
+
|
294
|
+
pthread_create(&t1, NULL, rcv, &p);
|
295
|
+
pthread_create(&t2, NULL, snd, &p);
|
296
|
+
pthread_join(t1, &res1);
|
297
|
+
pthread_join(t2, &res2);
|
298
|
+
if (res1 || res2) {
|
299
|
+
fprintf(stderr, "Failed tcp=%d, non_blocking=%d\n", p.tcp, p.non_blocking);
|
300
|
+
exit_val = T_EXIT_FAIL;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
return exit_val;
|
305
|
+
}
|
@@ -0,0 +1,329 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
// autogenerated by syzkaller (https://github.com/google/syzkaller)
|
3
|
+
|
4
|
+
#include <dirent.h>
|
5
|
+
#include <endian.h>
|
6
|
+
#include <errno.h>
|
7
|
+
#include <fcntl.h>
|
8
|
+
#include <pthread.h>
|
9
|
+
#include <signal.h>
|
10
|
+
#include <stdarg.h>
|
11
|
+
#include <stdbool.h>
|
12
|
+
#include <stdint.h>
|
13
|
+
#include <stdio.h>
|
14
|
+
#include <stdlib.h>
|
15
|
+
#include <string.h>
|
16
|
+
#include <sys/prctl.h>
|
17
|
+
#include <sys/stat.h>
|
18
|
+
#include <sys/syscall.h>
|
19
|
+
#include <sys/types.h>
|
20
|
+
#include <sys/wait.h>
|
21
|
+
#include <time.h>
|
22
|
+
#include <unistd.h>
|
23
|
+
#include <sys/mman.h>
|
24
|
+
|
25
|
+
#include <linux/futex.h>
|
26
|
+
|
27
|
+
#include "liburing.h"
|
28
|
+
#include "helpers.h"
|
29
|
+
#include "../src/syscall.h"
|
30
|
+
|
31
|
+
#if !defined(SYS_futex) && defined(SYS_futex_time64)
|
32
|
+
# define SYS_futex SYS_futex_time64
|
33
|
+
#endif
|
34
|
+
|
35
|
+
static void sleep_ms(uint64_t ms)
|
36
|
+
{
|
37
|
+
usleep(ms * 1000);
|
38
|
+
}
|
39
|
+
|
40
|
+
static uint64_t current_time_ms(void)
|
41
|
+
{
|
42
|
+
struct timespec ts;
|
43
|
+
if (clock_gettime(CLOCK_MONOTONIC, &ts))
|
44
|
+
exit(1);
|
45
|
+
return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
|
46
|
+
}
|
47
|
+
|
48
|
+
static void thread_start(void* (*fn)(void*), void* arg)
|
49
|
+
{
|
50
|
+
pthread_t th;
|
51
|
+
pthread_attr_t attr;
|
52
|
+
pthread_attr_init(&attr);
|
53
|
+
pthread_attr_setstacksize(&attr, 128 << 10);
|
54
|
+
int i;
|
55
|
+
for (i = 0; i < 100; i++) {
|
56
|
+
if (pthread_create(&th, &attr, fn, arg) == 0) {
|
57
|
+
pthread_attr_destroy(&attr);
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
if (errno == EAGAIN) {
|
61
|
+
usleep(50);
|
62
|
+
continue;
|
63
|
+
}
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
exit(1);
|
67
|
+
}
|
68
|
+
|
69
|
+
typedef struct {
|
70
|
+
int state;
|
71
|
+
} event_t;
|
72
|
+
|
73
|
+
static void event_init(event_t* ev)
|
74
|
+
{
|
75
|
+
ev->state = 0;
|
76
|
+
}
|
77
|
+
|
78
|
+
static void event_reset(event_t* ev)
|
79
|
+
{
|
80
|
+
ev->state = 0;
|
81
|
+
}
|
82
|
+
|
83
|
+
static void event_set(event_t* ev)
|
84
|
+
{
|
85
|
+
if (ev->state)
|
86
|
+
exit(1);
|
87
|
+
__atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
|
88
|
+
syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG);
|
89
|
+
}
|
90
|
+
|
91
|
+
static void event_wait(event_t* ev)
|
92
|
+
{
|
93
|
+
while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
|
94
|
+
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
|
95
|
+
}
|
96
|
+
|
97
|
+
static int event_isset(event_t* ev)
|
98
|
+
{
|
99
|
+
return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
|
100
|
+
}
|
101
|
+
|
102
|
+
static int event_timedwait(event_t* ev, uint64_t timeout)
|
103
|
+
{
|
104
|
+
uint64_t start = current_time_ms();
|
105
|
+
uint64_t now = start;
|
106
|
+
for (;;) {
|
107
|
+
uint64_t remain = timeout - (now - start);
|
108
|
+
struct timespec ts;
|
109
|
+
ts.tv_sec = remain / 1000;
|
110
|
+
ts.tv_nsec = (remain % 1000) * 1000 * 1000;
|
111
|
+
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
|
112
|
+
if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED))
|
113
|
+
return 1;
|
114
|
+
now = current_time_ms();
|
115
|
+
if (now - start > timeout)
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
static bool write_file(const char* file, const char* what, ...)
|
121
|
+
{
|
122
|
+
char buf[1024];
|
123
|
+
va_list args;
|
124
|
+
va_start(args, what);
|
125
|
+
vsnprintf(buf, sizeof(buf), what, args);
|
126
|
+
va_end(args);
|
127
|
+
buf[sizeof(buf) - 1] = 0;
|
128
|
+
int len = strlen(buf);
|
129
|
+
int fd = open(file, O_WRONLY | O_CLOEXEC);
|
130
|
+
if (fd == -1)
|
131
|
+
return false;
|
132
|
+
if (write(fd, buf, len) != len) {
|
133
|
+
int err = errno;
|
134
|
+
close(fd);
|
135
|
+
errno = err;
|
136
|
+
return false;
|
137
|
+
}
|
138
|
+
close(fd);
|
139
|
+
return true;
|
140
|
+
}
|
141
|
+
|
142
|
+
static void kill_and_wait(int pid, int* status)
|
143
|
+
{
|
144
|
+
kill(-pid, SIGKILL);
|
145
|
+
kill(pid, SIGKILL);
|
146
|
+
int i;
|
147
|
+
for (i = 0; i < 100; i++) {
|
148
|
+
if (waitpid(-1, status, WNOHANG | __WALL) == pid)
|
149
|
+
return;
|
150
|
+
usleep(1000);
|
151
|
+
}
|
152
|
+
DIR* dir = opendir("/sys/fs/fuse/connections");
|
153
|
+
if (dir) {
|
154
|
+
for (;;) {
|
155
|
+
struct dirent* ent = readdir(dir);
|
156
|
+
if (!ent)
|
157
|
+
break;
|
158
|
+
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
|
159
|
+
continue;
|
160
|
+
char abort[300];
|
161
|
+
snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
|
162
|
+
ent->d_name);
|
163
|
+
int fd = open(abort, O_WRONLY);
|
164
|
+
if (fd == -1) {
|
165
|
+
continue;
|
166
|
+
}
|
167
|
+
if (write(fd, abort, 1) < 0) {
|
168
|
+
}
|
169
|
+
close(fd);
|
170
|
+
}
|
171
|
+
closedir(dir);
|
172
|
+
} else {
|
173
|
+
}
|
174
|
+
while (waitpid(-1, status, __WALL) != pid) {
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
#define SYZ_HAVE_SETUP_TEST 1
|
179
|
+
static void setup_test(void)
|
180
|
+
{
|
181
|
+
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
|
182
|
+
setpgrp();
|
183
|
+
write_file("/proc/self/oom_score_adj", "1000");
|
184
|
+
}
|
185
|
+
|
186
|
+
struct thread_t {
|
187
|
+
int created, call;
|
188
|
+
event_t ready, done;
|
189
|
+
};
|
190
|
+
|
191
|
+
static struct thread_t threads[16];
|
192
|
+
static void execute_call(int call);
|
193
|
+
static int running;
|
194
|
+
|
195
|
+
static void* thr(void* arg)
|
196
|
+
{
|
197
|
+
struct thread_t* th = (struct thread_t*)arg;
|
198
|
+
for (;;) {
|
199
|
+
event_wait(&th->ready);
|
200
|
+
event_reset(&th->ready);
|
201
|
+
execute_call(th->call);
|
202
|
+
__atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
|
203
|
+
event_set(&th->done);
|
204
|
+
}
|
205
|
+
return 0;
|
206
|
+
}
|
207
|
+
|
208
|
+
static void execute_one(void)
|
209
|
+
{
|
210
|
+
int i, call, thread;
|
211
|
+
for (call = 0; call < 3; call++) {
|
212
|
+
for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
|
213
|
+
thread++) {
|
214
|
+
struct thread_t* th = &threads[thread];
|
215
|
+
if (!th->created) {
|
216
|
+
th->created = 1;
|
217
|
+
event_init(&th->ready);
|
218
|
+
event_init(&th->done);
|
219
|
+
event_set(&th->done);
|
220
|
+
thread_start(thr, th);
|
221
|
+
}
|
222
|
+
if (!event_isset(&th->done))
|
223
|
+
continue;
|
224
|
+
event_reset(&th->done);
|
225
|
+
th->call = call;
|
226
|
+
__atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
|
227
|
+
event_set(&th->ready);
|
228
|
+
event_timedwait(&th->done, 45);
|
229
|
+
break;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
|
233
|
+
sleep_ms(1);
|
234
|
+
}
|
235
|
+
|
236
|
+
static void execute_one(void);
|
237
|
+
|
238
|
+
#define WAIT_FLAGS __WALL
|
239
|
+
|
240
|
+
static void loop(void)
|
241
|
+
{
|
242
|
+
for (;;) {
|
243
|
+
int pid = fork();
|
244
|
+
if (pid < 0)
|
245
|
+
exit(1);
|
246
|
+
if (pid == 0) {
|
247
|
+
setup_test();
|
248
|
+
execute_one();
|
249
|
+
exit(0);
|
250
|
+
}
|
251
|
+
int status = 0;
|
252
|
+
uint64_t start = current_time_ms();
|
253
|
+
for (;;) {
|
254
|
+
if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
|
255
|
+
break;
|
256
|
+
sleep_ms(1);
|
257
|
+
if (current_time_ms() - start < 5 * 1000)
|
258
|
+
continue;
|
259
|
+
kill_and_wait(pid, &status);
|
260
|
+
break;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
static uint64_t r[1] = {0xffffffffffffffff};
|
266
|
+
|
267
|
+
void execute_call(int call)
|
268
|
+
{
|
269
|
+
long res;
|
270
|
+
switch (call) {
|
271
|
+
case 0:
|
272
|
+
*(uint32_t*)0x20000040 = 0;
|
273
|
+
*(uint32_t*)0x20000044 = 0;
|
274
|
+
*(uint32_t*)0x20000048 = 0;
|
275
|
+
*(uint32_t*)0x2000004c = 0;
|
276
|
+
*(uint32_t*)0x20000050 = 0;
|
277
|
+
*(uint32_t*)0x20000054 = 0;
|
278
|
+
*(uint32_t*)0x20000058 = 0;
|
279
|
+
*(uint32_t*)0x2000005c = 0;
|
280
|
+
*(uint32_t*)0x20000060 = 0;
|
281
|
+
*(uint32_t*)0x20000064 = 0;
|
282
|
+
*(uint32_t*)0x20000068 = 0;
|
283
|
+
*(uint32_t*)0x2000006c = 0;
|
284
|
+
*(uint32_t*)0x20000070 = 0;
|
285
|
+
*(uint32_t*)0x20000074 = 0;
|
286
|
+
*(uint32_t*)0x20000078 = 0;
|
287
|
+
*(uint32_t*)0x2000007c = 0;
|
288
|
+
*(uint32_t*)0x20000080 = 0;
|
289
|
+
*(uint32_t*)0x20000084 = 0;
|
290
|
+
*(uint64_t*)0x20000088 = 0;
|
291
|
+
*(uint32_t*)0x20000090 = 0;
|
292
|
+
*(uint32_t*)0x20000094 = 0;
|
293
|
+
*(uint32_t*)0x20000098 = 0;
|
294
|
+
*(uint32_t*)0x2000009c = 0;
|
295
|
+
*(uint32_t*)0x200000a0 = 0;
|
296
|
+
*(uint32_t*)0x200000a4 = 0;
|
297
|
+
*(uint32_t*)0x200000a8 = 0;
|
298
|
+
*(uint32_t*)0x200000ac = 0;
|
299
|
+
*(uint64_t*)0x200000b0 = 0;
|
300
|
+
res = __sys_io_uring_setup(0x64, (struct io_uring_params *) 0x20000040UL);
|
301
|
+
if (res != -1)
|
302
|
+
r[0] = res;
|
303
|
+
break;
|
304
|
+
case 1:
|
305
|
+
__sys_io_uring_register((long)r[0], 0, 0, 0);
|
306
|
+
break;
|
307
|
+
case 2:
|
308
|
+
__sys_io_uring_register((long)r[0], 0, 0, 0);
|
309
|
+
break;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
static void sig_int(int sig)
|
314
|
+
{
|
315
|
+
exit(0);
|
316
|
+
}
|
317
|
+
|
318
|
+
int main(int argc, char *argv[])
|
319
|
+
{
|
320
|
+
if (argc > 1)
|
321
|
+
return T_EXIT_SKIP;
|
322
|
+
signal(SIGINT, sig_int);
|
323
|
+
mmap((void *) 0x20000000, 0x1000000, 3, MAP_ANON|MAP_PRIVATE, -1, 0);
|
324
|
+
signal(SIGALRM, sig_int);
|
325
|
+
alarm(5);
|
326
|
+
|
327
|
+
loop();
|
328
|
+
return T_EXIT_PASS;
|
329
|
+
}
|