Skip to content

Commit

Permalink
igvmbuilder: set VTL2 protection flag where required
Browse files Browse the repository at this point in the history
The VSM flavor of the IGVM file must specify the "VTL2 protectable" flag
on the kernel memory region in order to execute correctly when running
in VTL 2.

Signed-off-by: Jon Lange <[email protected]>
  • Loading branch information
msft-jlange committed Dec 16, 2024
1 parent 8b5bc8a commit 744d38f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions igvmbuilder/src/igvm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,23 @@ impl IgvmBuilder {
}

// Describe the kernel RAM region
self.directives.push(IgvmDirectiveHeader::RequiredMemory {
gpa: param_block.kernel_base,
compatibility_mask: COMPATIBILITY_MASK.get(),
number_of_bytes: param_block.kernel_size,
vtl2_protectable: false,
});
if COMPATIBILITY_MASK.contains(!VSM_COMPATIBILITY_MASK) {
self.directives.push(IgvmDirectiveHeader::RequiredMemory {
gpa: param_block.kernel_base,
compatibility_mask: COMPATIBILITY_MASK.get() & !VSM_COMPATIBILITY_MASK,
number_of_bytes: param_block.kernel_size,
vtl2_protectable: false,
});
}

if COMPATIBILITY_MASK.contains(VSM_COMPATIBILITY_MASK) {
self.directives.push(IgvmDirectiveHeader::RequiredMemory {
gpa: param_block.kernel_base,
compatibility_mask: VSM_COMPATIBILITY_MASK,
number_of_bytes: param_block.kernel_size,
vtl2_protectable: true,
});
}

// Create the two parameter areas for memory map and general parameters.
self.directives.push(IgvmDirectiveHeader::ParameterArea {
Expand Down

0 comments on commit 744d38f

Please sign in to comment.