Improved check of hermit-entry version to handle files without a note section. Fixes
@@ -359,7 +359,8 @@ pub trait Vm {
return Err(LoadKernelError::Io(io::ErrorKind::InvalidData.into()));
}
- if let Some(note) = elf.iter_note_headers(&buffer).unwrap().find(|note| {
+ if let Some(mut note_headers) = elf.iter_note_headers(&buffer) {
+ if let Some(note) = note_headers.find(|note| {
note.as_ref().unwrap().name == "HERMIT"
&& note.as_ref().unwrap().n_type == hermit_entry::NT_HERMIT_ENTRY_VERSION
}) {
@@ -370,7 +371,10 @@ pub trait Vm {
return Err(LoadKernelError::Io(io::ErrorKind::InvalidData.into()));
}
} else {
- error!("Kernel does not specify hermit entry version!");
+ error!("Kernel does not specify hermit entry version! - This might lead to undefined behaviour and will be deprecated in the future.");
+ }
+ } else {
+ error!("Kernel elf does not contain notes section to specify hermit entry version! - This might lead to undefined behaviour and will be deprecated in the future.");
}
// acquire the slices of the user memory
