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

helpers: avoid triggering a kernel warning #320

Merged
merged 1 commit into from
Dec 1, 2023
Merged

Conversation

RAOF
Copy link
Contributor

@RAOF RAOF commented Dec 1, 2023

In kernels ≥ 6.3 there's a warning generated when you create a memfd without setting one of MFD_NOEXEC_SEAL or MFD_EXEC. Since we don't need to be able to execute our shm buffers, set MFD_NOEXEC_SEAL when:

  • We're built against sufficiently new kernel headers, and
  • The kernel we're running on is sufficiently new.

memfd_create will return EINVAL if it doesn't understand MFD_NOEXEC_SEAL (ie: if it's too old), so it's easy to fallback.

In kernels ≥ 6.3 there's a warning generated when you create a memfd without
setting one of `MFD_NOEXEC_SEAL` or `MFD_EXEC`. Since we don't need to be
able to execute our shm buffers, set `MFD_NOEXEC_SEAL` when:
* We're built against sufficiently new kernel headers, and
* The kernel we're running on is sufficiently new.

`memfd_create` will return `EINVAL` if it doesn't understand
`MFD_NOEXEC_SEAL` (ie: if it's too old), so it's easy to fallback.
Copy link
Contributor

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

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

Sure

@AlanGriffiths AlanGriffiths added this pull request to the merge queue Dec 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 1, 2023
@AlanGriffiths AlanGriffiths added this pull request to the merge queue Dec 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 1, 2023
@Saviq Saviq added this pull request to the merge queue Dec 1, 2023
Merged via the queue into main with commit 6f00911 Dec 1, 2023
12 checks passed
@Saviq Saviq deleted the avoid-kernel-warning branch December 1, 2023 19:30
@Saviq Saviq mentioned this pull request Dec 14, 2023
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