Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/migtd/src/migration/rebinding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub use tdx_tdcall::tdx::TargetTdUuid;
pub const TDCS_FIELD_SERVTD_REBIND_ACCEPT_TOKEN: u64 = 0x191000030000021E;
/// The intended SERVTD_ATTR for the Service TD about to be bound to the TD.
pub const TDCS_FIELD_SERVTD_REBIND_ATTR: u64 = 0x1910000300000222;
const TDCS_FIELD_WRITE_MASK: u64 = u64::MAX;

const TLS_TIMEOUT: Duration = Duration::from_secs(60); // 60 seconds
// FIXME: Need VMM provide socket information
Expand Down Expand Up @@ -698,7 +699,11 @@ pub fn write_rebinding_session_token(rebind_token: &[u8]) -> Result<(), Migratio

for (idx, chunk) in rebind_token.chunks_exact(size_of::<u64>()).enumerate() {
let elem = u64::from_le_bytes(chunk.try_into().unwrap());
tdcall_vm_write(TDCS_FIELD_SERVTD_REBIND_ACCEPT_TOKEN + idx as u64, elem, 0)?;
tdcall_vm_write(
TDCS_FIELD_SERVTD_REBIND_ACCEPT_TOKEN + idx as u64,
elem,
TDCS_FIELD_WRITE_MASK,
)?;
}

Ok(())
Expand All @@ -710,7 +715,7 @@ pub fn write_servtd_rebind_attr(servtd_attr: &[u8]) -> Result<(), MigrationResul
}

let elem = u64::from_le_bytes(servtd_attr.try_into().unwrap());
tdcall_vm_write(TDCS_FIELD_SERVTD_REBIND_ATTR, elem, 0)?;
tdcall_vm_write(TDCS_FIELD_SERVTD_REBIND_ATTR, elem, TDCS_FIELD_WRITE_MASK)?;

Ok(())
}
Expand Down
3 changes: 2 additions & 1 deletion src/migtd/src/migration/servtd_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/// Hash of SERVTD_EXT that the new Service TD 0 (i.e., rebound Service TD or MigTD on the
/// destination platform) believes is the SERVTD_EXT for this TD.
pub const TDCS_FIELD_SERVTD_ACCEPT_SERVTD_EXT_HASH: u64 = 0x1910000300000214;
const TDCS_FIELD_WRITE_MASK: u64 = u64::MAX;

#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -133,7 +134,7 @@
tdcall_vm_write(
TDCS_FIELD_SERVTD_ACCEPT_SERVTD_EXT_HASH + idx as u64,
elem,
0,
TDCS_FIELD_WRITE_MASK,
)?;
}

Expand All @@ -141,7 +142,7 @@
}

mod test {
use super::ServtdExt;

Check warning on line 145 in src/migtd/src/migration/servtd_ext.rs

View workflow job for this annotation

GitHub Actions / Format

unused import: `super::ServtdExt`

#[test]
fn test_structure_sizes() {
Expand Down
Loading