3 ms·
Theoretically? Nothing at all. You could have a compiler which produces code which revs the CPU in such a way to output the complete works of Shakespeare in M
by cperciva 13y ago
Theoretically? Nothing at all. You could have a compiler which produces code which revs the CPU in such a way to output the complete works of Shakespeare in Morse code via the fluctuations in your laptop's fan speed, and it would be perfectly standard-compliant.
Worse than that, there's things compilers actually do in practice, like optimizing away
memset(sensitivedate, 0, sizeof(sensitivedata))
and you can't even protect yourself against that properly by using a (volatile *) cast since the compiler is perfectly within its rights to make extra copies of that data and even without optimization the memset will only zero one of the copies. (gcc in particular loves to copy data onto the stack, due to a broken register allocator.)
I've been trying to convince some clang developers that we need to have a C language extension for "we're handling sensitive data here, don't optimize it in dangerous ways", but it's difficult to define exactly what optimizations could be problematic...