-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
exeseal: do not use F_SEAL_FUTURE_WRITE #4641
Conversation
Thanks for the patch and figuring out the issue! Honestly, I think it would be simpler just to drop To be honest, I didn't read the man page very closely when adding it (I thought it restricted dirty page writebacks or something like that), but it seems that it is basically a no-op with |
934d060
to
fc1f8f1
Compare
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.
LGTM, thanks!
16cef58
to
fded781
Compare
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.
A nit, but perhaps it's better to remove the code entirely, rather than commenting it out. At most, add a comment telling something like
// Don't add F_SEAL_FUTURE_WRITE, it is not needed (and is buggy for Linux < 5.5).
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.
lgtm
e4cff82
to
869905f
Compare
Prior to kernel Linux 5.5, F_SEAL_FUTURE_WRITE has a bug which maps memory as shared between processes even if it is set as private. See kernel commit 05d351102dbe ("mm, memfd: fix COW issue on MAP_PRIVATE and F_SEAL_FUTURE_WRITE mappings") for more details. According to the fcntl(2) man pages, F_SEAL_WRITE is enough: > Furthermore, trying to create new shared, writable memory-mappings via > mmap(2) will also fail with EPERM. > > Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails > with EBUSY if any writable, shared mapping exists. Such mappings must > be unmapped before you can add this seal. F_SEAL_FUTURE_WRITE only makes sense if a read-write shared mapping in one process should be read-only in another process. This is not case for runc, especially not for the /proc/self/exe we are protecting. Signed-off-by: Tomasz Duda <[email protected]> (cyphar: improve the comment regarding F_SEAL_FUTURE_WRITE) (cyphar: improve commit message) Signed-off-by: Aleksa Sarai <[email protected]>
|
Prior to kernel Linux 5.5 F_SEAL_FUTURE_WRITE has bug which maps memory as shared
between processes even if it is set as private.
torvalds/linux@05d3511
Accoring to https://man.archlinux.org/man/fcntl64.2.en F_SEAL_WRITE is enough.
F_SEAL_FUTURE_WRITE make sens only if R/W shared mapping in one process should be
R/O in another process. This is not case for runc.
Fixes #4640