Himanshu Anand independently found a KVM SEV-SNP heap corruption bug in the Page State Change handler. A guest could request a 24-byte scratch allocation, enough for a header and two entries, while setting end_entry below the protocol maximum of 253. The host checked the count against the largest legal protocol buffer, then walked past the smaller allocation.

Anand’s proposed patch checked the count against the allocation. The four-line upstream fix rejected the allocation itself. GHCB version 2 already requires scratch data to live inside its fixed shared buffer, so an external, guest-sized scratch area was an invalid state. KVM now refuses that state before the request reaches the PSC handler.

I would have reached for the bounds check too. It closes the observed out-of-bounds walk, but leaves every later consumer responsible for handling a buffer the protocol forbids. Before adding another check around hostile input, it is worth asking whether that input shape should cross the boundary at all.

source ↗

← all notes