+++ This bug was initially created as a clone of Bug #213767 +++
gcc 4.3.x does not generate a cld instruction while compiling functions used
for string manipulation such as memcpy and memmove on x86 and i386, which can
prevent the direction flag (DF) from being reset in violation of ABI
conventions and cause data to be copied in the wrong direction during signal
handling in the Linux kernel, which might allow context-dependent attackers
to trigger memory corruption. NOTE: this issue was originally reported for
CPU consumption in SBCL.
------- Comment #2 From Christian Hoffmann 2008-03-18 10:44:58 0000 -------
According to a mailing list discussion  this is not a gcc bug, but a
behavior change which perfectly matches the specifications. The problem is,
that the Linux kernel (others too) did not match these specs...
A patch to the kernel was already proposed  and committed  ten days ago,
so now the question is, whether patching gcc is wanted or whether gcc-4.3
should simply require fixed kernels.
CC'ing kernel herd for this reason.
From my understanding of this, gcc 4.2 and 2.6.24 is perfectly fine. It's gcc 4.3 and < 2.6.25.
And, gcc 4.3 and 2.6.25 is now fixed. Am I correct in saying this?
(In reply to comment #1)
> From my understanding of this, gcc 4.2 and 2.6.24 is perfectly fine. It's gcc
> 4.3 and < 2.6.25.
> And, gcc 4.3 and 2.6.25 is now fixed. Am I correct in saying this?
The issue was addressed in the upcoming .25, but the workaround has not been introduced into our GCC.
So we have to make sure the setups we support are safe (i.e. ~arch gcc 4.3 should come with ~arch linux 2.6.25). I'm not sure how far mixing ~arch and arch is supported (i.e. ~arch gcc 4.3 and arch linux <=2.6.24), but if the patch can be pulled down into the next .24 patchset, I'd rather have it in there before gcc 4.3 goes ~arch.
This commit has been backported to the 2.6.24 stable tree and is included in 220.127.116.11 which is currently in the gentoo-sources patchset.
This patch will be in the next release of gentoo-sources.