News for hackers. Stuff that matters.
Re:Android libstagefright still exploitable by ploxiln on Thursday August 13, 2015 @02:15PM (#10056149)
Performance. That's an extra branch on every arithmetic operation.
Re:Android libstagefright still exploitable by zurn on Thursday August 13, 2015 @02:32PM (#10056247)
There's a performance cost now because processor instruction sets have dropped hardware overflow detection due to disuse. Current processors are largely engineered to just run legacy C code fast. See eg. https://news.ycombinator.com/item?id=7847980
Re:Android libstagefright still exploitable by acqq on Thursday August 13, 2015 @04:07PM (#10056868)
No, overflow is still properly detected by common CPU instructions. There are flags that are set on overflow after the addition and subtraction and they can be tested.

It's only hard to test the flags in "standard" C (I don't know if it's better with newer standards or those in progress) but the CPUs do their work on the hardware level.

Re:Android libstagefright still exploitable by zurn on Thursday August 13, 2015 @11:28PM (#10058495)
But like ploxiln said you now need a conditional branch to test for the overflow flag after the arithemetic operation, unlike the old overflow traps on x86/MIPS/Alpha etc.
Re:Android libstagefright still exploitable by acqq on Saturday August 15, 2015 @06:24AM (#10064974)
I'm not aware that integer operations ever made traps on x86 and nobody actually uses floats for allocation sizes (in C). And checking the flag would be more than enough IF the languages supported it.

It's the languages that should be changed to be able to simply check the overflow after the critical operations, not the CPUs. The overflow checks are needed only where something can "go wrong" not everywhere.

Re:Android libstagefright still exploitable by johncolanduoni on Thursday August 13, 2015 @02:38PM (#10056289)
I think it is time for this removal to be reexamined, considering popular scripting languages like Python and Ruby (which check for overflows on all integer operations) face significant performance hits because of lack of hardware support for these instructions.
Re:Android libstagefright still exploitable by zurn on Thursday August 13, 2015 @02:47PM (#10056344)
The naive check-and-branch approach on current x86 only costs a couple of percent in integer-heavy and well tuned C code (see http://danluu.com/integer-overflow/). Integer operations in Python and Ruby are so glacially slow compared to C that the overflow checking overhead doesn't register at all due to all the other overhead there.
Re:Android libstagefright still exploitable by barrkel on Thursday August 13, 2015 @02:48PM (#10056352)
That's not how you'd implement it if you had a choice though. You'd rely on a certain page of memory not being mapped on the target platform (the page that starts at address 0 is often a fine choice) and you'd issue a conditional move that touches that address. You'd rely on the CPU exception interrupt mechanism to branch.

I know modern ARM instruction sets don't have conditional instructions like that, but they may have something similar for extremely infrequently triggered control flow. The same kind of trick can be handy in a variety of programming language and GC implementation techniques.