Skip to content

Commit 4fea4f9

Browse files
sgramsjyao1
authored andcommitted
fix(servtd_ext): remove broken init_attr == curr_attr check
The verify_servtd_attr and read_servtd_ext functions compared CURR_SERVTD_ATTR against INIT_ATTR read from the target TD. This check is invalid because INIT_ATTR is only populated when the rebind feature is supported, while the initial binding does not set it. Remove the redundant INIT_ATTR comparison and keep only the hardcoded EXPECTED_SERVTD_ATTR verification which ensures the VMM wrote the correct value. Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
1 parent 2639b27 commit 4fea4f9

1 file changed

Lines changed: 4 additions & 22 deletions

File tree

src/migtd/src/migration/servtd_ext.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,14 @@ pub fn read_servtd_ext(
123123
read_field(TDCS_FIELD_SERVTD_INFO_HASH, 8, &mut cur_servtd_info_hash)?;
124124
read_field(TDCS_FIELD_SERVTD_ATTR, 8, &mut cur_servtd_attr)?;
125125

126-
// Verify CURR_SERVTD_ATTR matches both the hardcoded expected value and the
127-
// INIT_ATTR from MigTDData's TDINFO per GHCI 1.5.
126+
// Verify CURR_SERVTD_ATTR matches the hardcoded expected value.
128127
let actual_attr = u64::from_le_bytes(cur_servtd_attr);
129-
let expected_init_attr = u64::from_le_bytes(init_attr);
130128
if actual_attr != EXPECTED_SERVTD_ATTR {
131129
log::error!(
132130
"SERVTD_ATTR mismatch vs hardcoded: expected {EXPECTED_SERVTD_ATTR:#x}, got {actual_attr:#x}"
133131
);
134132
return Err(MigrationResult::InvalidParameter);
135133
}
136-
if actual_attr != expected_init_attr {
137-
log::error!(
138-
"SERVTD_ATTR mismatch vs INIT_ATTR: expected {expected_init_attr:#x}, got {actual_attr:#x}"
139-
);
140-
return Err(MigrationResult::InvalidParameter);
141-
}
142134

143135
Ok(ServtdExt {
144136
init_servtd_info_hash,
@@ -154,8 +146,8 @@ pub fn read_servtd_ext(
154146
})
155147
}
156148

157-
/// Verify that CURR_SERVTD_ATTR of the target TD matches both the hardcoded
158-
/// expected value and the INIT_ATTR from MigTDData's TDINFO.
149+
/// Verify that CURR_SERVTD_ATTR of the target TD (VMM input) matches the
150+
/// hardcoded expected value (MigTD internal).
159151
///
160152
/// Per GHCI 1.5: Both source and destination MigTDs must verify this before
161153
/// any TDG.SERVTD.WR operations (mig_dec_key, mig_version).
@@ -167,17 +159,7 @@ pub fn verify_servtd_attr(
167159
let actual_attr = result.content;
168160
if actual_attr != EXPECTED_SERVTD_ATTR {
169161
log::error!(
170-
"SERVTD_ATTR mismatch vs hardcoded: expected {EXPECTED_SERVTD_ATTR:#x}, got {actual_attr:#x}"
171-
);
172-
return Err(MigrationResult::InvalidParameter);
173-
}
174-
175-
let init_result =
176-
tdcall_servtd_rd(binding_handle, TDCS_FIELD_SERVTD_INIT_ATTR, target_td_uuid)?;
177-
let expected_init_attr = init_result.content;
178-
if actual_attr != expected_init_attr {
179-
log::error!(
180-
"SERVTD_ATTR mismatch vs INIT_ATTR: expected {expected_init_attr:#x}, got {actual_attr:#x}"
162+
"SERVTD_ATTR mismatch: VMM wrote {actual_attr:#x}, MigTD expects {EXPECTED_SERVTD_ATTR:#x}"
181163
);
182164
return Err(MigrationResult::InvalidParameter);
183165
}

0 commit comments

Comments
 (0)