]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Fix niagara memory corruption
authorDavid Miller <davem@davemloft.net>
Mon, 19 Mar 2007 21:50:04 +0000 (14:50 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 23 Mar 2007 19:49:27 +0000 (12:49 -0700)
[SPARC64]: store-init needs trailing membar.

The manual says that it is required and we actually have crash reports
where loads see stale data due to not having membars here.

In one case the networking does:

memset(skb, 0, offsetof(struct sk_buff, truesize));

and then some code later checks skb->nohdr for zero, but it's still
the value that was there before the memset().

Note that arch/sparc64/lib/xor.S already got this right.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/sparc64/kernel/tsb.S
arch/sparc64/lib/NGbzero.S
arch/sparc64/lib/NGmemcpy.S
arch/sparc64/lib/NGpage.S

index eedf94fa5664075b3443bf8b990094294de9bee8..10adb2fb8ffe1f80fd67fe6bc832bf93446bbfa5 100644 (file)
@@ -546,6 +546,7 @@ NGtsb_init:
        subcc           %o1, 0x100, %o1
        bne,pt          %xcc, 1b
         add            %o0, 0x100, %o0
+       membar          #Sync
        retl
         wr             %g2, 0x0, %asi
        .size           NGtsb_init, .-NGtsb_init
index e86baece5cc86ebd9f0b77dc3c9dd7165b9c981f..f10e4529ee3743b770730de61d03c02ad08aa961 100644 (file)
@@ -88,6 +88,7 @@ NGbzero_loop:
        bne,pt          %xcc, NGbzero_loop
         add            %o0, 64, %o0
 
+       membar          #Sync
        wr              %o4, 0x0, %asi
        brz,pn          %o1, NGbzero_done
 NGbzero_medium:
index 8e522b3dc095e2100760c87425488de66ecbfad7..66063a9a66b87146524809d2fcd932e7107bda08 100644 (file)
@@ -247,6 +247,8 @@ FUNC_NAME:  /* %o0=dst, %o1=src, %o2=len */
        /* fall through */
 
 60:    
+       membar          #Sync
+
        /* %o2 contains any final bytes still needed to be copied
         * over. If anything is left, we copy it one byte at a time.
         */
index 7d7c3bb8dcbfe0e2d87af5e815d3fcf7d9b184e4..8ce3a0c9c537ed4ac862afda0cca7f41ed4c0b98 100644 (file)
@@ -41,6 +41,7 @@ NGcopy_user_page:     /* %o0=dest, %o1=src, %o2=vaddr */
        subcc           %g7, 64, %g7
        bne,pt          %xcc, 1b
         add            %o0, 32, %o0
+       membar          #Sync
        retl
         nop
 
@@ -63,6 +64,7 @@ NGclear_user_page:    /* %o0=dest, %o1=vaddr */
        subcc           %g7, 64, %g7
        bne,pt          %xcc, 1b
         add            %o0, 32, %o0
+       membar          #Sync
        retl
         nop