mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-24 02:07:31 +00:00
Merge commit from fork
Fix malicious host can circumvent initdata verification on TDX
This commit is contained in:
@@ -30,6 +30,7 @@ use nix::unistd::{self, dup, sync, Pid};
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::{self, File};
|
||||
use std::io::ErrorKind;
|
||||
use std::os::unix::fs::{self as unixfs, FileTypeExt};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::Path;
|
||||
@@ -465,8 +466,17 @@ fn attestation_binaries_available(logger: &Logger, procs: &GuestComponentsProcs)
|
||||
_ => vec![],
|
||||
};
|
||||
for binary in binaries.iter() {
|
||||
if !Path::new(binary).exists() {
|
||||
let exists = Path::new(binary).try_exists().unwrap_or_else(|error| {
|
||||
match error.kind() {
|
||||
ErrorKind::NotFound => {
|
||||
warn!(logger, "{} not found", binary);
|
||||
false
|
||||
},
|
||||
_ => panic!("Path existence check failed for '{}': {}", binary, error)
|
||||
}
|
||||
});
|
||||
|
||||
if !exists {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
veritysetup open "${root_device}" root "${hash_device}" "${rootfs_hash}"
|
||||
veritysetup open --panic-on-corruption "${root_device}" root "${hash_device}" "${rootfs_hash}"
|
||||
mount /dev/mapper/root /mnt
|
||||
else
|
||||
echo "No LUKS device found"
|
||||
|
Reference in New Issue
Block a user