Skip to content

Commit cbd50ac

Browse files
committed
kernel: Print COCONUT_VERSION on panic
Add the version of COCONUT-SVSM to the panic message for easier debugging. Signed-off-by: Joerg Roedel <[email protected]>
1 parent b37d573 commit cbd50ac

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.github/workflows/rust.yml

+5
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ jobs:
119119
- name: Touch libtcgtpm bindings
120120
run: echo "" > libtcgtpm/src/bindings.rs
121121

122+
# release/src/git_version.rs is auto-generated via a build.rs file. Touch
123+
# it here to avoid CI failures.
124+
- name: Touch release/src/git_version.rs
125+
run: echo "" > release/src/git_version.rs
126+
122127
- name: Format doctests
123128
uses: actions-rs/cargo@v1
124129
with:

kernel/src/stage2.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ use svsm::platform::{
4040
use svsm::types::{PageSize, PAGE_SIZE, PAGE_SIZE_2M};
4141
use svsm::utils::{is_aligned, MemoryRegion};
4242

43+
use release::COCONUT_VERSION;
44+
4345
extern "C" {
4446
static mut pgtable: PageTable;
4547
}
@@ -476,7 +478,8 @@ pub extern "C" fn stage2_main(launch_info: &Stage2LaunchInfo) {
476478

477479
#[panic_handler]
478480
fn panic(info: &PanicInfo<'_>) -> ! {
479-
log::error!("Panic: {}", info);
481+
log::error!("Panic! COCONUT-SVSM Version: {}", COCONUT_VERSION);
482+
log::error!("Info: {}", info);
480483
loop {
481484
platform::halt();
482485
}

kernel/src/svsm.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ use svsm::vtpm::vtpm_init;
5353

5454
use svsm::mm::validate::{init_valid_bitmap_ptr, migrate_valid_bitmap};
5555

56+
use release::COCONUT_VERSION;
57+
5658
use alloc::string::String;
5759

5860
extern "C" {
@@ -354,7 +356,12 @@ fn panic(info: &PanicInfo<'_>) -> ! {
354356
secrets_page_mut().clear_vmpck(2);
355357
secrets_page_mut().clear_vmpck(3);
356358

357-
log::error!("Panic: CPU[{}] {}", this_cpu().get_apic_id(), info);
359+
log::error!(
360+
"Panic on CPU[{}]! COCONUT-SVSM Version: {}",
361+
this_cpu().get_apic_id(),
362+
COCONUT_VERSION
363+
);
364+
log::error!("Info: {}", info);
358365

359366
print_stack(3);
360367

0 commit comments

Comments
 (0)