Skip to content

Commit 2216414

Browse files
authored
[launcher] Trim CCEL padding (#725)
Trimming excessive trailing CCEL padding (0xFF). Signed-off-by: Jiankun Lu <jiankun@google.com>
1 parent d92c8e8 commit 2216414

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

launcher/agent/agent.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,16 @@ func (t *tdxAttestRoot) Attest(nonce []byte) (any, error) {
514514
if err != nil {
515515
return nil, err
516516
}
517+
518+
// CCEL may contain a lot of trailing 0xFF padding bytes, trimming
519+
// them can save bandwidth.
520+
// Normally, the eventlog is ended with "Exit Boot Services Returned
521+
// with Success", So it's safe to just trim all trailing "\xff".
522+
//
523+
// In some rare cases, where the last few bytes are actually "\xff",
524+
// This naive trimming logic may cause the replay to fail.
525+
ccelData = bytes.TrimRight(ccelData, "\xff")
526+
517527
ccelTable, err := os.ReadFile("/sys/firmware/acpi/tables/CCEL")
518528
if err != nil {
519529
return nil, err

0 commit comments

Comments
 (0)