This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch RFC] SH: -fstack-protector support
- From: Joern RENNECKE <joern dot rennecke at st dot com>
- To: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- Cc: gcc-patches at gcc dot gnu dot org, aoliva at redhat dot com
- Date: Wed, 20 Jul 2005 14:15:18 +0100
- Subject: Re: [patch RFC] SH: -fstack-protector support
- References: <20050720.141152.02306452.kkojima@rr.iij4u.or.jp> <42DE498A.8060108@st.com>
Joern Rennecke wrote:
The SHmedia test patterns can be improved by useing a sub or xor
operation instead
of the compare and zeroing, and inverting the branch. If the
comparison suceeds, nothing
is leaked. If it fails, not the value, but only the difference is
leaked, so that's OK with the
letter of the description; it is also OK with the spirit of the
description because the
miscompare already indicates a stack smash, so control is tranferred
to the stack_protect_fail
code, and the difference won't leak to an attacker.
P.S.:
Sorry, my I got a thinko there. Since the SH is a load-store
architecture, there are two registers
to overwrite, and the cmpeq already overwrites one of them.