Re:Git Security Vulnerabilities Announced
by dahfizz on Tuesday January 17, 2023 @04:29PM
(#34419517)
Integer arithmetic is a significant part of ~every program. A single branch that checks the overflow flag is not expensive. But branching on that flag every time you do integer math is death by a billion paper cuts.
[ Parent
| on HN ]
Re:Git Security Vulnerabilities Announced
by CorrectHorseBat on Tuesday January 17, 2023 @04:36PM
(#34419641)
Your could use interrupts, no? Basically free when not triggered and when triggered you probably don't care about performance anymore.
Re:Git Security Vulnerabilities Announced
by prbs23 on Tuesday January 17, 2023 @05:05PM
(#34420076)
Most architectures do not provide an interrupt that is generated by an integer overflow. Since this would be a significant architectural change in the hardware, it can't be simply added in.
Additionally, if you are running inside an operating system, handling an interrupt usually incurs a trip through the kernel, which would add extra overhead every time an overflow did happen. Since there's a lot of software which depends on integers overflowing, this overhead on each overflow could significantly impact legacy software.
Re:Git Security Vulnerabilities Announced
by CorrectHorseBat on Wednesday January 18, 2023 @02:17AM
(#34424224)
Using a new instruction none of that would be an issue. And as someone pointed out, on x86 it wouldn't even be a new instruction, INTO already exists. But apparently it didn't make it in x64 because nobody used it :/
Re:Git Security Vulnerabilities Announced
by gwillen on Tuesday January 17, 2023 @05:06PM
(#34420092)
x86 at one time had a single-byte instruction that would trap if the overflow bit was set, INTO. It doesn't exist in 64-bit mode, I believe, and it was never widely used as far as I know. The performance implications of adding even a single additional instruction to every integer operation were probably still prohibitive? (And there's a history in x86 of specialized clever instructions and mechanisms going unused, due to being slower than doing the same thing some other way.)