News for hackers. Stuff that matters.
Re:Clang vs. Clang by dataflow on Sunday August 04, 2024 @02:15AM (#41151451)
> Isn't this unreasonable? Here we are, 52, years down the road with C et al. and suddenly it's expected that compiler developers must consider any change in the light of timing attacks?

We already went through a similar case to this: when the C++11 multithreaded memory model was introduced, compiler authors were henceforth forced to consider all future optimizations in light of multithreading. Which actually forced them to go back and suppress some optimizations that otherwise appeared reasonable.

This isn't to say the idea is good (or bad), but just that "compiler development will grind to a halt" is not a convincing against it.

Re:Clang vs. Clang by quietbritishjim on Sunday August 04, 2024 @04:17AM (#41151925)
The difference is that threads have enormously wider applicability than timing preservation does.
Re:Clang vs. Clang by dataflow on Monday August 05, 2024 @05:55PM (#41165984)
That is orthogonal to whether compiler development would grind to a halt though, was my point.
Re:Clang vs. Clang by uecker on Sunday August 04, 2024 @04:05AM (#41151874)
It is completely unreasonable though to assume that a compiler should now preserve some assumed (!) timing of source operations.

It would be reasonable to implement (and later standardize) a pragma or something that specifies timings constraint for a subset of the language. But somebody would need to do the work.

Re:Clang vs. Clang by mst on Sunday August 04, 2024 @06:41AM (#41152583)
An attribute for functions that says "no optimisations may be applied to the body that would change timings" seems like a reasonable level of granularity here, and if you were conservative about which optimisations it allowed in version zero it'd probably not be a vast amount of work.

I'm sort of reminded of the software people vs. hardware people stuff in embedded work, where ideally you'd have people around who'd crossed over from one to another but (comparing to crypto authors and compiler authors) there's enough of a cultural disconnect between the two groups that it doesn't happen as often as one might prefer.

Re:Clang vs. Clang by saalweachter on Sunday August 04, 2024 @09:02AM (#41153249)
Why not just specify "all branches of this code must execute in the same amount of time", and let the compiler figure it out for the architecture being compiled for?
Re:Clang vs. Clang by davrosthedalek on Sunday August 04, 2024 @10:56AM (#41153943)
Instruction duration isn't constant even within the same arch. You cannot have branches in constant-time code.

I do wonder though how often cpu instructions have data-dependent execution times....

Re:Clang vs. Clang by davrosthedalek on Sunday August 04, 2024 @05:57PM (#41156600)
(Correction: You cannot have data-dependent branches. You can of course have branches to make a fixed-iterations for loop, for example)