-
Notifications
You must be signed in to change notification settings - Fork 29
feat: extend io_uring perm check to find EINVAL #923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: extend io_uring perm check to find EINVAL #923
Conversation
The io_uring_setup syscall may fail with EINVAL when called with the IORING_SETUP_SINGLE_ISSUER flag bit before support for that flag was added (linux 6.0). This would help the user deduce quickly that a kernel upgrade is required.
nomt/src/io/mod.rs
Outdated
| /// The device has permission to use io_uring, but does not support the flags required | ||
| /// for io_uring_setup. NOMT uses the IORING_SETUP_SINGLE_ISSUER flag for io_uring which | ||
| /// was introduced in linux 6.0. | ||
| MissingFlagSupport, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additional detection!
Unfortunately, this is a breaking change in the public API (all users matching on the IoUringPermission would have their code break after adding this additional variant)
How about we still return "Denied", but print a detailed warning message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I pushed a commit which returns NotSupported and prints an error containing the text you provided. Thanks for investigating and upstreaming the fix)
| println!(" | ||
| The device has permission to use io_uring, but does not support the flags required | ||
| for io_uring_setup. NOMT uses the IORING_SETUP_SINGLE_ISSUER flag for io_uring which | ||
| was introduced in linux 6.0. Please update your kernel to at least version 6.0 | ||
| to use NOMT with io_uring. | ||
| "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The multiline string literal includes all leading whitespace from the source code indentation. This will print with awkward indentation in the output.
The message will be displayed as:
(blank line)
The device has permission...
for io_uring_setup...
...
Fix by removing indentation inside the string:
println!("The device has permission to use io_uring, but does not support the flags required \
for io_uring_setup. NOMT uses the IORING_SETUP_SINGLE_ISSUER flag for io_uring which \
was introduced in linux 6.0. Please update your kernel to at least version 6.0 \
to use NOMT with io_uring.");Or use eprintln! for error messages instead of println!.
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
The io_uring_setup syscall may fail with EINVAL when called with the IORING_SETUP_SINGLE_ISSUER flag bit before support for that flag was added (linux 6.0). This would help the user deduce quickly that a kernel upgrade is required.