Skip to contentSkip to conversation

UML - Add a .note.SuSE section

PATCH In review Jeff Dike 7 participants 11 messages Aug 16, 2007 – Aug 23, 2007 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 1/1 UML - Add a .note.SuSE section

[ This is both 2.6.24 and -stable material ]

SuSE seems to require that binaries have a .note.SuSE section. Without it, UML segfaults if any parameters are passed on the command line.

--

 arch/um/kernel/dyn.lds.S |    1 +
 1 file changed, 1 insertion(+)
arch/um/kernel/dyn.lds.S +1 -0
Index: linux-2.6.22/arch/um/kernel/dyn.lds.S
===================================================================
@@ -10,6 +10,7 @@ SECTIONS
   PROVIDE (__executable_start = START);
   . = START + SIZEOF_HEADERS;
   .interp         : { *(.interp) }
+  .note.SuSE	  : { *(.note.SuSE) }
   __binary_start = .;
   . = ALIGN(4096);		/* Init code and data */
   _text = .;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 5 lines · Jeff Dike

[ This is both 2.6.24 and -stable material ]

SuSE seems to require that binaries have a .note.SuSE section. Without it, UML segfaults if any parameters are passed on the command line.

this sounds like something really stupid and bad... why would the kernel need to have a per-distro note section???

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
Quoted 11 lines · Arjan van de Ven
Quoted 5 lines · Jeff Dike

[ This is both 2.6.24 and -stable material ]

SuSE seems to require that binaries have a .note.SuSE section. Without it, UML segfaults if any parameters are passed on the command line.

this sounds like something really stupid and bad... why would the kernel need to have a per-distro note section???

I agree, what did we mess up in the SuSE kernel to require such a hack? :)

thanks,

greg k-h

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#3 lore raw
In reply to Arjan van de Ven
Quoted 2 lines · Arjan van de Ven

this sounds like something really stupid and bad... why would the kernel need to have a per-distro note section???

Quoted 1 line · Chris Wright

Huh!? Why do we need a SuSE section?

Quoted 1 line · Greg KH

I agree, what did we mess up in the SuSE kernel to require such a hack?

Beats the crap out of me.

Drop this patch - it looks like it might just be papering over symptoms rather than fixing the real problem - see below.

What I do know is that current UML doesn't run when built on a SuSE host, the UML commit which caused it to break is c35e584c087381aaa5f1ed40a28b978535c18fb2

	http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=c35e584c087381aaa5f1ed40a28b978535c18fb2;hp=a5bd1786fb30abe663b904f6d79bba413e9ba883

and the difference between a working UML binary and a broken one is this:

+ 1 .note.ABI-tag 00000020 0000000060000254 0000000060000254 00000254 2**2

+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
+  2 .note.SuSE    00000018  0000000060000274  0000000060000274  00000274  2**2
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA

and the .note.SuSE section makes the difference.

Looking into it a bit further, the contents of the section are:

	objdump --section=.note.SuSE -s uml8796-linux-good

	uml8796-linux-good:     file format elf64-x86-64

	Contents of section .note.SuSE:
	 60000274 05000000 04000000 53755345 53755345  ........SuSESuSE
	 60000284 00000000 01000a02                    ........        

which seems kind of pointless, but also harmless.

The crash is in this section:

  __uml_setup_start = .;
  .uml.setup.init : { *(.uml.setup.init) }
  __uml_setup_end = .;

with &__uml_setup_start being 8 bytes before the start of the first 16-byte structure in .uml.setup.init, so the structures are misaligned wrt the start symbol.

I don't see any connection between the presence of a section at the start of the binary and this misalignment, so the patch is probably wrong.

Jeff

Signature · 11 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#4 lore raw
Quoted 6 lines · Jeff Dike

The crash is in this section:

  __uml_setup_start = .;
  .uml.setup.init : { *(.uml.setup.init) }
  __uml_setup_end = .;

This looks like a classic bug.
You wanted this:

.uml.setup.init : {
	__uml_setup_start = .;
	*(.uml.setup.init)
	__uml_setup_end = .;
}

In this way you are sure __uml_setup_start has same address as start of section.
With the original code the linker will align the .uml.setup.init section to the alignment required by the included sections and thus the label and the actual start address may differ.

Sam

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#5 lore raw
Quoted 8 lines · Sam Ravnborg
Quoted 6 lines · Jeff Dike

The crash is in this section:

  __uml_setup_start = .;
  .uml.setup.init : { *(.uml.setup.init) }
  __uml_setup_end = .;
Quoted 7 lines

This looks like a classic bug.
You wanted this:

.uml.setup.init : {
	__uml_setup_start = .;
	*(.uml.setup.init)
	__uml_setup_end = .;
}

Ooh, this sounds promising, thanks.

Jeff

Signature · 11 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#6 lore raw
Quoted 16 lines · Jeff Dike
Quoted 7 lines · Sam Ravnborg
Quoted 5 lines · Jeff Dike

The crash is in this section:

  __uml_setup_start = .;
  .uml.setup.init : { *(.uml.setup.init) }
  __uml_setup_end = .;
Quoted 7 lines

This looks like a classic bug.
You wanted this:

.uml.setup.init : {
	__uml_setup_start = .;
	*(.uml.setup.init)
	__uml_setup_end = .;
}
Quoted 1 line

Ooh, this sounds promising, thanks.

It's not the first time we hit effects of such bugs, is it? The .note.ABI-tag fix, time ago, may be about the same problem. Can you double-check all UML linker scripts for more instances of this bug?

Bye

Signature · 4 lines
"Doh!" (cit.), I've made another another mistake!
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#7 lore raw
Quoted 1 line · Blaisorblade

It's not the first time we hit effects of such bugs, is it?

I don't remember seeing this before.

Quoted 1 line

The .note.ABI-tag fix, time ago, may be about the same problem.

Are you referring to
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=c35e584c087381aaa5f1ed40a28b978535c18fb2;hp=a5bd1786fb30abe663b904f6d79bba413e9ba883?
If so, I never understood that - it just came in saying "this fixes static building", so I sent it along. BTW, that commit was singled out by git-bisect as "causing" this particular problem.

Quoted 2 lines

Can you
double-check all UML linker scripts for more instances of this bug?

I did, I have a patch, and it's been verified to fix the problem.

Jeff

Signature · 11 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#8 lore raw
Quoted 11 lines · Jeff Dike
Quoted 1 line · Blaisorblade

It's not the first time we hit effects of such bugs, is it?

I don't remember seeing this before.

Quoted 1 line

The .note.ABI-tag fix, time ago, may be about the same problem.

Are you referring to
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdi
ff;h=c35e584c087381aaa5f1ed40a28b978535c18fb2;hp=a5bd1786fb30abe663b904f6d79 bba413e9ba883?

Yes.

Quoted 2 lines

If so, I never understood that - it just came in saying "this fixes static building", so I sent it along.

In this case, I'm referring to the patch which had a typo, which is yours:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7632fc8f809a97f9d82ce125e8e3e579390ce2e5
Description follows:
"During a static link, ld has started putting a .note section in the .uml.setup.init section. This has the result that the UML setups begin with 32 bytes of garbage and UML crashes immediately on boot.

This patch creates a specific .note section for ld to drop this stuff into."

My patch only made your change work for real - IIRC you had fixed that exact typo too, but you forgot to run quilt refresh before sending the patch (btw, quilt pop -a will force you to refresh all patches to succeed - I do it frequently).

Quoted 7 lines

BTW, that commit was singled
out by git-bisect as "causing" this particular problem.

Quoted 2 lines

Can you
double-check all UML linker scripts for more instances of this bug?

I did, I have a patch, and it's been verified to fix the problem.

In this case, we _may_ want to remove the .note section altogether - even if it is likely to shake out more problems.

Good bye!

Signature · 4 lines
"Doh!" (cit.), I've made another another mistake!
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
#9 lore raw
In reply to Jeff Dike
Quoted 5 lines · * Jeff Dike ([email protected]) wrote:

[ This is both 2.6.24 and -stable material ]

SuSE seems to require that binaries have a .note.SuSE section. Without it, UML segfaults if any parameters are passed on the command line.

Huh!? Why do we need a SuSE section?
thanks,
-chris

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#10 lore raw
In reply to Jeff Dike
Quoted 5 lines · Jeff Dike

[ This is both 2.6.24 and -stable material ]

SuSE seems to require that binaries have a .note.SuSE section. Without it, UML segfaults if any parameters are passed on the command line.

This doesn't make any sense. You must have misanalyzed this.

-Andi

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel