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

qemu: mount rootfs as read-only #60

Closed
wants to merge 1 commit into from

Conversation

chantra
Copy link
Collaborator

@chantra chantra commented Jan 26, 2024

The contract is that the rootfs is mounted read-only. This was not happening.
When running the tool as an unprivileged user, this essentially was a no-op, but when running it using a rootfs owned by the user, it was then possible to write to those directories:

ls /tmp/main-s390x-chantra/home; \
> vmtest  -k s390x/kbuild-output/arch/s390/boot/bzImage -a s390x -r /tmp/main-s390x-chantra "touch /home/a"; \
> cargo run -- -k s390x/kbuild-output/arch/s390/boot/bzImage -a s390x -r /tmp/main-s390x-chantra "touch /home/b"; \
> ls /tmp/main-s390x-chantra/home
=> bzImage
===> Booting
===> Setting up VM
===> Running command

    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/vmtest -k s390x/kbuild-output/arch/s390/boot/bzImage -a s390x -r /tmp/main-s390x-chantra 'touch /home/b'`
=> bzImage
===> Booting
===> Setting up VM
===> Running command
touch: cannot touch '/home/b': Read-only file system
Command failed with exit code: 1

a

The contract is that the rootfs is mounted read-only.
This was not happening.
When running the tool as an unprivileged user, this essentially was a no-op,
but when running it using a rootfs owned by the user, it was then possible
to write to those directories:

```
ls /tmp/main-s390x-chantra/home; \
> vmtest  -k s390x/kbuild-output/arch/s390/boot/bzImage -a s390x -r /tmp/main-s390x-chantra "touch /home/a"; \
> cargo run -- -k s390x/kbuild-output/arch/s390/boot/bzImage -a s390x -r /tmp/main-s390x-chantra "touch /home/b"; \
> ls /tmp/main-s390x-chantra/home
=> bzImage
===> Booting
===> Setting up VM
===> Running command

    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/vmtest -k s390x/kbuild-output/arch/s390/boot/bzImage -a s390x -r /tmp/main-s390x-chantra 'touch /home/b'`
=> bzImage
===> Booting
===> Setting up VM
===> Running command
touch: cannot touch '/home/b': Read-only file system
Command failed with exit code: 1

a
```

Signed-off-by: Manu Bretelle <[email protected]>
@danobi
Copy link
Owner

danobi commented Jan 26, 2024

In c1620eb I changed rootfs to rw cuz I think a lot of tools were breaking. Is there an inconsistency in the doc I missed somewhere?

@chantra
Copy link
Collaborator Author

chantra commented Jan 26, 2024 via email

@danobi
Copy link
Owner

danobi commented Jan 26, 2024

Ah ok. If you are ok with current behavior I will put it on my todo list to update the diagram then. And probably upload source for diagram

@chantra
Copy link
Collaborator Author

chantra commented Jan 26, 2024 via email

@chantra
Copy link
Collaborator Author

chantra commented Jan 26, 2024

ok, closing this then as it is just a matter of updating the doc

@chantra chantra closed this Jan 26, 2024
@chantra chantra deleted the mount_root_ro branch January 26, 2024 18:13
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.

2 participants