Skip to content
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

CFE_ES_DeleteCDS: zero out block when freed #1340

Closed
skliper opened this issue Apr 13, 2021 · 5 comments · Fixed by #1384 or #1431
Closed

CFE_ES_DeleteCDS: zero out block when freed #1340

skliper opened this issue Apr 13, 2021 · 5 comments · Fixed by #1384 or #1431
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Apr 13, 2021

Is your feature request related to a problem? Please describe.
Block not cleared when freed:

Status = CFE_ES_GenPoolPutBlock(&CDS->Pool, &OldBlockSize, RegRecPtr->BlockOffset);

Describe the solution you'd like
Analyze, clear block if needed or document for future reference why it's not needed

Describe alternatives you've considered
None

Additional context
Code review

Requester Info
Jacob Hageman - NASA/GSFC

@jphickey
Copy link
Contributor

Similar to #1337, there are good reasons to avoid excessive writing to CDS, and the code has historically not done this. My recommendation would be to not forcibly clear it.

However I did submit #1377 as a suggestion to make this check stronger, possibly an enhancement for future version

@skliper
Copy link
Contributor Author

skliper commented Apr 19, 2021

Agreed. Behavior (not cleared) just needs to be clear in the documentation.

@jphickey
Copy link
Contributor

Honestly I'm not even sure how to document this. Code should never use a block after deleting it, and there is never an assumption (or should never be an assumption) that memory will be cleared as part of a delete/free operation. It's a case where actually saying this might be more confusing than saying nothing at all.... because by definition the memory block is deleted ... it doesn't logically exist anymore, how can we document what the contents of something that doesn't exist are?

@skliper
Copy link
Contributor Author

skliper commented Apr 19, 2021

Maybe just detail the fact the CDS entry gets deleted from the registry without modification to the actual memory block in the CDS (or whatever language is appropriate). This is helpful info for users that need to track write cycles. I don't see it as a case of code using the block after delete, it's detailing what the "delete" does which can be important to managing the hardware.

jphickey added a commit to jphickey/cFE that referenced this issue Apr 19, 2021
Noted that this does not actually wipe or erase the block, it only
returns resources to the pool for re-use.
@jphickey
Copy link
Contributor

Yeah, that can be done. I was thinking along the lines of "document what is in the memory buffer after a call to free()" which just didn't make sense. But this is more akin to deleting a file on disk, and to note that the underlying storage (physical sectors) are not actually wiped of the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants