patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Alyssa Ross <hi@alyssa.is>, devel@spectrum-os.org
Subject: Re: [PATCH] tools/start-vmm: enable Cloud Hypervisor landlock
Date: Mon, 10 Nov 2025 13:59:07 -0500	[thread overview]
Message-ID: <4ef68aad-bd4f-4a2b-8c49-090c3002ee46@gmail.com> (raw)
In-Reply-To: <20251110184907.346511-1-hi@alyssa.is>


[-- Attachment #1.1.1: Type: text/plain, Size: 2826 bytes --]

On 11/10/25 13:49, Alyssa Ross wrote:
> We can't really predict the device paths or IOMMU groups statically,
> so this is as good as it gets with landlock rules.  We'll be able to
> do other things to further lock things down though, like running
> different Cloud Hypervisor instances as different users, and changing
> ownership of each IOMMU group in /dev/vfio/vfio to match.

QEMU supports passing all the needed files via file descriptors, which
might avoid this problem.  It would require changes to Cloud Hypervisor,
though.

> Signed-off-by: Alyssa Ross <hi@alyssa.is>
> ---
>  tools/start-vmm/ch.rs  |  8 ++++++++
>  tools/start-vmm/lib.rs | 15 +++++++++++++--
>  2 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/start-vmm/ch.rs b/tools/start-vmm/ch.rs
> index 80e75dc..ed2d457 100644
> --- a/tools/start-vmm/ch.rs
> +++ b/tools/start-vmm/ch.rs
> @@ -69,6 +69,12 @@ pub struct VsockConfig {
>      pub socket: String,
>  }
>  
> +#[derive(Serialize)]
> +pub struct LandlockConfig {
> +    pub path: String,
> +    pub access: &'static str,
> +}
> +
>  #[derive(Serialize)]
>  pub struct VmConfig {
>      pub console: ConsoleConfig,
> @@ -80,6 +86,8 @@ pub struct VmConfig {
>      pub payload: PayloadConfig,
>      pub serial: ConsoleConfig,
>      pub vsock: VsockConfig,
> +    pub landlock_enable: bool,
> +    pub landlock_rules: Vec<LandlockConfig>,
>  }
>  
>  fn command(vm_dir: &Path, s: impl AsRef<OsStr>) -> Command {
> diff --git a/tools/start-vmm/lib.rs b/tools/start-vmm/lib.rs
> index 5dc5ae7..9a77780 100644
> --- a/tools/start-vmm/lib.rs
> +++ b/tools/start-vmm/lib.rs
> @@ -14,8 +14,8 @@ use std::io::{self, ErrorKind};
>  use std::path::Path;
>  
>  use ch::{
> -    ConsoleConfig, DiskConfig, FsConfig, GpuConfig, MemoryConfig, PayloadConfig, VmConfig,
> -    VsockConfig,
> +    ConsoleConfig, DiskConfig, FsConfig, GpuConfig, LandlockConfig, MemoryConfig, PayloadConfig,
> +    VmConfig, VsockConfig,
>  };
>  use net::net_setup;
>  
> @@ -130,6 +130,17 @@ pub fn vm_config(vm_dir: &Path) -> Result<VmConfig, String> {
>              cid: 3,
>              socket: vm_dir.join("vsock").into_os_string().into_string().unwrap(),
>          },
> +        landlock_enable: true,
> +        landlock_rules: vec![
> +            LandlockConfig {
> +                path: "/sys/devices".to_owned(),
> +                access: "rw",
> +            },
> +            LandlockConfig {
> +                path: "/dev/vfio".to_owned(),
> +                access: "rw",
> +            },
> +        ],
>      })
>  }
>  
> 
> base-commit: 50f8db9cec022a60ea978bfdde0904a18718d161

I don't have much context for this, but the change itself
looks good.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-11-10 18:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 18:49 [PATCH] tools/start-vmm: enable Cloud Hypervisor landlock Alyssa Ross
2025-11-10 18:59 ` Demi Marie Obenour [this message]
2025-11-13 11:16 ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ef68aad-bd4f-4a2b-8c49-090c3002ee46@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).