@nxtedition/rocksdb 5.2.36 → 5.2.39
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.
- package/binding.cc +66 -91
- package/deps/liburing/liburing/COPYING +502 -0
- package/deps/liburing/liburing/COPYING.GPL +339 -0
- package/deps/liburing/liburing/LICENSE +7 -0
- package/deps/liburing/liburing/Makefile +84 -0
- package/deps/liburing/liburing/Makefile.quiet +11 -0
- package/deps/liburing/liburing/README +46 -0
- package/deps/liburing/liburing/configure +420 -0
- package/deps/liburing/liburing/debian/README.Debian +7 -0
- package/deps/liburing/liburing/debian/changelog +27 -0
- package/deps/liburing/liburing/debian/compat +1 -0
- package/deps/liburing/liburing/debian/control +48 -0
- package/deps/liburing/liburing/debian/copyright +49 -0
- package/deps/liburing/liburing/debian/liburing-dev.install +4 -0
- package/deps/liburing/liburing/debian/liburing-dev.manpages +6 -0
- package/deps/liburing/liburing/debian/liburing1-udeb.install +1 -0
- package/deps/liburing/liburing/debian/liburing1.install +1 -0
- package/deps/liburing/liburing/debian/liburing1.symbols +32 -0
- package/deps/liburing/liburing/debian/patches/series +1 -0
- package/deps/liburing/liburing/debian/rules +81 -0
- package/deps/liburing/liburing/debian/source/format +1 -0
- package/deps/liburing/liburing/debian/source/local-options +2 -0
- package/deps/liburing/liburing/debian/source/options +1 -0
- package/deps/liburing/liburing/debian/watch +3 -0
- package/deps/liburing/liburing/examples/Makefile +29 -0
- package/deps/liburing/liburing/examples/io_uring-cp.c +279 -0
- package/deps/liburing/liburing/examples/io_uring-test.c +112 -0
- package/deps/liburing/liburing/examples/link-cp.c +193 -0
- package/deps/liburing/liburing/examples/ucontext-cp.c +273 -0
- package/deps/liburing/liburing/liburing.pc.in +12 -0
- package/deps/liburing/liburing/liburing.spec +66 -0
- package/deps/liburing/liburing/make-debs.sh +53 -0
- package/deps/liburing/liburing/man/io_uring.7 +736 -0
- package/deps/liburing/liburing/man/io_uring_enter.2 +1403 -0
- package/deps/liburing/liburing/man/io_uring_get_sqe.3 +37 -0
- package/deps/liburing/liburing/man/io_uring_queue_exit.3 +27 -0
- package/deps/liburing/liburing/man/io_uring_queue_init.3 +44 -0
- package/deps/liburing/liburing/man/io_uring_register.2 +605 -0
- package/deps/liburing/liburing/man/io_uring_setup.2 +515 -0
- package/deps/liburing/liburing/src/Makefile +76 -0
- package/deps/liburing/liburing/src/include/liburing/barrier.h +73 -0
- package/deps/liburing/liburing/src/include/liburing/io_uring.h +422 -0
- package/deps/liburing/liburing/src/include/liburing.h +775 -0
- package/deps/liburing/liburing/src/liburing.map +46 -0
- package/deps/liburing/liburing/src/queue.c +403 -0
- package/deps/liburing/liburing/src/register.c +299 -0
- package/deps/liburing/liburing/src/setup.c +356 -0
- package/deps/liburing/liburing/src/syscall.c +73 -0
- package/deps/liburing/liburing/src/syscall.h +20 -0
- package/deps/liburing/liburing/test/232c93d07b74-test.c +305 -0
- package/deps/liburing/liburing/test/35fa71a030ca-test.c +329 -0
- package/deps/liburing/liburing/test/500f9fbadef8-test.c +89 -0
- package/deps/liburing/liburing/test/7ad0e4b2f83c-test.c +93 -0
- package/deps/liburing/liburing/test/8a9973408177-test.c +106 -0
- package/deps/liburing/liburing/test/917257daa0fe-test.c +53 -0
- package/deps/liburing/liburing/test/Makefile +312 -0
- package/deps/liburing/liburing/test/a0908ae19763-test.c +58 -0
- package/deps/liburing/liburing/test/a4c0b3decb33-test.c +180 -0
- package/deps/liburing/liburing/test/accept-link.c +251 -0
- package/deps/liburing/liburing/test/accept-reuse.c +164 -0
- package/deps/liburing/liburing/test/accept-test.c +79 -0
- package/deps/liburing/liburing/test/accept.c +476 -0
- package/deps/liburing/liburing/test/across-fork.c +283 -0
- package/deps/liburing/liburing/test/b19062a56726-test.c +53 -0
- package/deps/liburing/liburing/test/b5837bd5311d-test.c +77 -0
- package/deps/liburing/liburing/test/ce593a6c480a-test.c +135 -0
- package/deps/liburing/liburing/test/close-opath.c +122 -0
- package/deps/liburing/liburing/test/config +10 -0
- package/deps/liburing/liburing/test/connect.c +398 -0
- package/deps/liburing/liburing/test/cq-full.c +96 -0
- package/deps/liburing/liburing/test/cq-overflow.c +294 -0
- package/deps/liburing/liburing/test/cq-peek-batch.c +102 -0
- package/deps/liburing/liburing/test/cq-ready.c +94 -0
- package/deps/liburing/liburing/test/cq-size.c +58 -0
- package/deps/liburing/liburing/test/d4ae271dfaae-test.c +96 -0
- package/deps/liburing/liburing/test/d77a67ed5f27-test.c +65 -0
- package/deps/liburing/liburing/test/defer.c +307 -0
- package/deps/liburing/liburing/test/double-poll-crash.c +186 -0
- package/deps/liburing/liburing/test/eeed8b54e0df-test.c +114 -0
- package/deps/liburing/liburing/test/empty-eownerdead.c +42 -0
- package/deps/liburing/liburing/test/eventfd-disable.c +151 -0
- package/deps/liburing/liburing/test/eventfd-ring.c +97 -0
- package/deps/liburing/liburing/test/eventfd.c +112 -0
- package/deps/liburing/liburing/test/fadvise.c +202 -0
- package/deps/liburing/liburing/test/fallocate.c +249 -0
- package/deps/liburing/liburing/test/fc2a85cb02ef-test.c +138 -0
- package/deps/liburing/liburing/test/file-register.c +843 -0
- package/deps/liburing/liburing/test/file-update.c +173 -0
- package/deps/liburing/liburing/test/files-exit-hang-poll.c +128 -0
- package/deps/liburing/liburing/test/files-exit-hang-timeout.c +134 -0
- package/deps/liburing/liburing/test/fixed-link.c +90 -0
- package/deps/liburing/liburing/test/fsync.c +224 -0
- package/deps/liburing/liburing/test/hardlink.c +136 -0
- package/deps/liburing/liburing/test/helpers.c +135 -0
- package/deps/liburing/liburing/test/helpers.h +67 -0
- package/deps/liburing/liburing/test/io-cancel.c +537 -0
- package/deps/liburing/liburing/test/io_uring_enter.c +296 -0
- package/deps/liburing/liburing/test/io_uring_register.c +664 -0
- package/deps/liburing/liburing/test/io_uring_setup.c +192 -0
- package/deps/liburing/liburing/test/iopoll.c +366 -0
- package/deps/liburing/liburing/test/lfs-openat-write.c +117 -0
- package/deps/liburing/liburing/test/lfs-openat.c +273 -0
- package/deps/liburing/liburing/test/link-timeout.c +1107 -0
- package/deps/liburing/liburing/test/link.c +496 -0
- package/deps/liburing/liburing/test/link_drain.c +229 -0
- package/deps/liburing/liburing/test/madvise.c +195 -0
- package/deps/liburing/liburing/test/mkdir.c +108 -0
- package/deps/liburing/liburing/test/multicqes_drain.c +383 -0
- package/deps/liburing/liburing/test/nop-all-sizes.c +107 -0
- package/deps/liburing/liburing/test/nop.c +115 -0
- package/deps/liburing/liburing/test/open-close.c +146 -0
- package/deps/liburing/liburing/test/openat2.c +240 -0
- package/deps/liburing/liburing/test/personality.c +204 -0
- package/deps/liburing/liburing/test/pipe-eof.c +81 -0
- package/deps/liburing/liburing/test/pipe-reuse.c +105 -0
- package/deps/liburing/liburing/test/poll-cancel-ton.c +139 -0
- package/deps/liburing/liburing/test/poll-cancel.c +135 -0
- package/deps/liburing/liburing/test/poll-link.c +227 -0
- package/deps/liburing/liburing/test/poll-many.c +208 -0
- package/deps/liburing/liburing/test/poll-mshot-update.c +273 -0
- package/deps/liburing/liburing/test/poll-ring.c +48 -0
- package/deps/liburing/liburing/test/poll-v-poll.c +353 -0
- package/deps/liburing/liburing/test/poll.c +109 -0
- package/deps/liburing/liburing/test/probe.c +137 -0
- package/deps/liburing/liburing/test/read-write.c +876 -0
- package/deps/liburing/liburing/test/register-restrictions.c +633 -0
- package/deps/liburing/liburing/test/rename.c +134 -0
- package/deps/liburing/liburing/test/ring-leak.c +173 -0
- package/deps/liburing/liburing/test/ring-leak2.c +249 -0
- package/deps/liburing/liburing/test/rsrc_tags.c +449 -0
- package/deps/liburing/liburing/test/runtests-loop.sh +16 -0
- package/deps/liburing/liburing/test/runtests.sh +170 -0
- package/deps/liburing/liburing/test/rw_merge_test.c +97 -0
- package/deps/liburing/liburing/test/self.c +91 -0
- package/deps/liburing/liburing/test/send_recv.c +291 -0
- package/deps/liburing/liburing/test/send_recvmsg.c +345 -0
- package/deps/liburing/liburing/test/sendmsg_fs_cve.c +198 -0
- package/deps/liburing/liburing/test/shared-wq.c +84 -0
- package/deps/liburing/liburing/test/short-read.c +75 -0
- package/deps/liburing/liburing/test/shutdown.c +163 -0
- package/deps/liburing/liburing/test/sigfd-deadlock.c +74 -0
- package/deps/liburing/liburing/test/socket-rw-eagain.c +156 -0
- package/deps/liburing/liburing/test/socket-rw.c +147 -0
- package/deps/liburing/liburing/test/splice.c +511 -0
- package/deps/liburing/liburing/test/sq-full-cpp.cc +45 -0
- package/deps/liburing/liburing/test/sq-full.c +45 -0
- package/deps/liburing/liburing/test/sq-poll-dup.c +200 -0
- package/deps/liburing/liburing/test/sq-poll-kthread.c +168 -0
- package/deps/liburing/liburing/test/sq-poll-share.c +137 -0
- package/deps/liburing/liburing/test/sq-space_left.c +159 -0
- package/deps/liburing/liburing/test/sqpoll-cancel-hang.c +159 -0
- package/deps/liburing/liburing/test/sqpoll-disable-exit.c +195 -0
- package/deps/liburing/liburing/test/sqpoll-exit-hang.c +77 -0
- package/deps/liburing/liburing/test/sqpoll-sleep.c +68 -0
- package/deps/liburing/liburing/test/statx.c +172 -0
- package/deps/liburing/liburing/test/stdout.c +232 -0
- package/deps/liburing/liburing/test/submit-link-fail.c +154 -0
- package/deps/liburing/liburing/test/submit-reuse.c +239 -0
- package/deps/liburing/liburing/test/symlink.c +116 -0
- package/deps/liburing/liburing/test/teardowns.c +58 -0
- package/deps/liburing/liburing/test/thread-exit.c +131 -0
- package/deps/liburing/liburing/test/timeout-new.c +246 -0
- package/deps/liburing/liburing/test/timeout-overflow.c +204 -0
- package/deps/liburing/liburing/test/timeout.c +1354 -0
- package/deps/liburing/liburing/test/unlink.c +111 -0
- package/deps/liburing/liburing/test/wakeup-hang.c +162 -0
- package/deps/liburing/liburing.gyp +20 -0
- package/deps/rocksdb/rocksdb/db/corruption_test.cc +62 -0
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +7 -62
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +25 -11
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +74 -155
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +1 -2
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.h +2 -2
- package/deps/rocksdb/rocksdb/env/fs_posix.cc +13 -0
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +4 -2
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +22 -4
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +15 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +1 -1
- package/deps/rocksdb/rocksdb/monitoring/statistics.cc +3 -0
- package/deps/rocksdb/rocksdb/monitoring/stats_history_test.cc +3 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +2 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +44 -29
- package/deps/rocksdb/rocksdb.gyp +4 -3
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/prebuilds/linux-x64/node.napi.node +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
|
2
|
+
/*
|
|
3
|
+
* Description: test io_uring fallocate
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
#include <errno.h>
|
|
7
|
+
#include <stdio.h>
|
|
8
|
+
#include <unistd.h>
|
|
9
|
+
#include <sys/types.h>
|
|
10
|
+
#include <sys/stat.h>
|
|
11
|
+
#include <sys/resource.h>
|
|
12
|
+
#include <stdlib.h>
|
|
13
|
+
#include <string.h>
|
|
14
|
+
#include <fcntl.h>
|
|
15
|
+
|
|
16
|
+
#include "liburing.h"
|
|
17
|
+
|
|
18
|
+
static int no_fallocate;
|
|
19
|
+
|
|
20
|
+
static int test_fallocate_rlimit(struct io_uring *ring)
|
|
21
|
+
{
|
|
22
|
+
struct io_uring_cqe *cqe;
|
|
23
|
+
struct io_uring_sqe *sqe;
|
|
24
|
+
struct rlimit rlim;
|
|
25
|
+
char buf[32];
|
|
26
|
+
int fd, ret;
|
|
27
|
+
|
|
28
|
+
if (getrlimit(RLIMIT_FSIZE, &rlim) < 0) {
|
|
29
|
+
perror("getrlimit");
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
rlim.rlim_cur = 64 * 1024;
|
|
33
|
+
rlim.rlim_max = 64 * 1024;
|
|
34
|
+
if (setrlimit(RLIMIT_FSIZE, &rlim) < 0) {
|
|
35
|
+
perror("setrlimit");
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
sprintf(buf, "./XXXXXX");
|
|
40
|
+
fd = mkstemp(buf);
|
|
41
|
+
if (fd < 0) {
|
|
42
|
+
perror("open");
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
unlink(buf);
|
|
46
|
+
|
|
47
|
+
sqe = io_uring_get_sqe(ring);
|
|
48
|
+
if (!sqe) {
|
|
49
|
+
fprintf(stderr, "get sqe failed\n");
|
|
50
|
+
goto err;
|
|
51
|
+
}
|
|
52
|
+
io_uring_prep_fallocate(sqe, fd, 0, 0, 128*1024);
|
|
53
|
+
|
|
54
|
+
ret = io_uring_submit(ring);
|
|
55
|
+
if (ret <= 0) {
|
|
56
|
+
fprintf(stderr, "sqe submit failed: %d\n", ret);
|
|
57
|
+
goto err;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
|
61
|
+
if (ret < 0) {
|
|
62
|
+
fprintf(stderr, "wait completion %d\n", ret);
|
|
63
|
+
goto err;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (cqe->res == -EINVAL) {
|
|
67
|
+
fprintf(stdout, "Fallocate not supported, skipping\n");
|
|
68
|
+
no_fallocate = 1;
|
|
69
|
+
goto out;
|
|
70
|
+
} else if (cqe->res != -EFBIG) {
|
|
71
|
+
fprintf(stderr, "Expected -EFBIG: %d\n", cqe->res);
|
|
72
|
+
goto err;
|
|
73
|
+
}
|
|
74
|
+
io_uring_cqe_seen(ring, cqe);
|
|
75
|
+
out:
|
|
76
|
+
return 0;
|
|
77
|
+
err:
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static int test_fallocate(struct io_uring *ring)
|
|
82
|
+
{
|
|
83
|
+
struct io_uring_cqe *cqe;
|
|
84
|
+
struct io_uring_sqe *sqe;
|
|
85
|
+
struct stat st;
|
|
86
|
+
char buf[32];
|
|
87
|
+
int fd, ret;
|
|
88
|
+
|
|
89
|
+
sprintf(buf, "./XXXXXX");
|
|
90
|
+
fd = mkstemp(buf);
|
|
91
|
+
if (fd < 0) {
|
|
92
|
+
perror("open");
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
unlink(buf);
|
|
96
|
+
|
|
97
|
+
sqe = io_uring_get_sqe(ring);
|
|
98
|
+
if (!sqe) {
|
|
99
|
+
fprintf(stderr, "get sqe failed\n");
|
|
100
|
+
goto err;
|
|
101
|
+
}
|
|
102
|
+
io_uring_prep_fallocate(sqe, fd, 0, 0, 128*1024);
|
|
103
|
+
|
|
104
|
+
ret = io_uring_submit(ring);
|
|
105
|
+
if (ret <= 0) {
|
|
106
|
+
fprintf(stderr, "sqe submit failed: %d\n", ret);
|
|
107
|
+
goto err;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
|
111
|
+
if (ret < 0) {
|
|
112
|
+
fprintf(stderr, "wait completion %d\n", ret);
|
|
113
|
+
goto err;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (cqe->res == -EINVAL) {
|
|
117
|
+
fprintf(stdout, "Fallocate not supported, skipping\n");
|
|
118
|
+
no_fallocate = 1;
|
|
119
|
+
goto out;
|
|
120
|
+
}
|
|
121
|
+
if (cqe->res) {
|
|
122
|
+
fprintf(stderr, "cqe->res=%d\n", cqe->res);
|
|
123
|
+
goto err;
|
|
124
|
+
}
|
|
125
|
+
io_uring_cqe_seen(ring, cqe);
|
|
126
|
+
|
|
127
|
+
if (fstat(fd, &st) < 0) {
|
|
128
|
+
perror("stat");
|
|
129
|
+
goto err;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (st.st_size != 128*1024) {
|
|
133
|
+
fprintf(stderr, "Size mismatch: %llu\n",
|
|
134
|
+
(unsigned long long) st.st_size);
|
|
135
|
+
goto err;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
out:
|
|
139
|
+
return 0;
|
|
140
|
+
err:
|
|
141
|
+
return 1;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static int test_fallocate_fsync(struct io_uring *ring)
|
|
145
|
+
{
|
|
146
|
+
struct io_uring_cqe *cqe;
|
|
147
|
+
struct io_uring_sqe *sqe;
|
|
148
|
+
struct stat st;
|
|
149
|
+
char buf[32];
|
|
150
|
+
int fd, ret, i;
|
|
151
|
+
|
|
152
|
+
if (no_fallocate)
|
|
153
|
+
return 0;
|
|
154
|
+
|
|
155
|
+
sprintf(buf, "./XXXXXX");
|
|
156
|
+
fd = mkstemp(buf);
|
|
157
|
+
if (fd < 0) {
|
|
158
|
+
perror("open");
|
|
159
|
+
return 1;
|
|
160
|
+
}
|
|
161
|
+
unlink(buf);
|
|
162
|
+
|
|
163
|
+
sqe = io_uring_get_sqe(ring);
|
|
164
|
+
if (!sqe) {
|
|
165
|
+
fprintf(stderr, "get sqe failed\n");
|
|
166
|
+
goto err;
|
|
167
|
+
}
|
|
168
|
+
io_uring_prep_fallocate(sqe, fd, 0, 0, 128*1024);
|
|
169
|
+
sqe->flags |= IOSQE_IO_LINK;
|
|
170
|
+
sqe->user_data = 1;
|
|
171
|
+
|
|
172
|
+
sqe = io_uring_get_sqe(ring);
|
|
173
|
+
if (!sqe) {
|
|
174
|
+
fprintf(stderr, "get sqe failed\n");
|
|
175
|
+
goto err;
|
|
176
|
+
}
|
|
177
|
+
io_uring_prep_fsync(sqe, fd, 0);
|
|
178
|
+
sqe->user_data = 2;
|
|
179
|
+
|
|
180
|
+
ret = io_uring_submit(ring);
|
|
181
|
+
if (ret <= 0) {
|
|
182
|
+
fprintf(stderr, "sqe submit failed: %d\n", ret);
|
|
183
|
+
goto err;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
for (i = 0; i < 2; i++) {
|
|
187
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
|
188
|
+
if (ret < 0) {
|
|
189
|
+
fprintf(stderr, "wait completion %d\n", ret);
|
|
190
|
+
goto err;
|
|
191
|
+
}
|
|
192
|
+
if (cqe->res) {
|
|
193
|
+
fprintf(stderr, "cqe->res=%d,data=%" PRIu64 "\n", cqe->res,
|
|
194
|
+
(uint64_t) cqe->user_data);
|
|
195
|
+
goto err;
|
|
196
|
+
}
|
|
197
|
+
io_uring_cqe_seen(ring, cqe);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (fstat(fd, &st) < 0) {
|
|
201
|
+
perror("stat");
|
|
202
|
+
goto err;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (st.st_size != 128*1024) {
|
|
206
|
+
fprintf(stderr, "Size mismatch: %llu\n",
|
|
207
|
+
(unsigned long long) st.st_size);
|
|
208
|
+
goto err;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return 0;
|
|
212
|
+
err:
|
|
213
|
+
return 1;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
int main(int argc, char *argv[])
|
|
217
|
+
{
|
|
218
|
+
struct io_uring ring;
|
|
219
|
+
int ret;
|
|
220
|
+
|
|
221
|
+
if (argc > 1)
|
|
222
|
+
return 0;
|
|
223
|
+
|
|
224
|
+
ret = io_uring_queue_init(8, &ring, 0);
|
|
225
|
+
if (ret) {
|
|
226
|
+
fprintf(stderr, "ring setup failed\n");
|
|
227
|
+
return 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
ret = test_fallocate(&ring);
|
|
231
|
+
if (ret) {
|
|
232
|
+
fprintf(stderr, "test_fallocate failed\n");
|
|
233
|
+
return ret;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
ret = test_fallocate_fsync(&ring);
|
|
237
|
+
if (ret) {
|
|
238
|
+
fprintf(stderr, "test_fallocate_fsync failed\n");
|
|
239
|
+
return ret;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
ret = test_fallocate_rlimit(&ring);
|
|
243
|
+
if (ret) {
|
|
244
|
+
fprintf(stderr, "test_fallocate_rlimit failed\n");
|
|
245
|
+
return ret;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return 0;
|
|
249
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
|
2
|
+
// https://syzkaller.appspot.com/bug?id=1f2ecd7a23dba87e5ca3505ec44514a462cfe8c0
|
|
3
|
+
// autogenerated by syzkaller (https://github.com/google/syzkaller)
|
|
4
|
+
|
|
5
|
+
#include <errno.h>
|
|
6
|
+
#include <fcntl.h>
|
|
7
|
+
#include <stdarg.h>
|
|
8
|
+
#include <stdbool.h>
|
|
9
|
+
#include <stdint.h>
|
|
10
|
+
#include <stdio.h>
|
|
11
|
+
#include <stdlib.h>
|
|
12
|
+
#include <string.h>
|
|
13
|
+
#include <sys/socket.h>
|
|
14
|
+
#include <sys/types.h>
|
|
15
|
+
#include <sys/mman.h>
|
|
16
|
+
#include <unistd.h>
|
|
17
|
+
|
|
18
|
+
#include "liburing.h"
|
|
19
|
+
#include "../src/syscall.h"
|
|
20
|
+
|
|
21
|
+
static bool write_file(const char* file, const char* what, ...)
|
|
22
|
+
{
|
|
23
|
+
char buf[1024];
|
|
24
|
+
va_list args;
|
|
25
|
+
va_start(args, what);
|
|
26
|
+
vsnprintf(buf, sizeof(buf), what, args);
|
|
27
|
+
va_end(args);
|
|
28
|
+
buf[sizeof(buf) - 1] = 0;
|
|
29
|
+
int len = strlen(buf);
|
|
30
|
+
int fd = open(file, O_WRONLY | O_CLOEXEC);
|
|
31
|
+
if (fd == -1)
|
|
32
|
+
return false;
|
|
33
|
+
if (write(fd, buf, len) != len) {
|
|
34
|
+
int err = errno;
|
|
35
|
+
close(fd);
|
|
36
|
+
errno = err;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
close(fd);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static int inject_fault(int nth)
|
|
44
|
+
{
|
|
45
|
+
int fd;
|
|
46
|
+
fd = open("/proc/thread-self/fail-nth", O_RDWR);
|
|
47
|
+
if (fd == -1)
|
|
48
|
+
exit(1);
|
|
49
|
+
char buf[16];
|
|
50
|
+
sprintf(buf, "%d", nth + 1);
|
|
51
|
+
if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf))
|
|
52
|
+
exit(1);
|
|
53
|
+
return fd;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static int setup_fault()
|
|
57
|
+
{
|
|
58
|
+
static struct {
|
|
59
|
+
const char* file;
|
|
60
|
+
const char* val;
|
|
61
|
+
bool fatal;
|
|
62
|
+
} files[] = {
|
|
63
|
+
{"/sys/kernel/debug/failslab/ignore-gfp-wait", "N", true},
|
|
64
|
+
{"/sys/kernel/debug/failslab/verbose", "0", false},
|
|
65
|
+
{"/sys/kernel/debug/fail_futex/ignore-private", "N", false},
|
|
66
|
+
{"/sys/kernel/debug/fail_page_alloc/verbose", "0", false},
|
|
67
|
+
{"/sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem", "N", false},
|
|
68
|
+
{"/sys/kernel/debug/fail_page_alloc/ignore-gfp-wait", "N", false},
|
|
69
|
+
{"/sys/kernel/debug/fail_page_alloc/min-order", "0", false},
|
|
70
|
+
};
|
|
71
|
+
unsigned i;
|
|
72
|
+
for (i = 0; i < sizeof(files) / sizeof(files[0]); i++) {
|
|
73
|
+
if (!write_file(files[i].file, files[i].val)) {
|
|
74
|
+
if (files[i].fatal)
|
|
75
|
+
return 1;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#ifndef __NR_io_uring_register
|
|
82
|
+
#define __NR_io_uring_register 427
|
|
83
|
+
#endif
|
|
84
|
+
#ifndef __NR_io_uring_setup
|
|
85
|
+
#define __NR_io_uring_setup 425
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
|
|
89
|
+
|
|
90
|
+
int main(int argc, char *argv[])
|
|
91
|
+
{
|
|
92
|
+
if (argc > 1)
|
|
93
|
+
return 0;
|
|
94
|
+
mmap((void *) 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0);
|
|
95
|
+
if (setup_fault()) {
|
|
96
|
+
printf("Test needs failslab/fail_futex/fail_page_alloc enabled, skipped\n");
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
intptr_t res = 0;
|
|
100
|
+
*(uint32_t*)0x20000000 = 0;
|
|
101
|
+
*(uint32_t*)0x20000004 = 0;
|
|
102
|
+
*(uint32_t*)0x20000008 = 0;
|
|
103
|
+
*(uint32_t*)0x2000000c = 0;
|
|
104
|
+
*(uint32_t*)0x20000010 = 0;
|
|
105
|
+
*(uint32_t*)0x20000014 = 0;
|
|
106
|
+
*(uint32_t*)0x20000018 = 0;
|
|
107
|
+
*(uint32_t*)0x2000001c = 0;
|
|
108
|
+
*(uint32_t*)0x20000020 = 0;
|
|
109
|
+
*(uint32_t*)0x20000024 = 0;
|
|
110
|
+
*(uint32_t*)0x20000028 = 0;
|
|
111
|
+
*(uint32_t*)0x2000002c = 0;
|
|
112
|
+
*(uint32_t*)0x20000030 = 0;
|
|
113
|
+
*(uint32_t*)0x20000034 = 0;
|
|
114
|
+
*(uint32_t*)0x20000038 = 0;
|
|
115
|
+
*(uint32_t*)0x2000003c = 0;
|
|
116
|
+
*(uint32_t*)0x20000040 = 0;
|
|
117
|
+
*(uint32_t*)0x20000044 = 0;
|
|
118
|
+
*(uint64_t*)0x20000048 = 0;
|
|
119
|
+
*(uint32_t*)0x20000050 = 0;
|
|
120
|
+
*(uint32_t*)0x20000054 = 0;
|
|
121
|
+
*(uint32_t*)0x20000058 = 0;
|
|
122
|
+
*(uint32_t*)0x2000005c = 0;
|
|
123
|
+
*(uint32_t*)0x20000060 = 0;
|
|
124
|
+
*(uint32_t*)0x20000064 = 0;
|
|
125
|
+
*(uint32_t*)0x20000068 = 0;
|
|
126
|
+
*(uint32_t*)0x2000006c = 0;
|
|
127
|
+
*(uint64_t*)0x20000070 = 0;
|
|
128
|
+
res = __sys_io_uring_setup(0x6a6, (struct io_uring_params *) 0x20000000ul);
|
|
129
|
+
if (res != -1)
|
|
130
|
+
r[0] = res;
|
|
131
|
+
res = socket(0x11ul, 2ul, 0x300ul);
|
|
132
|
+
if (res != -1)
|
|
133
|
+
r[1] = res;
|
|
134
|
+
*(uint32_t*)0x20000080 = r[1];
|
|
135
|
+
inject_fault(1);
|
|
136
|
+
__sys_io_uring_register(r[0], 2ul, (const void *) 0x20000080ul, 1ul);
|
|
137
|
+
return 0;
|
|
138
|
+
}
|