- Open Source News Forums
- > Security issue discovered in TOR client ...
- > Re: The bug is as much a Windows problem
Re: The bug is as much a Windows problem 09 November 2012 14:07
This is not a windows issue - it is a compiler optimisation
memset() is generally implemented (including in gcc) as an inline
function - ie the code/assembler goes straight into where the memset
function called - there is no actual function call where memset
appears. This means that the functionality of the memset operation is
directly visible to the compiler optimiser.
Now consider that when used as a security feature in applications
like TOR, memset is generally used at the end of a function to clean
up used buffers and you have a problem.
The compiler optimiser can see that nothing in the function
references the buffer after the memset() operation and so it makes
the perfectly rational decision of removing the memset() altogether -
it's continued existence and use of CPU cycles contributes nothing to
program correctness as defined by the C/C++ standards.
So no, this is not a case of MS making you use a proprietary
function. It is MS providing a secure buffer clear function that
actually does what you think it ought to when called.
balp wrote on 09 November 2012 07:30
> To make windows faster Microsoft have choosen to make the compilers
> optimice away the only way to clear memory in the C standard and have
> programers use there own version to be safe on windows.
> Tor is using memset(), the standard function in c top set memory. The
> implementations in Visual C thous is unsafe for the usage to clear
> memory. As apperently happen in this case. Thou it maight be a good
> idea if tor like to support windows better to add a work around for
> the buggy OS thet main blame on the security problem have to be on
> the compiler constructor optimizing away standard functionality for
- Threaded View
- Flat View