In PowerPC top, don't delete addi r0, r0, 0
authorGeorge Koehler <xkernigh@netscape.net>
Thu, 26 Jan 2017 17:44:32 +0000 (12:44 -0500)
committerGeorge Koehler <xkernigh@netscape.net>
Thu, 26 Jan 2017 17:44:32 +0000 (12:44 -0500)
commit1dfd5524e4c5691916a27e1fc5d84dd4b20e8c09
tree64ccd9a8771c32c2aa0025e636b3b1f5843cfdf8
parent8c8f291a073e7be90678a2e6584a7c031d6eda23
In PowerPC top, don't delete addi r0, r0, 0

Also don't delete addis r0, r0, 0.  These instructions are special
cases that set r0 to zero.  If we delete them, then r0 keeps its old
value.

I caught this bug because osxppc protects the .text segment against
writing.  (linuxppc doesn't protect it.)  A program tried to set r0 to
the NULL pointer, but top deleted the instruction, so r0 kept an old
return address pointing into .text.  Later the program checked that r0
wasn't NULL, tried to write to address r0, and crashed.
mach/powerpc/top/table