Uml: basic fixups for 2.6.15
cover Uml: basic fixups for 2.6.15
These are some important fixes for 2.6.15 to merge. A couple of them are already in -mm, but I'm resending them anyway since they haven't been merged, and since akpm is "non-functional". They are:
uml-arch-um-scripts-makefilerules-remove-duplicated-code.patch uml-fix-dynamic-linking-on-some-64-bit-distros.patch
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
PATCH 1/4 uml: arch/um/scripts/Makefile.rules - remove duplicated code
From: Paolo 'Blaisorblade' Giarrusso <[email protected]>
Duplicated code - the patch adding it was probably applied twice without enough care.
---
arch/um/scripts/Makefile.rules | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
arch/um/scripts/Makefile.rules +0 -5
@@ -21,11 +21,6 @@ define unprofile endef -# The stubs and unmap.o can't try to call mcount or update basic block data -define unprofile - $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1))) -endef - # cmd_make_link checks to see if the $(foo-dir) variable starts with a /. If # so, it's considered to be a path relative to $(srcdir) rather than # $(srcdir)/arch/$(SUBARCH). This is because x86_64 wants to get ldt.c from
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
PATCH 2/4 uml: fix dynamic linking on some 64-bit distros
In reply to Paolo 'Blaisorblade' GiarrussoFrom: Rob Landley <[email protected]>, Paolo 'Blaisorblade' Giarrusso <[email protected]>
The current UML build assumes that on x86-64 systems, /lib is a symlink to /lib64, but in some distributions (like PLD and CentOS) they are separate directories, so the 64 bit library loader isn't found. This patch inserts /lib64 at the start of the rpath on x86-64 UML builds.
---
arch/um/Makefile-x86_64 | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/um/Makefile-x86_64 +4 -0
@@ -12,3 +12,7 @@ CHECKFLAGS += -m64 ELF_ARCH := i386:x86-64 ELF_FORMAT := elf64-x86-64 + +# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example. + +LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
PATCH 3/4 uml - fix some funkiness in Kconfig
In reply to Paolo 'Blaisorblade' GiarrussoSo you may have seen the miniconfig stuff wander by, which means that my build script exits if there's a .config error, and we have this:
fs/Kconfig:1749:warning: 'select' used by config symbol 'CIFS_UPCALL' refer to undefined symbol 'CONNECTOR'
This makes it shut up.
Verified it makes sense.
---
arch/um/Kconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/um/Kconfig +2 -0
@@ -289,6 +289,8 @@ source "arch/um/Kconfig.net" source "drivers/net/Kconfig" +source "drivers/connector/Kconfig" + source "fs/Kconfig" source "security/Kconfig"
PATCH 4/4 uml skas0: stop gcc's insanity
In reply to Paolo 'Blaisorblade' GiarrussoFrom: Jeff Dike <[email protected]>, Paolo 'Blaisorblade' Giarrusso <[email protected]>
UML skas0 stub has been miscompiling for many people (incidentally not the authors), depending on the used GCC versions.
I think (and testing on some GCC versions shows) this patch avoids the fundamental issue which is behind this, namely gcc using the stack when we have just replaced it, behind gcc's back. The remapping and storage of the return value is hidden in a blob of asm, hopefully giving gcc no room for creativity.
---
arch/um/include/sysdep-i386/stub.h | 29 ++++++++++++++++------------- arch/um/include/sysdep-x86_64/stub.h | 30 +++++++++++++++++------------- arch/um/kernel/skas/clone.c | 23 +++++++++++++---------- 3 files changed, 46 insertions(+), 36 deletions(-)
arch/um/include/sysdep-i386/stub.h +16 -13
@@ -6,8 +6,12 @@#ifndef __SYSDEP_STUB_H#define __SYSDEP_STUB_H +#include <sys/mman.h> #include <asm/ptrace.h> #include <asm/unistd.h> +#include "stub-data.h" +#include "kern_constants.h" +#include "uml-config.h" extern void stub_segv_handler (int sig);extern void stub_clone_handler (void );
@@ -76,23 +80,22 @@ static inline long stub_syscall5(long sy return ret; } -static inline long stub_syscall6 (long syscall,long arg1,long arg2,long arg3, -long arg4,long arg5,long arg6) +static inline void trap_myself (void ) { -long ret; - - __asm__volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; " -"int $0x80 ; pop %%ebp" - :"=a" (ret) - :"g" (syscall),"b" (arg1),"c" (arg2),"d" (arg3), -"S" (arg4),"D" (arg5),"0" (arg6)); - -return ret; + __asm("int3" ); } -static inline void trap_myself (void ) +static inline void remap_stack (int fd,unsigned long offset) { - __asm("int3" ); + __asm__volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" +"movl %7, %%ebx ; movl %%eax, (%%ebx)" + : :"g" (STUB_MMAP_NR ),"b" (UML_CONFIG_STUB_DATA ), +"c" (UM_KERN_PAGE_SIZE ), +"d" (PROT_READ |PROT_WRITE ), +"S" (MAP_FIXED |MAP_SHARED ),"D" (fd), +"a" (offset), +"i" (&((struct stub_data *)UML_CONFIG_STUB_DATA )->err) + :"memory" ); }#endif
arch/um/include/sysdep-x86_64/stub.h +17 -13
@@ -6,8 +6,12 @@#ifndef __SYSDEP_STUB_H#define __SYSDEP_STUB_H +#include <sys/mman.h> #include <asm/unistd.h> #include <sysdep/ptrace_user.h> +#include "stub-data.h" +#include "kern_constants.h" +#include "uml-config.h" extern void stub_segv_handler (int sig);extern void stub_clone_handler (void );
@@ -81,23 +85,23 @@ static inline long stub_syscall5(long syreturn ret; } -static inline long stub_syscall6 (long syscall,long arg1,long arg2,long arg3, -long arg4,long arg5,long arg6) +static inline void trap_myself (void ) { -long ret; - - __asm__volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " -"movq %7, %%r9; " __syscall :"=a" (ret) - :"0" (syscall),"D" (arg1),"S" (arg2),"d" (arg3), -"g" (arg4),"g" (arg5),"g" (arg6) - : __syscall_clobber, "r10", "r8", "r9" ); - -return ret; + __asm("int3" ); } -static inline void trap_myself (void ) +static inline void remap_stack (long fd,unsigned long offset) { - __asm("int3" ); + __asm__volatile ("movq %4,%%r10 ; movq %5,%%r8 ; " +"movq %6, %%r9; " __syscall"; movq %7, %%rbx ; " +"movq %%rax, (%%rbx)" : + :"a" (STUB_MMAP_NR ),"D" (UML_CONFIG_STUB_DATA ), +"S" (UM_KERN_PAGE_SIZE ), +"d" (PROT_READ |PROT_WRITE ), +"g" (MAP_FIXED |MAP_SHARED ),"g" (fd), +"g" (offset), +"i" (&((struct stub_data *)UML_CONFIG_STUB_DATA )->err) + : __syscall_clobber, "r10", "r8", "r9" ); }#endif
arch/um/kernel/skas/clone.c +13 -10
@@ -18,11 +18,10 @@* on some systems. */ -#define STUB_DATA (field) (((struct stub_data *) UML_CONFIG_STUB_DATA)->field) -void __attribute__ ((__section__ (".__syscall_stub" )))stub_clone_handler (void ) { +struct stub_data *data = (struct stub_data *)UML_CONFIG_STUB_DATA ;long err; err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
@@ -35,17 +34,21 @@ stub_clone_handler(void)if (err) goto out; - err =stub_syscall3 (__NR_setitimer,ITIMER_VIRTUAL , - (long ) &STUB_DATA (timer),0 ); + err =stub_syscall3 (__NR_setitimer,ITIMER_VIRTUAL , + (long ) &data->timer,0 );if (err) goto out; - err =stub_syscall6 (STUB_MMAP_NR ,UML_CONFIG_STUB_DATA , -UM_KERN_PAGE_SIZE ,PROT_READ |PROT_WRITE , -MAP_FIXED |MAP_SHARED ,STUB_DATA (fd), -STUB_DATA (offset)); +remap_stack (data->fd, data->offset); + goto done; + out: -/* save current result. Parent: pid; child: retcode of mmap */ -STUB_DATA (err) = err; +/* save current result. +* Parent: pid; +* child: retcode of mmap already saved and it jumps around this +* assignment +*/ + data->err = err; + done:trap_myself (); }
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel