Skip to contentSkip to conversation

UML - host VDSO fix

PATCH In review Jeff Dike 3 participants 5 messages Mar 23, 2007 – Mar 30, 2007 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 1/1 UML - host VDSO fix

This fixes a problem seen by a number of people running UML on newer host kernels. init would hang with an infinite segfault loop.

It turns out that the host kernel was providing a AT_SYSINFO_EHDR of 0xffffe000, which faked UML into believing that the host VDSO page could be reused. However, AT_SYSINFO pointed into the middle of the address space, and was unmapped as a result. Because UML was providing AT_SYSINFO_EHDR and AT_SYSINFO to its own processes, these would branch to nowhere when trying to use the VDSO.

The fix is to also check the location of AT_SYSINFO when deciding whether to use the host's VDSO.

--

 arch/um/os-Linux/elf_aux.c |    3 +++
 1 file changed, 3 insertions(+)
arch/um/os-Linux/elf_aux.c +3 -0
Index: linux-2.6.17/arch/um/os-Linux/elf_aux.c
===================================================================
@@ -39,6 +39,9 @@ __init void scan_elf_aux( char **envp)
 		switch ( auxv->a_type ) {
 			case AT_SYSINFO:
 				__kernel_vsyscall = auxv->a_un.a_val;
+				/* See if the page is under TASK_SIZE */
+				if (__kernel_vsyscall < (unsigned long) envp)
+					__kernel_vsyscall = 0;
 				break;
 			case AT_SYSINFO_EHDR:
 				vsyscall_ehdr = auxv->a_un.a_val;
#1 lore raw

Jeff,

Is this going into stable or devel? If stable, what version? Also, do you know what version of the host kernels introduced this behavior?

Sorry for all the questions, but I believe this is the bug I've been waiting on for a while (affecting host kernels greater than 2.6.17, or something of that nature). Thanks!

Tony

Quoted 51 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jeff Dike
Sent: Friday, March 23, 2007 12:38 PM
To: [email protected]
Cc: LKML; uml-devel
Subject: [uml-devel] [PATCH] UML - host VDSO fix

This fixes a problem seen by a number of people running UML on newer host
kernels. init would hang with an infinite segfault loop.

It turns out that the host kernel was providing a AT_SYSINFO_EHDR of 0xffffe000, which faked UML into believing that the host VDSO page could be
reused. However, AT_SYSINFO pointed into the middle of the address space, and
was unmapped as a result. Because UML was providing AT_SYSINFO_EHDR and
AT_SYSINFO to its own processes, these would branch to nowhere when trying to
use the VDSO.

The fix is to also check the location of AT_SYSINFO when deciding whether to
use the host's VDSO.

--

 arch/um/os-Linux/elf_aux.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6.17/arch/um/os-Linux/elf_aux.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/elf_aux.c

2007-02-23 15:00:51.000000000 -0500

+++ linux-2.6.17/arch/um/os-Linux/elf_aux.c 2007-02-23
15:09:58.000000000 -0500

arch/um/os-Linux/elf_aux.c +3 -0
@@ -39,6 +39,9 @@ __init void scan_elf_aux( char **envp)
 		switch ( auxv->a_type ) {
 			case AT_SYSINFO:
 				__kernel_vsyscall = auxv->a_un.a_val;
+				/* See if the page is under TASK_SIZE */
+				if (__kernel_vsyscall < 
 (unsigned long) envp)
+					__kernel_vsyscall = 0;
 				break;
 			case AT_SYSINFO_EHDR:

vsyscall_ehdr = auxv->a_un.a_val;

Quoted 13 lines

--------------------------------------------------------------
-----------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge
&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#2 lore raw
Quoted 2 lines · Anthony - NET

Is this going into stable or devel? If stable, what version? Also, do you know what version of the host kernels introduced this behavior?

It's in mainline (2.6.21-rc4 now). The mail that you're replying to hopefully will get the fix into 2.6.20.4.

Quoted 3 lines

Sorry for all the questions, but I believe this is the bug I've been waiting on for a while (affecting host kernels greater than 2.6.17, or something of that nature). Thanks!

I believe so too, but more confirmation is always welcome.

Jeff

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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 Brock, Anthony - NET
Quoted 1 line · Anthony - NET

Is this going into stable or devel? If stable, what version?

I said 2.6.20.4, which just came out, so I guess this will wait until 2.6.20.5.

Jeff

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#4 lore raw

[uml-devel] patch uml-host-vdso-fix.patch queued to -stable tree

In reply to Jeff Dike

This is a note to let you know that we have just queued up the patch titled

Subject: UML - host VDSO fix

to the 2.6.20-stable tree. Its filename is

uml-host-vdso-fix.patch

A git repo of this tree can be found at
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

From [email protected] Fri Mar 23 12:41:21 2007
From: Jeff Dike <[email protected]>
Date: Fri, 23 Mar 2007 15:37:30 -0400
Subject: UML - host VDSO fix
To: [email protected]
Cc: uml-devel <[email protected]>
Message-ID: <[email protected]>
Content-Disposition: inline

From: Jeff Dike <[email protected]>

This fixes a problem seen by a number of people running UML on newer host kernels. init would hang with an infinite segfault loop.

It turns out that the host kernel was providing a AT_SYSINFO_EHDR of 0xffffe000, which faked UML into believing that the host VDSO page could be reused. However, AT_SYSINFO pointed into the middle of the address space, and was unmapped as a result. Because UML was providing AT_SYSINFO_EHDR and AT_SYSINFO to its own processes, these would branch to nowhere when trying to use the VDSO.

The fix is to also check the location of AT_SYSINFO when deciding whether to use the host's VDSO.

arch/um/os-Linux/elf_aux.c +3 -0
@@ -39,6 +39,9 @@ __init void scan_elf_aux( char **envp)
 		switch ( auxv->a_type ) {
 			case AT_SYSINFO:
 				__kernel_vsyscall = auxv->a_un.a_val;
+				/* See if the page is under TASK_SIZE */
+				if (__kernel_vsyscall < (unsigned long) envp)
+					__kernel_vsyscall = 0;
 				break;
 			case AT_SYSINFO_EHDR:
 				vsyscall_ehdr = auxv->a_un.a_val;

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Patches currently in stable-queue which might be from [email protected] are

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel