Trapping on overflow
Posted Feb 23, 2008 21:45 UTC (Sat) by anton
In reply to: This code is there not for performance
Parent article: vmsplice(): the making of a local root exploit
But I don't get why no CPU today provides even the option
of trapping on an arithmetic overflow.
MIPS and Alpha have separate arithmetic instructions that trap on
signed overflow (e.g., ADD on MIPS and ADDV on Alpha). IA-32 has INTO
which traps if OF is set. Apparently this instruction was so rarely
used by programmers, that AMD64 removed it in order to free up some
opcode space, and did not even bother to allocate another (multi-byte)
opcode for it; but you can still implement the functionality by
combining JO (or JNO) with INT.
The existence of INTO has not helped against this security hole, though.
to post comments)