multipass
multipass copied to clipboard
SSHFS mount failing to terminate crashes daemon on instance delete
Describe the bug If an sshfs mount fails to unmount during the deletion process the daemon will crash.
To Reproduce
- create an instance with some valid mount
- delete the instance while somehow ensuring the sshfs process will not terminate from SIGTERM
- observe daemon crash
Expected behavior The daemon does not crash. There is either an error with deletion or the mount is killed with SIGKILL. (There should also be no crash if SIGKILL fails)
Logs
[2024-11-29T12:42:43.199] [info] [sshfs-mount-handler] Stopping mount "/home/ubuntu/TEST_FOLDER" in instance 'healing-octopus'
[2024-11-29T12:42:48.203] [warning] [sshfs-mount-handler] Failed to gracefully stop mount "/home/ubuntu/TEST_FOLDER" in instance 'healing-octopus': Failed to terminate SSHFS mount process:
[2024-11-29T12:42:48.203] [info] [healing-octopus] Forcing shutdown
[2024-11-29T12:42:48.203] [info] [healing-octopus] Killing process
[2024-11-29T12:42:48.295] [info] [healing-octopus] process state changed to NotRunning
[2024-11-29T12:42:48.295] [info] [healing-octopus] process error occurred Crashed program: qemu-system-x86_64; error: Process crashed
[2024-11-29T12:42:48.336] [info] [healing-octopus] error: program: qemu-system-x86_64; error: Process crashed
[2024-11-29T12:42:48.336] [debug] [healing-octopus] Dropping cached SSH session
[2024-11-29T12:42:48.449] [debug] [daemon] Applied AppArmor policy: multipass.qemu-img
[2024-11-29T12:42:48.451] [debug] [qemu-img] [48278] started: qemu-img snapshot -l /home/trevor-shoe/.local/share/multipassd/vault/instances/healing-octopus/ubuntu-24.04-server-cloudimg-amd64.img
[2024-11-29T12:42:48.674] [debug] [daemon] Instance purged: healing-octopus
[2024-11-29T12:42:48.818] [warning] [Qt] QProcess: Destroyed while process ("/home/trevor-shoe/Desktop/Canonical/multipass/cmake-build-debug/bin/sshfs_server") is still running.
Signal: SIGSEGV (Segmentation fault)
Additional info
- OS: Ubuntu 24.04
-
multipass version: 1.15.0-dev.746+g9d3b26ccd -
multipass get local.driver: qemu
Additional context Looks like a use-after-free coming from QProcess signal handlers Occurs in GUI and CLI. Does not appear to be a regression. To prevent SIGTERM from working you can run Multipass through CLion as a snap.
I believe this is related to https://github.com/canonical/multipass/pull/3978