lxd/device: Disable virtiofsd idmap for shifted volumes - #18709
lxd/device: Disable virtiofsd idmap for shifted volumes#18709jonathan-conder wants to merge 1 commit into
Conversation
6abc738 to
a226aa9
Compare
There was a problem hiding this comment.
Pull request overview
Adjusts VM virtio-fs behavior so virtiofsd does not apply instance raw.idmap when serving shifted storage volumes, aligning file ownership semantics between VMs and containers and addressing the ownership mismatch described in #18686.
Changes:
- Update VM disk device setup to avoid parsing/applying
raw.idmapforsecurity.shiftedvolumes when startingvirtiofsd. - Add an integration test ensuring shifted volumes in VMs preserve on-disk ownership (i.e. do not appear as
nobody:nogroup) even whenraw.idmapis set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lxd/device/disk.go |
Skips applying raw.idmap to virtiofsd for security.shifted volumes during VM disk setup. |
test/suites/vm.sh |
Adds a regression test validating ownership consistency for shifted volumes shared into VMs over virtio-fs. |
Without this, file ownership in VMs doesn't match containers. This is technically a breaking change, but I suspect not many people are using raw.idmap together with shifted volumes, otherwise canonical#18561 probably would have been discovered sooner. If it's an issue I'm happy to gate this behind a new config option though. Signed-off-by: Jonathan Conder <jonathan.conder@canonical.com>
a226aa9 to
03fd41d
Compare
|
@tomponline Another approach would be to keep running |
Yes, effectively I think you're proposing to sandbox virtiofsd to give it permission to write/read files as root, but not to be able to run code as root. Right? |
Yeah. It would be limited to reading/writing those files within the shifted mount as well, can't touch /etc/shadow, etc. That said, virtiofsd is already sandboxed. So the change would be to add shifting to the mount (reducing the level of security but matching how things work for containers) |
|
Right. Lets focus on getting the behaviours aligned and then work on sandboxing separately once the correct behaviour is established. Thanks |
Partially fixes #18686. My rationale is described there.
Without this, file ownership in VMs doesn't match containers. This is technically a breaking change, but I suspect not many people are using raw.idmap together with shifted volumes, otherwise #18561 probably would have been discovered sooner. If it's an issue I'm happy to gate this behind a new config option though.
Checklist