Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C's pointers wouldn't be an issue if the world had used the Intel iAPX 432 processor instead of the 8086. The iAPX 432 included bounds checking for every array in hardware (among many other features), so it was impossible to make an out-of-bounds access.

Unfortunately the iPAX 432 was delayed, so Intel introduced the 8086 as a stopgap processor and computers have been using the x86 architecture ever since. It's interesting to think that if history had gone a bit differently, whole classes of security problems would not exist.

https://en.wikipedia.org/wiki/Intel_iAPX_432



> so it was impossible to make an out-of-bounds access.

That's a strong claim for something as vaguely defined as "the length of an array."

What if I allocate a huge array of memory and emulate another processor using that memory? What if I subpartition an array? What if I overallocate an array to avoid reallocations?


C-the-language has no concept of size-tagged arrays at runtime, and I guess it's baked in deeply due to the various guarantees made about sizeof(array), &array[0], and ability to cast &array[0] back to the original array. The iAPX hardware would have gone unused


Solaris uses SPARC ADI to great success, iPhone X has pointer validation, and Android 11 has made the work to require ARM MTE in future releases.


Pointer tagging is a completely different tech that requires no runtime knowledge of the length of an array


x86 has MPX. It provides 4 registers, BND0-3, that can be used for hardware bounds checking. Unfortunately, no one seems to have adopted it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: