Repository navigation
tpm2: Only update NV index entry size on success in USER_NVRAM_Unmarshal - #643
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
| for expanding nvi. The value read from the state blob is | ||
| not authoritative, and a zero-datasize index would | ||
| otherwise keep the unvalidated blob value as the entry's | ||
| forward pointer, which desynchronizes the NV_USER_DYNAMIC |
There was a problem hiding this comment.
Thanks for doing this. However, I suppose it's still true that if rc != TPM_RC_SUCCESS, we will leave the function without looking at entrysize again. So it doesn't matter whether it was changed in the failure case before your patch. However, it's probably better to leave it at is old value (in failure case).
There was a problem hiding this comment.
-> I think you should describe this patch as a clean-up.
There was a problem hiding this comment.
makes sense. reworded the commit and the PR description as a clean-up, and put the original comment back so the diff is just moving the update out of the datasize > 0 branch. the rc == TPM_RC_SUCCESS guard stays, so entrysize keeps its old value on failure.
There was a problem hiding this comment.
I think the title of the patch is not correct. It should be more like 'Do not always update...' or 'Only update ... on success'
There was a problem hiding this comment.
fair, retitled it to 'tpm2: Only update NV index entry size on success in USER_NVRAM_Unmarshal' and updated the PR title to match. the code is unchanged.
1090aca to
b04f394
Compare
Clean-up: USER_NVRAM_Unmarshal() updates the entrysize of a TPM_HT_NV_INDEX entry to sizeof(UINT32) + sizeof(nvi) + datasize only inside the 'datasize > 0' branch, so an index without data keeps the entrysize value read from the state. Move the update out of that branch so it is done for every successfully unmarshalled NV index, the same way the TPM_HT_PERSISTENT branch already does it. In the failure case entrysize is left at its old value. Signed-off-by: sameera <sameera@research.itecz.au>
b04f394 to
45cc88e
Compare
|
Thanks! |
Clean-up:
USER_NVRAM_Unmarshal()updates the entrysize of aTPM_HT_NV_INDEXentry tosizeof(UINT32) + sizeof(nvi) + datasizeonly inside thedatasize > 0branch, so an index without data keeps the entrysize value read from the state. This moves the update out of that branch so it's done for every successfully unmarshalled NV index, the same way theTPM_HT_PERSISTENTbranch already does it. In the failure case entrysize is left at its old value.Summary by CodeRabbit