Re: Algoritmic Complexity Attacks and 2.4.20 the dcache code

From: William Lee Irwin III (wli@holomorphy.com)
Date: Sat May 31 2003 - 01:34:04 EST


From: Alex Riesen <alexander.riesen@xxxxxxxxxxxx>
Date: Fri, 30 May 2003 10:59:01 +0200
> static
> int hash_3(int hi, int c)
> {
> return (hi + (c << 4) + (c >> 4)) * 11;
> }
> gcc-3.2.1 -O2 -march=pentium
> ...
> It is not guaranteed to be this way on all architectures, of course.
> But still - no multiplications.

On Fri, May 30, 2003 at 02:00:40AM -0700, David S. Miller wrote:
> Indeed, I'd missed this. GCC will emit the constant multiply
> expansion unless the multiply cost is set VERY low.

If the strength reduction situation changes to being properly handled
by gcc for most/all 64-bit arches, include/linux/hash.h can lose a #ifdef.


-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/