2 ms·
x86 has the BOUND instruction that checks an index against a lower and upper bound and raises an exception on failure. It has been a very slow microcoded instru
by gpderetta 10y ago
x86 has the BOUND instruction that checks an index against a lower and upper bound and raises an exception on failure. It has been a very slow microcoded instruction for a long time,thus practically unused (which lead to a catch-22 as intel never saw fit to improve it). IIRC it was removed in AMD64.
- pjmlp 10y agoYes, but now C exploits are so widespread that they created the MPX instructions. The problem being not everyone can use them, of course. Also to give another example, SPARC V9 has something similar. However even if processor support was widespread, it requires willingness to turn on those compiler switches. Which is something that goes against the culture in the C community of performance at all costs.
- gpderetta 10y agoSure, I wasn't making any judgement on its utility. BOUND would have been great for compiling any language with built-in bound checking (I wouldn't be surprised if it was made with pascal in mind, same ENTER with nesting level > 1). MPX was specifically designed for the C family languages, but it has a fairly high cost, we will have to see whether it gets widespread. Re culture, aren't there quite a bit of high profile projects that are compiled with hardening by default ? At least firefox comes to mind.
- pjmlp 10y agoYes, but Mozilla cares enough about security that they created Rust. Also although C++ shares the same flaws as C, due to the compatibility, the overall culture is a bit different. There are the C expats that basically use it as C with Classes, and there there are the Ada/Pascal/ML expats that take advantage of the type system and standard library to write safer code. The problem with security is that most projects tend to have a mix of those cultures, and also there is no control over 3rd party binary libraries.