x86 build issue with software suspend code

From: Jan Beulich (JBeulich_at_novell.com)
Date: 08/26/04

  • Next message: Rik van Riel: "Re: silent semantic changes with reiser4"
    Date:	Thu, 26 Aug 2004 16:12:00 +0200
    To: <linux-kernel@vger.kernel.org>
    
    
    

    A piece of code most like "copy-and-paste"d from x86_64 to i386 caused
    the section named .data.nosave in arch/i386/power/swsusp.S to become
    named .data.nosave.1 in arch/i386/power/built-in.o (due to an attribute
    collision with an identically named section from arch/i386/power/cpu.c),
    which finally ends up in no-where land (because it doesn't have even the
    alloc bit set, and the linker script doesn't know about such a section
    either), resulting in the two variables being accessed at (absolute)
    addresses 0 and 8 (which shouldn't normally be accessible at all, but
    perhaps are mapped for whatever reason at the point execution gets
    there, since otherwise problems with this code path should have been
    observed much earlier).

    The below (also attached for the inline variant most certainly getting
    incorrectly line wrapped) patch changes the attributes of the section to
    match those of other instances of the section, so the renaming doesn't
    happen anymore. It also adds alignment, decreases the fields from 8 to 4
    bytes and applies these additional changes also to the appearant
    original x86_64 code.

    I'm slightly worried by the fact that ld lets both the attribute
    collision and the relocation from and alloc section targeting targeting
    a non-alloc one completely uncommented; I didn't check its code yet, so
    I don't know whether perhaps some diagnostics could simply be turned on
    for both of these.

    Jan

    diff -Napru linux-2.6.8.1/arch/i386/power/swsusp.S
    2.6.8.1/arch/i386/power/swsusp.S
    --- linux-2.6.8.1/arch/i386/power/swsusp.S 2004-08-14
    12:55:19.000000000 +0200
    +++ 2.6.8.1/arch/i386/power/swsusp.S 2004-08-26 15:54:35.420154440
    +0200
    @@ -89,9 +89,10 @@ copy_done:
             popl %ebx
             ret
     
    - .section .data.nosave
    + .section .data.nosave, "aw"
    + .align 4
     loop:
    - .quad 0
    + .long 0
     loop2:
    - .quad 0
    + .long 0
            .previous
    diff -Napru linux-2.6.8.1/arch/x86_64/kernel/suspend_asm.S
    2.6.8.1/arch/x86_64/kernel/suspend_asm.S
    --- linux-2.6.8.1/arch/x86_64/kernel/suspend_asm.S 2004-08-14
    12:56:22.000000000 +0200
    +++ 2.6.8.1/arch/x86_64/kernel/suspend_asm.S 2004-08-26
    15:54:56.446957880 +0200
    @@ -117,7 +117,8 @@ ENTRY(do_magic)
             addq $8, %rsp
             jmp do_magic_resume_2
     
    - .section .data.nosave
    + .section .data.nosave, "aw"
    + .align 8
     loop:
             .quad 0
     loop2:

    
    

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



  • Next message: Rik van Riel: "Re: silent semantic changes with reiser4"

    Relevant Pages

    • wait_event and preemption in 2.6
      ... I'm writing a device driver for PPC Linux and I'm using wait_event. ... preemption is turned on. ... check the condition and break out of the loop. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH] NULL pointer deref in tcp_do_twkill_work()
      ... Shouldn't the loop always restart from the beginning instead of using the ... The alternative is to not drop the lock, but I'm guessing we need to do ... Proposed patch is attached. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 2.6.9-rc2-mm1 0/2] mm: memory policy for page cache allocation
      ... Patches done with the 'diff -p' option are slightly easier to ... Could you explain the for loop in alloc_page_roundrobin? ... pseudo-uniform distribution, without any need for the additional rr_next ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Fw: x86 build issue with software suspend code
      ... since otherwise problems with this code path should have been ... > incorrectly line wrapped) patch changes the attributes of the section to ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Using global variables for loop control
      ... once loop 1 terminates, I want loop 2 to terminate also. ... But the value of the local variable never leaves loop1 so loop2 never starts. ...
      (comp.lang.labview)