libkrun, fs: Restrict the usage of REMOVE_ROOT_DIR_REQ ioctl#551
libkrun, fs: Restrict the usage of REMOVE_ROOT_DIR_REQ ioctl#551slp merged 1 commit intocontainers:mainfrom
Conversation
Summary of ChangesHello @mtjhrc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a security enhancement by restricting the powerful Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request effectively restricts the VIRTIO_IOC_REMOVE_ROOT_DIR_REQ ioctl to only be available on filesystems explicitly configured to allow root directory deletion. This is a significant security and stability improvement, preventing accidental or malicious deletion of critical filesystems. The changes are consistently applied across Linux and macOS implementations and correctly propagate the new allow_root_dir_delete flag through the configuration structs and function calls. The default for new filesystems is false, which is a safe choice, while the specific krun_set_root_disk_remount function correctly sets it to true for its intended use case of a throwaway filesystem.
Restrict the usage of VIRTIO_IOC_REMOVE_ROOT_DIR_REQ which deletes the root filesystem. Make it only available on the throwaway filesystem used by krun_set_root_disk_remount. Signed-off-by: Matej Hrica <mhrica@redhat.com>
94690d5 to
7ba34e6
Compare
|
Good one. I think we should go even further and completely get rid of this. Instead, we should allow |
|
On a second thought, this approach is much simpler and fixes the issue just fine. Let's get it merged, thanks! |
Yeah pretty much this, while there is definitely a better way to implement this functionality, this was just a simple improvement for the current status, suitable for 1.7.x. |
Restrict the usage of VIRTIO_IOC_REMOVE_ROOT_DIR_REQ which deletes the root filesystem. Make it only available on the throwaway filesystem used by krun_set_root_disk_remount.