That would only get the stack, not the registers. The register save area for a pthread is not accessible to the application; the register save area for a swapcontext operation is accessible.
A less hackish, more portable approach would be to make a new thread to handle the sensitive data and map/unmap the memory for its stack yourself if supported.
-
-
-
When the thread terminates its register file is gone.
-
The whole point of this exercise is that we don't trust the implementation to scrub things for us!
-
For widely varying layers of "the implementation".
-
If you can't trust that user processes can't read physical memory they don't own, your OS is just crap. You can't mitigate this at user app level.
-
OTOH I'm showing a way you can mitigate inability to express in thd HLL (at least C) that certain data & everything derived from it is sensitive and must not be kept around.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.