Skip to content

Commit 3d68e55

Browse files
committed
nodeinstaller: allow ID block related annotations in Kata
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
1 parent 6fd606e commit 3d68e55

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

nodeinstaller/internal/kataconfig/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func KataRuntimeConfig(
4747
imagepullerConfigPath string,
4848
debug bool,
4949
) (*Config, error) {
50+
var customContrastAnnotations []string
5051
var config Config
5152
switch {
5253
case platforms.IsTDX(platform):
@@ -59,6 +60,12 @@ func KataRuntimeConfig(
5960
return nil, fmt.Errorf("failed to unmarshal kata runtime configuration: %w", err)
6061
}
6162

63+
for _, productLine := range []string{"_Milan", "_Genoa"} {
64+
for _, annotationType := range []string{"snp_id_block", "snp_id_auth", "snp_guest_policy"} {
65+
customContrastAnnotations = append(customContrastAnnotations, annotationType+productLine)
66+
}
67+
}
68+
6269
config.Hypervisor["qemu"]["firmware"] = filepath.Join(baseDir, "snp", "share", "OVMF.fd")
6370
// Add SNP ID block to protect against migration attacks.
6471
config.Hypervisor["qemu"]["snp_id_block"] = snpIDBlock.IDBlock
@@ -105,7 +112,7 @@ func KataRuntimeConfig(
105112
config.Hypervisor["qemu"]["enable_debug"] = debug
106113
// Disable all annotations, as we don't support these. Some will mess up measurements,
107114
// others bypass things you can archive via correct resource declaration anyway.
108-
config.Hypervisor["qemu"]["enable_annotations"] = []string{"cc_init_data"}
115+
config.Hypervisor["qemu"]["enable_annotations"] = append(customContrastAnnotations, "cc_init_data")
109116
// Fix and align guest memory calculation.
110117
config.Hypervisor["qemu"]["default_memory"] = platforms.DefaultMemoryInMebiBytes(platform)
111118
config.Runtime["sandbox_cgroup_only"] = true

nodeinstaller/internal/kataconfig/testdata/expected-configuration-qemu-snp-gpu.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ disable_image_nvdimm = true
2020
disable_nesting_checks = true
2121
disable_selinux = false
2222
disable_vhost_net = false
23-
enable_annotations = ['cc_init_data']
23+
enable_annotations = ['snp_id_block_Milan', 'snp_id_auth_Milan', 'snp_guest_policy_Milan', 'snp_id_block_Genoa', 'snp_id_auth_Genoa', 'snp_guest_policy_Genoa', 'cc_init_data']
2424
enable_debug = false
2525
enable_guest_swap = false
2626
enable_hugepages = false

nodeinstaller/internal/kataconfig/testdata/expected-configuration-qemu-snp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ disable_image_nvdimm = true
1919
disable_nesting_checks = true
2020
disable_selinux = false
2121
disable_vhost_net = false
22-
enable_annotations = ['cc_init_data']
22+
enable_annotations = ['snp_id_block_Milan', 'snp_id_auth_Milan', 'snp_guest_policy_Milan', 'snp_id_block_Genoa', 'snp_id_auth_Genoa', 'snp_guest_policy_Genoa', 'cc_init_data']
2323
enable_debug = false
2424
enable_guest_swap = false
2525
enable_hugepages = false

0 commit comments

Comments
 (0)