diff --git a/docs/tutorials/vmm-configuration.md b/docs/tutorials/vmm-configuration.md index 07e06426a..8d6e3b320 100644 --- a/docs/tutorials/vmm-configuration.md +++ b/docs/tutorials/vmm-configuration.md @@ -97,6 +97,7 @@ address = "127.0.0.1:9080" reuse = true kms_url = "http://127.0.0.1:8081" event_buffer_size = 20 +max_event_name_len = 128 node_name = "" image_path = "/var/lib/dstack/images" diff --git a/dstack/vmm/src/app.rs b/dstack/vmm/src/app.rs index df3e99281..e32d95748 100644 --- a/dstack/vmm/src/app.rs +++ b/dstack/vmm/src/app.rs @@ -1507,6 +1507,10 @@ impl App { } pub(crate) fn vm_event_report(&self, cid: u32, event: &str, body: String) -> Result<()> { + if event.len() > self.config.max_event_name_len { + error!(cid, "event name too large, skipping"); + return Ok(()); + } info!(cid, event, "VM event"); if body.len() > 1024 * 4 { error!("Event body too large, skipping"); diff --git a/dstack/vmm/src/config.rs b/dstack/vmm/src/config.rs index 0d3d40a3e..61658edf7 100644 --- a/dstack/vmm/src/config.rs +++ b/dstack/vmm/src/config.rs @@ -658,6 +658,9 @@ pub struct Config { /// The buffer size in VMM process for guest events pub event_buffer_size: usize, + /// Maximum length in bytes of a guest-reported event name + pub max_event_name_len: usize, + /// CVM configuration pub cvm: CvmConfig, diff --git a/dstack/vmm/vmm.toml b/dstack/vmm/vmm.toml index 1cf52e0c0..663d424bc 100644 --- a/dstack/vmm/vmm.toml +++ b/dstack/vmm/vmm.toml @@ -12,6 +12,7 @@ address = "unix:./vmm.sock" reuse = true kms_url = "http://127.0.0.1:8081" event_buffer_size = 20 +max_event_name_len = 128 node_name = "" [image]