MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validate_linux_elf_binary

Function validate_linux_elf_binary

crates/openshell-driver-docker/src/lib.rs:3407–3428  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

3405}
3406
3407pub(crate) fn validate_linux_elf_binary(path: &Path) -> CoreResult<()> {
3408 let mut file = std::fs::File::open(path).map_err(|err| {
3409 Error::config(format!(
3410 "failed to open docker supervisor binary '{}': {err}",
3411 path.display()
3412 ))
3413 })?;
3414 let mut magic = [0_u8; 4];
3415 file.read_exact(&mut magic).map_err(|err| {
3416 Error::config(format!(
3417 "failed to read docker supervisor binary '{}': {err}",
3418 path.display()
3419 ))
3420 })?;
3421 if magic != [0x7f, b'E', b'L', b'F'] {
3422 return Err(Error::config(format!(
3423 "docker supervisor binary '{}' must be a Linux ELF executable",
3424 path.display()
3425 )));
3426 }
3427 Ok(())
3428}
3429
3430fn docker_guest_tls_configured(docker_config: &DockerComputeConfig) -> bool {
3431 docker_config.guest_tls_ca.is_some()

Calls 1

configFunction · 0.85