util/misc: support kernels where MFD_NOEXEC_SEAL
does not enable sealing
#366
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am trying to squash the kernel's peculiar behaviour of implicitly enabling sealing on
MFD_NOEXEC_SEAL
.dbus-broker
is one of the affected programs, but as noted below, only the test suite would break, normal operations wouldn't. At least as far as I can tell.Newer Linux kernels do not unset
F_SEAL_SEAL
whenMFD_NOEXEC_SEAL
is supplied tomemfd_create()
. Currently,misc_memfd()
has a workaround for this peculiarity of the kernel, however, this workaround will break.Avoid the breakage by checking if the kernel added
F_SEAL_SEAL
, and only try to add it if it is not already present.Note that this kernel uAPI change does not affect dbus-broker's normal operations since it never attempts to create a memfd with
MFD_NOEXEC_SEAL
and withoutMFD_ALLOW_SEALING
. Only the test suite would be broken on newer kernels without this change.v2: https://lore.kernel.org/linux-mm/[email protected]/
v1: https://lore.kernel.org/linux-mm/[email protected]/