From: Dylan Yudaken <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>,
Dylan Yudaken <[email protected]>
Subject: [PATCH liburing 1/4] add a test for bad buf_ring register
Date: Thu, 21 Jul 2022 07:42:26 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
This shows up a kernel panic in v5.19-rc7
Signed-off-by: Dylan Yudaken <[email protected]>
---
test/buf-ring.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/test/buf-ring.c b/test/buf-ring.c
index 5e032663d93b..b17030cbe952 100644
--- a/test/buf-ring.c
+++ b/test/buf-ring.c
@@ -206,6 +206,30 @@ static int test_reg_unreg(int bgid)
return 0;
}
+static int test_bad_reg(int bgid)
+{
+ struct io_uring ring;
+ int ret;
+ struct io_uring_buf_reg reg = { };
+
+ ret = t_create_ring(1, &ring, 0);
+ if (ret == T_SETUP_SKIP)
+ return 0;
+ else if (ret != T_SETUP_OK)
+ return 1;
+
+ reg.ring_addr = 4096;
+ reg.ring_entries = 32;
+ reg.bgid = bgid;
+
+ ret = io_uring_register_buf_ring(&ring, ®, 0);
+ if (!ret)
+ fprintf(stderr, "Buffer ring register worked unexpectedly\n");
+
+ io_uring_queue_exit(&ring);
+ return !ret;
+}
+
static int test_one_read(int fd, int bgid, struct io_uring *ring)
{
int ret;
@@ -359,6 +383,12 @@ int main(int argc, char *argv[])
if (no_buf_ring)
break;
+ ret = test_bad_reg(bgids[i]);
+ if (ret) {
+ fprintf(stderr, "test_bad_reg failed\n");
+ return T_EXIT_FAIL;
+ }
+
ret = test_double_reg_unreg(bgids[i]);
if (ret) {
fprintf(stderr, "test_double_reg_unreg failed\n");
--
2.30.2
next prev parent reply other threads:[~2022-07-21 14:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 14:42 [PATCH liburing 0/4] tests updates Dylan Yudaken
2022-07-21 14:42 ` Dylan Yudaken [this message]
2022-07-21 14:42 ` [PATCH liburing 2/4] Copy IORING_SETUP_SINGLE_ISSUER into io_uring.h Dylan Yudaken
2022-07-21 14:42 ` [PATCH liburing 3/4] test: poll-mshot-overflow use proper return codes Dylan Yudaken
2022-07-21 14:42 ` [PATCH liburing 4/4] skip poll-mshot-overflow on old kernels Dylan Yudaken
2022-07-21 14:57 ` Ammar Faizi
2022-07-21 15:26 ` [PATCH liburing 0/4] tests updates Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox