-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/no-mmap-inval: add test case for invalid SQ ring address
Signed-off-by: Jens Axboe <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* SPDX-License-Identifier: MIT */ | ||
/* | ||
* Description: test that using SETUP_NO_MMAP with an invalid SQ ring | ||
* address fails. | ||
* | ||
*/ | ||
#include <stdlib.h> | ||
#include <sys/types.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
|
||
#include "liburing.h" | ||
#include "helpers.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
struct io_uring_params p = { | ||
.sq_entries = 2, | ||
.cq_entries = 4, | ||
.flags = IORING_SETUP_NO_MMAP, | ||
}; | ||
int ret; | ||
|
||
if (argc > 1) | ||
return T_EXIT_SKIP; | ||
|
||
p.cq_off.user_addr = (unsigned long long) valloc(8192); | ||
|
||
ret = io_uring_setup(2, &p); | ||
if (ret != -EFAULT) { | ||
fprintf(stderr, "Got %d, wanted -EFAULT\n", ret); | ||
return T_EXIT_FAIL; | ||
} | ||
|
||
return T_EXIT_PASS; | ||
} |