Re:Linux kernel heap buffer overflow in fs_context.c since v...
by scoutt on Friday January 21, 2022 @10:08AM
(#30024483)
> you can say “this set of math operations shouldn’t overflow”
This is the same as putting an "if" statement to check for sizes (before or after the operation); the thing that other languages automatically do for you at runtime (with its performance implications).
> The existence of the overflow bits and that overflow continues to remain a common security flaw
What do you propose for a new CPU architecture/instruction set/register types?
How would you implement it? Signed registers?
> how CPU designers imagine you write code.
Write a program in assembler. You'll be checking carry/overflow bits in no-time.
The existence of the overflow bits and that overflow continues to remain a common security flaw indicates that there’s a disconnect between the mental model users have when writing this kind of arithmetic (ie they don’t think about it generally and C integer promotion rules don’t do any favors) and how CPU designers imagine you write code.