-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistent objects : save informations after close #912
Conversation
When persistent objects are created, a header is written into storage with its sizes. However, if additional data is written into the persistent object, the header is not updated properly This fix adds a new pointer to save a copy of the header in struct tee_pobj when it is opened or created. If additional data is written during TEE_WriteObjectData call, it will re-update the header in storage Signed-off-by: Hoi-Ho Chan <[email protected]>
I think I need to add some error checks at the lseek calls |
@@ -117,6 +117,7 @@ TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, | |||
o->refcnt = 1; | |||
memcpy(&o->uuid, uuid, sizeof(TEE_UUID)); | |||
o->flags = flags; | |||
o->head = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o->head
i s already zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
I fixed all the changes now. What is the appropriate git command to update the pull commit after I amended my local commit? GitHub desktop didn't have the option... |
When persistent objects are created, a header is written into storage with its sizes. However, if additional data is written into the persistent object, the header is not updated properly This fix adds a new pointer to save a copy of the header in struct tee_pobj when it is opened or created. If additional data is written during TEE_WriteObjectData call, it will re-update the header in storage Signed-off-by: Hoi-Ho Chan <[email protected]>
@hoihochan Once all reviewers are satisfied with your changes and have added their
|
goto exit; | ||
} | ||
|
||
if (o->pobj->fops->write(&res, o->fd, head, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coding style seems not as the same as optee here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a template I can follow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just take the code they have already wrote as a template.
try a simplified version. no head malloc.
For security concerns, |
I'm going to close this PR, since a) there is no activity here and b) another fix has been submitted in #1217. |
When persistent objects are created, a header is written
into storage with its sizes. However, if additional data
is written into the persistent object, the header is not
updated properly
This fix adds a new pointer to save a copy of the header
in struct tee_pobj when it is opened or created. If
additional data is written during TEE_WriteObjectData call,
it will re-update the header in storage
Signed-off-by: Hoi-Ho Chan [email protected]