Skip to contentSkip to conversation

i386 kernel instant reboot with older binutils fix

PATCH In review Vivek Goyal 5 participants 8 messages Jan 3, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386 kernel instant reboot with older binutils fix

o i386 kernel reboots instantly if compiled with binutils older than 2.6.15.

o Older binutils required explicit flags to mark a section allocatable and executable(AX). Newer binutils automatically mark a section AX if the name starts with .text.

o While defining a new section using assembler "section" directive, explicitly mention section flags.

---

 arch/i386/boot/compressed/head.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/i386/boot/compressed/head.S renamed from arch/i386/boot/compressed/head.S~jean-reboot-issue-fix +1 -1
diff -puN arch/i386/boot/compressed/head.S~jean-reboot-issue-fix arch/i386/boot/compressed/head.S
@@ -28,7 +28,7 @@
 #include <asm/page.h>
 #include <asm/boot.h>
 
-.section ".text.head"
+.section ".text.head","ax",@progbits
 	.globl startup_32
 
 startup_32:

_

#1 lore raw
Quoted 9 lines · Vivek Goyal

o i386 kernel reboots instantly if compiled with binutils older than 2.6.15.

o Older binutils required explicit flags to mark a section allocatable and executable(AX). Newer binutils automatically mark a section AX if the name starts with .text.

o While defining a new section using assembler "section" directive, explicitly mention section flags.

As such this patch looks fine, and is certainly harmless. But don't we also need to address the issue that .text.head is not listed in the linker script?

i.e. Don't we also need?

.text : AT(ADDR(.text) - LOAD_OFFSET) {
_text = .; /* Text and read-only data */
+ *(.text.head)

	*(.text)
	SCHED_TEXT
	LOCK_TEXT
	KPROBES_TEXT
	*(.fixup)
	*(.gnu.warning)

_etext = .; /* End of text section */
} :text = 0x9090

I'm not even certain how the i386 kernel links properly without the above.

Eric

#2 lore raw
Quoted 27 lines · Eric W. Biederman
Quoted 9 lines · Vivek Goyal

o i386 kernel reboots instantly if compiled with binutils older than 2.6.15.

o Older binutils required explicit flags to mark a section allocatable and executable(AX). Newer binutils automatically mark a section AX if the name starts with .text.

o While defining a new section using assembler "section" directive, explicitly mention section flags.

As such this patch looks fine, and is certainly harmless. But don't we also need to address the issue that .text.head is not listed in the linker script?

i.e. Don't we also need?

  .text : AT(ADDR(.text) - LOAD_OFFSET) {
  	_text = .;			/* Text and read-only data */
(quoted diff) +1 -0
+	*(.text.head)
	*(.text)
	SCHED_TEXT
	LOCK_TEXT
	KPROBES_TEXT
	*(.fixup)
	*(.gnu.warning)
Quoted 5 lines

_etext = .; /* End of text section */
} :text = 0x9090

I'm not even certain how the i386 kernel links properly without the above.

Hi Eric,

This .text.head section is not part of vmlinux. This is part of uncompressed portion in bzImage. arch/i386/boot/compressed/head.S.

Hence, arch/i386/boot/compressed/vmlinux.lds should take care of it which already has entry for linking .text.head section.

        . =  0  ;
        .text.head : {
                _head = . ;
                *(.text.head)
                _ehead = . ;
        }

Thanks
Vivek

#3 lore raw
Quoted 7 lines · Vivek Goyal

Hi Eric,

This .text.head section is not part of vmlinux. This is part of uncompressed portion in bzImage. arch/i386/boot/compressed/head.S.

Hence, arch/i386/boot/compressed/vmlinux.lds should take care of it which already has entry for linking .text.head section.

Yep. Sorry never mind.

Thanks for the good tracking on this one.

Eric

#4 lore raw
In reply to Vivek Goyal
Quoted 3 lines · Vivek Goyal

o i386 kernel reboots instantly if compiled with binutils older than 2.6.15.

Should that have been "2.15"?

And is the following perhaps the same issue?

Subject : kernel immediately reboots instead of booting
References : http://lkml.org/lkml/2007/1/2/15
Submitter : Steve Youngs <[email protected]>
Status : unknown

@Steve:
You had binutils 2.14.90.0.6 .
Does this patch fix it for you?

Quoted 26 lines

o Older binutils required explicit flags to mark a section allocatable and executable(AX). Newer binutils automatically mark a section AX if the name starts with .text.

o While defining a new section using assembler "section" directive, explicitly mention section flags.

---

 arch/i386/boot/compressed/head.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN arch/i386/boot/compressed/head.S~jean-reboot-issue-fix arch/i386/boot/compressed/head.S

arch/i386/boot/compressed/head.S renamed from arch/i386/boot/compressed/head.S~jean-reboot-issue-fix +1 -1
@@ -28,7 +28,7 @@
 #include <asm/page.h>
 #include <asm/boot.h>
 
-.section ".text.head"
+.section ".text.head","ax",@progbits
 	.globl startup_32
 
 startup_32:
Quoted 1 line

_

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#5 lore raw
Quoted 7 lines · Adrian Bunk
Quoted 3 lines · Vivek Goyal

o i386 kernel reboots instantly if compiled with binutils older than 2.6.15.

Should that have been "2.15"?

Yes Adrian, it should be 2.15 instead. My mistake.

Hopefully this patch should solve steve's issue too.

Reattaching the patch with corrected changelog.

Thanks
Vivek

o i386 kernel reboots instantly if compiled with binutils older than 2.15.

o Older binutils required explicit flags to mark a section allocatable and executable(AX). Newer binutils automatically mark a section AX if the name starts with .text.

o While defining a new section using assembler "section" directive, explicitly mention section flags.

---

 arch/i386/boot/compressed/head.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/i386/boot/compressed/head.S renamed from arch/i386/boot/compressed/head.S~jean-reboot-issue-fix +1 -1
diff -puN arch/i386/boot/compressed/head.S~jean-reboot-issue-fix arch/i386/boot/compressed/head.S
@@ -28,7 +28,7 @@
 #include <asm/page.h>
 #include <asm/boot.h>
 
-.section ".text.head"
+.section ".text.head","ax",@progbits
 	.globl startup_32
 
 startup_32:

_

#6 lore raw
Quoted 1 line

Hopefully this patch should solve steve's issue too.

Sure looks like it.

Quoted 3 lines

o Older binutils required explicit flags to mark a section allocatable and executable(AX). Newer binutils automatically mark a section AX if the name starts with .text.

More exactly, since 2.15 more section names are automatically recognised as being of a certain type; older binutils already did this for plain .text, for example. Just a nitpick, but perhaps it explains the problem better; I'm fine with the patch as-is.

Segher

#7 lore raw
In reply to Adrian Bunk
Quoted 5 lines · Adrian Bunk
Quoted 3 lines · Vivek Goyal

o i386 kernel reboots instantly if compiled with binutils older than 2.6.15.

Quoted 8 lines

Should that have been "2.15"?

And is the following perhaps the same issue?

Subject : kernel immediately reboots instead of booting
References : http://lkml.org/lkml/2007/1/2/15
Submitter : Steve Youngs <[email protected]>
Status : unknown

Indeed this pretty much resembles my problem.

Quoted 3 lines

@Steve:
You had binutils 2.14.90.0.6 .
Does this patch fix it for you?

I'd really expect it to, Steve please try the patch and confirm.

Signature · 1 line
Jean Delvare