-
Notifications
You must be signed in to change notification settings - Fork 27
Add builder flag to use user-mode only userfaultfd #18
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
Conversation
pchickey
left a comment
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.
CI shows that flag isn't available across all Linux versions - can you add the appropriate cfg logic to handle that?
|
Do you think I should make I've gone with 1st option for the time being. If it won't do, do tell. |
and add building for Linux 5.11 to CI
|
Does that mean the kernel detection should be done by the user of this crate, when deciding if feature I know that this crate previously used linux version detection and switched to features; however with no feature enabled, it worked for all kernels (>= 4.11), without the extra features. |
|
I've changed so at compile time there is no feature-flag. If |
| .unwrap_or(true) | ||
| { | ||
| flags |= raw::UFFD_USER_MODE_ONLY as i32; | ||
| } |
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'm not sure I understood your reply in the PR thread - does adding this flag cause an EINVAL on pre-5.11 kernels?
If so please add a comment above this check so we know why we are performing a runtime check
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 just tested with kernel 4.9 and calling userfaultfd with UFFD_USER_MODE_ONLY sets errno to EINVAL. I found a more robust way to check was to always try opening the fd with UFFD_USER_MODE_ONLY but retry without if it gives EINVAL (here linux_version seems to be parsing uname which could theoretically be inaccurate if running on a weirdly named kernel).
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.
what does uname -r report on this machine?
linux-version/Cargo.toml
Outdated
|
|
||
| [build-dependencies] | ||
| bindgen = { version = "0.51", default-features = false } | ||
| bindgen = { version = "0.57", default-features = false } |
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.
was this upgrade required?
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.
yes, otherwise there was a conflict on native crate clang-sys, linux-version transitively depends on v0.28.0, but userfaultfd-sys depends on ^1
acfoltzer
left a comment
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.
Thank you! I have a couple documentation tweaks, and a request to change the default behavior of this new flag.
Co-authored-by: Adam C. Foltzer <acfoltzer@acfoltzer.net>
|
@acfoltzer @pchickey Would you be ok to make a release of the crates after this PR is merged (if PR is ok for you)? |
pchickey
left a comment
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.
Sorry we forgot to get back to this one. Github Actions just upgraded the kernel underneath ubuntu-20.04 to 5.11, so we need this fix everywhere downstream to fix CI.
fix #16