]> git.baikalelectronics.ru Git - kernel.git/commit
sh: fix miscompilation of ip_fast_csum with gcc >= 4.3
authorPaul Mundt <lethal@linux-sh.org>
Mon, 2 Jun 2008 03:40:14 +0000 (12:40 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 2 Jun 2008 03:40:14 +0000 (12:40 +0900)
commit12c88ec29c4e58928a27d4c228a043d9e286c563
tree43397ccc80fa0ac3353f7313251bd6be851421c5
parent56f2e2ad2349582071b3d4e13cb724591d5ce42b
sh: fix miscompilation of ip_fast_csum with gcc >= 4.3

As noted by Matthew Wilcox:

    Kyle McMartin just tracked down a bug on parisc to a missing
    "memory" clobber in the inline assembly implementation of
    ip_fast_csum.  The FRV, SH and Xtensa ports are also missing a
    memory clobber, so I thought it would be polite to let you know.

    The bug manifests as dropped network packets (obviously they have
    the wrong checksum).  It started appearing for parisc with GCC 4.3.

    The GCC manual says:

     If your assembler instructions access memory in an unpredictable
     fashion, add `memory' to the list of clobbered registers.  This
     will cause GCC to not keep memory values cached in registers
     across the assembler instruction and not optimize stores or loads
     to that memory.

    I see that FRV has a 400 byte memory output which may prevent this
    problem from appearing, but SH and Xtensa have nothing to prevent
    this bug.  Hope this saves you a few days of debugging.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
include/asm-sh/checksum_32.h