linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] [patch 04/37] UML - fix epoll
       [not found] ` <20070330210334.GA29450@kroah.com>
@ 2007-03-30 21:04   ` Greg KH
  2007-03-30 21:04   ` [uml-devel] [patch 05/37] UML - host VDSO fix Greg KH
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2007-03-30 21:04 UTC (permalink / raw)
  To: linux-kernel, stable, Andrew Morton
  Cc: Theodore Ts'o, Zwane Mwaikambo, uml-devel, Justin Forbes,
	Chris Wedgwood, Randy Dunlap, Michael Krufky, Chuck Ebbert,
	Dave Jones, Chuck Wolber, akpm, Jeff Dike, torvalds, alan

[-- Attachment #1: uml-fix-epoll.patch --]
[-- Type: text/plain, Size: 1529 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Jeff Dike <jdike@addtoit.com>

UML/x86_64 needs the same packing of struct epoll_event as x86_64.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/linux/eventpoll.h |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -31,12 +31,19 @@
 /* 
  * On x86-64 make the 64bit structure have the same alignment as the
  * 32bit structure. This makes 32bit emulation easier.
+ *
+ * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 +
+ * 64_BIT adds up to UML/x86_64.
  */
 #ifdef __x86_64__
 #define EPOLL_PACKED __attribute__((packed))
 #else
+#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
+#define EPOLL_PACKED __attribute__((packed))
+#else
 #define EPOLL_PACKED
 #endif
+#endif
 
 struct epoll_event {
 	__u32 events;

-- 

-------------------------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [uml-devel] [patch 05/37] UML - host VDSO fix
       [not found] ` <20070330210334.GA29450@kroah.com>
  2007-03-30 21:04   ` [uml-devel] [patch 04/37] UML - fix epoll Greg KH
@ 2007-03-30 21:04   ` Greg KH
  2007-03-30 21:04   ` [uml-devel] [patch 06/37] UML - Fix static linking Greg KH
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2007-03-30 21:04 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Theodore Ts'o, Zwane Mwaikambo, uml-devel, Justin Forbes,
	Chris Wedgwood, Randy Dunlap, Michael Krufky, Chuck Ebbert,
	Dave Jones, Chuck Wolber, akpm, Jeff Dike, torvalds, alan

[-- Attachment #1: uml-host-vdso-fix.patch --]
[-- Type: text/plain, Size: 1895 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Jeff Dike <jdike@addtoit.com>

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.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

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

--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -40,6 +40,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;

-- 

-------------------------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [uml-devel] [patch 06/37] UML - Fix static linking
       [not found] ` <20070330210334.GA29450@kroah.com>
  2007-03-30 21:04   ` [uml-devel] [patch 04/37] UML - fix epoll Greg KH
  2007-03-30 21:04   ` [uml-devel] [patch 05/37] UML - host VDSO fix Greg KH
@ 2007-03-30 21:04   ` Greg KH
  2007-03-30 21:04   ` Greg KH
  2007-03-30 21:04   ` [uml-devel] [patch 07/37] UML - use correct register file size everywhere Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2007-03-30 21:04 UTC (permalink / raw)
  To: linux-kernel, stable, Andrew Morton
  Cc: Theodore Ts'o, Zwane Mwaikambo, uml-devel, JC.LAFOUCRIERE,
	Justin Forbes, Chris Wedgwood, Randy Dunlap, Michael Krufky,
	Chuck Ebbert, Dave Jones, Chuck Wolber, akpm, Jeff Dike, torvalds,
	alan

[-- Attachment #1: uml-fix-static-linking.patch --]
[-- Type: text/plain, Size: 1387 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Jeff Dike <jdike@addtoit.com>

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.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/asm-um/common.lds.S |    1 +
 1 file changed, 1 insertion(+)

--- a/include/asm-um/common.lds.S
+++ b/include/asm-um/common.lds.S
@@ -15,6 +15,7 @@
   PROVIDE (_unprotected_end = .);
 
   . = ALIGN(4096);
+  .note : { *(note.*) }
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;

-- 

-------------------------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [uml-devel] [patch 06/37] UML - Fix static linking
       [not found] ` <20070330210334.GA29450@kroah.com>
                     ` (2 preceding siblings ...)
  2007-03-30 21:04   ` [uml-devel] [patch 06/37] UML - Fix static linking Greg KH
@ 2007-03-30 21:04   ` Greg KH
  2007-03-31  1:21     ` Blaisorblade
  2007-03-30 21:04   ` [uml-devel] [patch 07/37] UML - use correct register file size everywhere Greg KH
  4 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2007-03-30 21:04 UTC (permalink / raw)
  To: linux-kernel, stable, Andrew Morton
  Cc: Theodore Ts'o, Zwane Mwaikambo, uml-devel, JC.LAFOUCRIERE,
	Justin Forbes, Chris Wedgwood, Randy Dunlap, Michael Krufky,
	Chuck Ebbert, Dave Jones, Chuck Wolber, akpm, Jeff Dike, torvalds,
	alan

[-- Attachment #1: uml-fix-static-linking.patch --]
[-- Type: text/plain, Size: 1387 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Jeff Dike <jdike@addtoit.com>

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.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/asm-um/common.lds.S |    1 +
 1 file changed, 1 insertion(+)

--- a/include/asm-um/common.lds.S
+++ b/include/asm-um/common.lds.S
@@ -15,6 +15,7 @@
   PROVIDE (_unprotected_end = .);
 
   . = ALIGN(4096);
+  .note : { *(note.*) }
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;

-- 

-------------------------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [uml-devel] [patch 07/37] UML - use correct register file size everywhere
       [not found] ` <20070330210334.GA29450@kroah.com>
                     ` (3 preceding siblings ...)
  2007-03-30 21:04   ` Greg KH
@ 2007-03-30 21:04   ` Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2007-03-30 21:04 UTC (permalink / raw)
  To: linux-kernel, stable, Andrew Morton
  Cc: Theodore Ts'o, Zwane Mwaikambo, uml-devel, Davide Brini,
	Justin Forbes, Chris Wedgwood, Randy Dunlap, Michael Krufky,
	Chuck Ebbert, Dave Jones, Chuck Wolber, akpm, Jeff Dike, torvalds,
	alan

[-- Attachment #1: uml-use-correct-register-file-size-everywhere.patch --]
[-- Type: text/plain, Size: 5633 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Jeff Dike <jdike@addtoit.com>

This patch uses MAX_REG_NR consistently to refer to the register file
size.  FRAME_SIZE isn't sufficient because on x86_64, it is smaller
than the ptrace register file size.  MAX_REG_NR was introduced as a
consistent way to get the number of registers, but wasn't used
everywhere it should be.

When this causes a problem, it makes PTRACE_SETREGS fail on x86_64
because of a corrupted segment register value in the known-good
register file. The patch also adds a register dump at that point in
case there are any future problems here.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/um/include/sysdep-x86_64/ptrace.h  |    4 ----
 arch/um/os-Linux/skas/mem.c             |   10 +++++++---
 arch/um/os-Linux/skas/process.c         |    6 +++---
 arch/um/os-Linux/sys-i386/registers.c   |    5 +++--
 arch/um/os-Linux/sys-x86_64/registers.c |    4 ++--
 5 files changed, 15 insertions(+), 14 deletions(-)

--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -104,10 +104,6 @@ union uml_pt_regs {
 #endif
 #ifdef UML_CONFIG_MODE_SKAS
 	struct skas_regs {
-		/* x86_64 ptrace uses sizeof(user_regs_struct) as its register
-		 * file size, while i386 uses FRAME_SIZE.  Therefore, we need
-		 * to use UM_FRAME_SIZE here instead of HOST_FRAME_SIZE.
-		 */
 		unsigned long regs[MAX_REG_NR];
 		unsigned long fp[HOST_FP_SIZE];
                 struct faultinfo faultinfo;
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -48,7 +48,7 @@ int multi_op_count = 0;
 static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
 {
 	unsigned long regs[MAX_REG_NR];
-	int n;
+	int n, i;
 	long ret, offset;
 	unsigned long * data;
 	unsigned long * syscall;
@@ -66,9 +66,13 @@ static inline long do_syscall_stub(struc
 		 (unsigned long) &__syscall_stub_start);
 
 	n = ptrace_setregs(pid, regs);
-	if(n < 0)
+	if(n < 0){
+		printk("Registers - \n");
+		for(i = 0; i < MAX_REG_NR; i++)
+			printk("\t%d\t0x%lx\n", i, regs[i]);
 		panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
-		      n);
+		      -n);
+	}
 
 	wait_stub_done(pid, 0, "do_syscall_stub");
 
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -67,7 +67,7 @@ void wait_stub_done(int pid, int sig, ch
 
 	if((n < 0) || !WIFSTOPPED(status) ||
 	   (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
-		unsigned long regs[HOST_FRAME_SIZE];
+		unsigned long regs[MAX_REG_NR];
 
 		if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
 			printk("Failed to get registers from stub, "
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, ch
 			int i;
 
 			printk("Stub registers -\n");
-			for(i = 0; i < HOST_FRAME_SIZE; i++)
+			for(i = 0; i < ARRAY_SIZE(regs); i++)
 				printk("\t%d - %lx\n", i, regs[i]);
 		}
 		panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
@@ -328,7 +328,7 @@ void userspace(union uml_pt_regs *regs)
 int copy_context_skas0(unsigned long new_stack, int pid)
 {
 	int err;
-	unsigned long regs[HOST_FRAME_SIZE];
+	unsigned long regs[MAX_REG_NR];
 	unsigned long fp_regs[HOST_FP_SIZE];
 	unsigned long current_stack = current_stub_stack();
 	struct stub_data *data = (struct stub_data *) current_stack;
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -15,7 +15,7 @@
 
 /* These are set once at boot time and not changed thereafter */
 
-static unsigned long exec_regs[HOST_FRAME_SIZE];
+static unsigned long exec_regs[MAX_REG_NR];
 static unsigned long exec_fp_regs[HOST_FP_SIZE];
 static unsigned long exec_fpx_regs[HOST_XFP_SIZE];
 static int have_fpx_regs = 1;
@@ -101,6 +101,7 @@ void init_registers(int pid)
 {
 	int err;
 
+	memset(exec_regs, 0, sizeof(exec_regs));
 	err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
 	if(err)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
@@ -124,7 +125,7 @@ void init_registers(int pid)
 
 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
 {
-	memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
+	memcpy(regs, exec_regs, sizeof(exec_regs));
 	if(fp_regs != NULL)
 		memcpy(fp_regs, exec_fp_regs,
 		       HOST_FP_SIZE * sizeof(unsigned long));
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -14,7 +14,7 @@
 
 /* These are set once at boot time and not changed thereafter */
 
-static unsigned long exec_regs[HOST_FRAME_SIZE];
+static unsigned long exec_regs[MAX_REG_NR];
 static unsigned long exec_fp_regs[HOST_FP_SIZE];
 
 void init_thread_registers(union uml_pt_regs *to)
@@ -72,7 +72,7 @@ void init_registers(int pid)
 
 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
 {
-	memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
+	memcpy(regs, exec_regs, sizeof(exec_regs));
 	if(fp_regs != NULL)
 		memcpy(fp_regs, exec_fp_regs,
 		       HOST_FP_SIZE * sizeof(unsigned long));

-- 

-------------------------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [uml-devel] [patch 06/37] UML - Fix static linking
  2007-03-30 21:04   ` Greg KH
@ 2007-03-31  1:21     ` Blaisorblade
  0 siblings, 0 replies; 6+ messages in thread
From: Blaisorblade @ 2007-03-31  1:21 UTC (permalink / raw)
  To: user-mode-linux-devel
  Cc: Andrew Morton, Theodore Ts'o, Zwane Mwaikambo, Justin Forbes,
	Greg KH, JC.LAFOUCRIERE, linux-kernel, Chris Wedgwood, torvalds,
	Randy Dunlap, Michael Krufky, Chuck Ebbert, Dave Jones, akpm,
	Jeff Dike, Chuck Wolber, stable, alan

On venerdì 30 marzo 2007, Greg KH wrote:
> -stable review patch.  If anyone has any objections, please let us know.

I have one objection, the fix has a typo! This is the additional fix 
(note '.note' instead of 'note'):

--- linux-2.6.git.orig/include/asm-um/common.lds.S
+++ linux-2.6.git/include/asm-um/common.lds.S
@@ -15,7 +15,7 @@
   PROVIDE (_unprotected_end = .);

   . = ALIGN(4096);
-  .note : { *(note.*) }
+  .note : { *(.note.*) }
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;

With this, the fix should be merged - I just re-hit this bug and rechecked 
everything, now it's ok.

> ------------------
> From: Jeff Dike <jdike@addtoit.com>
>
> 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.
>
> Signed-off-by: Jeff Dike <jdike@linux.intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> ---
>  include/asm-um/common.lds.S |    1 +
>  1 file changed, 1 insertion(+)
>
> --- a/include/asm-um/common.lds.S
> +++ b/include/asm-um/common.lds.S
> @@ -15,6 +15,7 @@
>    PROVIDE (_unprotected_end = .);
>
>    . = ALIGN(4096);
> +  .note : { *(note.*) }
>    __start___ex_table = .;
>    __ex_table : { *(__ex_table) }
>    __stop___ex_table = .;



-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade

-------------------------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-31  1:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20070330205938.984247529@mini.kroah.org>
     [not found] ` <20070330210334.GA29450@kroah.com>
2007-03-30 21:04   ` [uml-devel] [patch 04/37] UML - fix epoll Greg KH
2007-03-30 21:04   ` [uml-devel] [patch 05/37] UML - host VDSO fix Greg KH
2007-03-30 21:04   ` [uml-devel] [patch 06/37] UML - Fix static linking Greg KH
2007-03-30 21:04   ` Greg KH
2007-03-31  1:21     ` Blaisorblade
2007-03-30 21:04   ` [uml-devel] [patch 07/37] UML - use correct register file size everywhere Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox