Skip to content
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

update userfaultfd handling. #228

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

devnexen
Copy link
Contributor

in multithread setting, reporting the thread id when appropriate. Also, allowing to work from the user-space perspective from Linux 5.11
so reports can me made from its own addresses ranges.

@devnexen devnexen force-pushed the userfaultfd_handling_update branch from feda1da to 4ededc0 Compare April 13, 2024 08:21

if(_uf_fd == ERR) {
LOG_AND_ABORT("This kernel does not support userfaultfd");
LOG_AND_ABORT("This kernel does not support userfaultfd or disallowed in the user-space");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG_AND_ABORT("This kernel does not support userfaultfd or disallowed in the user-space");
LOG_AND_ABORT("This kernel does not support userfaultfd or is disallowed in the user-space");

@devnexen devnexen force-pushed the userfaultfd_handling_update branch from 4ededc0 to c73c307 Compare April 13, 2024 10:59
int flags = O_CLOEXEC | O_NONBLOCK;

#ifdef UFFD_USER_MODE_ONLY
// Below, the syscall fails not necessarily because lack of kernel support.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use C style comments

in multithread setting, reporting the thread id when appropriate.
Also, allowing to work from the user-space perspective from Linux 5.11
 so reports can me made from its own addresses ranges.
@devnexen devnexen force-pushed the userfaultfd_handling_update branch from c73c307 to d631286 Compare April 21, 2024 22:41
if(ioctl(_uf_fd, UFFDIO_API, &_uffd_api) == ERR) {
LOG_AND_ABORT("Failed to setup userfaultfd with ioctl");
}

#if THREAD_SUPPORT
if(!(_uffd_api.features & UFFD_FEATURE_THREAD_ID)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the ioctl call reset this if it cannot be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check errno for -EFAULT here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we really need to, return value is checked for ioctl already.

@struct struct merged commit f341ce7 into struct:master Apr 22, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants