Skip to content

Commit 426b027

Browse files
committed
fix: Allow jailer to continue with partial CPU cache info
If CPU caching information is missing, this change allows the jailer to still continue, and fall through to the validation logic in firecracker. Signed-off-by: Gudmundur Bjarni Olafsson <[email protected]>
1 parent b4cb9d3 commit 426b027

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/jailer/src/env.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,20 @@ impl Env {
575575
let host_cache_file = host_path.join(entry);
576576
let jailer_cache_file = jailer_path.join(entry);
577577

578-
let line = readln_special(&host_cache_file)?;
579-
writeln_special(&jailer_cache_file, line)?;
580-
581-
// We now change the permissions.
582-
let dest_path_cstr = to_cstring(&jailer_cache_file)?;
583-
// SAFETY: Safe because dest_path_cstr is null-terminated.
584-
SyscallReturnCode(unsafe {
585-
libc::chown(dest_path_cstr.as_ptr(), self.uid(), self.gid())
586-
})
587-
.into_empty_result()
588-
.map_err(|err| JailerError::ChangeFileOwner(jailer_cache_file.to_owned(), err))?;
578+
if let Ok(line) = readln_special(&host_cache_file) {
579+
writeln_special(&jailer_cache_file, line)?;
580+
581+
// We now change the permissions.
582+
let dest_path_cstr = to_cstring(&jailer_cache_file)?;
583+
// SAFETY: Safe because dest_path_cstr is null-terminated.
584+
SyscallReturnCode(unsafe {
585+
libc::chown(dest_path_cstr.as_ptr(), self.uid(), self.gid())
586+
})
587+
.into_empty_result()
588+
.map_err(|err| {
589+
JailerError::ChangeFileOwner(jailer_cache_file.to_owned(), err)
590+
})?;
591+
}
589592
}
590593
}
591594
Ok(())

0 commit comments

Comments
 (0)