Created
February 3, 2023 17:55
-
-
Save deeglaze/89b092d8834375540bb34ce244766ab3 to your computer and use it in GitHub Desktop.
go-sev-guest client modification to work around throttling without sev-guest device patches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ func UseDefaultSevGuest() bool { | |
} | |
func message(d Device, command uintptr, req *labi.SnpUserGuestRequest) error { | |
- result, err := d.Ioctl(command, req) | |
- if err != nil { | |
- // The ioctl could have failed with a firmware error that | |
- // indicates a problem certificate length. We need to | |
- // communicate that specifically. | |
- if req.FwErr != 0 { | |
- return &abi.SevFirmwareErr{Status: abi.SevFirmwareStatus(req.FwErr)} | |
+ for { | |
+ result, err := d.Ioctl(command, req) | |
+ if err != nil { | |
+ // The ioctl could have failed with a firmware error that | |
+ // indicates a problem certificate length. We need to | |
+ // communicate that specifically. | |
+ if req.FwErr != 0 { | |
+ if req.FwErr == uint64(abi.GuestRequestThrottled) { | |
+ continue | |
+ } | |
+ return &abi.SevFirmwareErr{Status: abi.SevFirmwareStatus(req.FwErr)} | |
+ } | |
+ return err | |
} | |
- return err | |
- } | |
- if result != uintptr(labi.EsOk) { | |
- return &labi.SevEsErr{Result: labi.EsResult(result)} | |
+ | |
+ if result != uintptr(labi.EsOk) { | |
+ return &labi.SevEsErr{Result: labi.EsResult(result)} | |
+ } | |
+ return nil | |
} | |
- return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment