From c12db8879ab4583b8aa80664f1c5fd17d309b36e Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Mon, 2 Dec 2024 14:41:20 +0100 Subject: [PATCH] vsock: mount virtme_vsockmount if needed This will be used to get access to a script that will setup the remote shell: HOME dir, log with the right user, set tty, etc. This script will need to be created when a new connection is needed, to get access to the terminal dimension, and maybe more. Because of that, it is needed to have a way to share such info from the host to the VM. Signed-off-by: Matthieu Baerts (NGI0) --- src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.rs b/src/main.rs index 8198d0b..38d7fd4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1036,6 +1036,19 @@ fn setup_socat_console() { if let Ok(cmdline) = std::fs::read_to_string("/proc/cmdline") { if let Some(exec) = extract_vsock_exec(&cmdline) { thread::spawn(move || { + log!("setting up vsock proxy executing {}", exec); + let key = "virtme_vsockmount"; + if let Ok(path) = env::var(&key) { + utils::do_mkdir(&path); + utils::do_mount( + &key.replace('_', "."), + &path, + "9p", + 0, + "version=9p2000.L,trans=virtio,access=any", + ); + } + let from = "VSOCK-LISTEN:1024,reuseaddr,fork"; let to = format!("EXEC:\"{}\",pty,stderr,setsid,sigint,sane,echo=0", exec); let args = vec![from, &to];