* [PATCH 3/5] UML - Clean up tt mode remapping of UML binary
@ 2005-06-06 20:08 Jeff Dike
2005-06-06 23:05 ` [uml-devel] " Blaisorblade
0 siblings, 1 reply; 9+ messages in thread
From: Jeff Dike @ 2005-06-06 20:08 UTC (permalink / raw)
To: akpm, torvalds; +Cc: linux-kernel, user-mode-linux-devel
>From Al Viro - this turns the tt mode remapping of the binary into arch
code.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.12-rc/arch/um/Makefile
===================================================================
--- linux-2.6.12-rc.orig/arch/um/Makefile 2005-06-02 17:04:01.000000000 -0400
+++ linux-2.6.12-rc/arch/um/Makefile 2005-06-06 11:36:06.000000000 -0400
@@ -119,7 +119,7 @@ ifndef START
START = $$(($(TOP_ADDR) - $(SIZE)))
endif
-CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
+CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) -I$(SYS_DIR) \
-DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
-DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE-y) \
-DKERNEL_STACK_SIZE=$(STACK_SIZE))
Index: linux-2.6.12-rc/arch/um/include/sysdep-i386/unmap.lds
===================================================================
--- linux-2.6.12-rc.orig/arch/um/include/sysdep-i386/unmap.lds 2005-06-06 05:54:35.815704808 -0400
+++ linux-2.6.12-rc/arch/um/include/sysdep-i386/unmap.lds 2005-06-02 17:04:44.000000000 -0400
@@ -0,0 +1,14 @@
+ .thread_private : {
+ __start_thread_private = .;
+ errno = .;
+ . += 4;
+ arch/um/sys-i386/unmap_fin.o (.bss)
+ __end_thread_private = .;
+ }
+ . = ALIGN(4096);
+ .remap : { arch/um/sys-i386/unmap_fin.o (.text) }
+
+ /* We want it only if we are in MODE_TT. In both cases, however, when MODE_TT
+ * is off the resulting binary segfaults.*/
+
+ . = ALIGN(4096); /* Init code and data */
Index: linux-2.6.12-rc/arch/um/include/sysdep-x86_64/unmap.lds
===================================================================
--- linux-2.6.12-rc.orig/arch/um/include/sysdep-x86_64/unmap.lds 2005-06-06 05:54:35.815704808 -0400
+++ linux-2.6.12-rc/arch/um/include/sysdep-x86_64/unmap.lds 2005-06-02 17:04:44.000000000 -0400
@@ -0,0 +1,6 @@
+ . = ALIGN(4096); /* Init code and data */
+ .remap : {
+ arch/um/sys-x86_64/unmap_fin.o (.bss)
+ arch/um/sys-x86_64/unmap_fin.o (.text)
+ }
+ . = ALIGN(4096); /* Init code and data */
Index: linux-2.6.12-rc/arch/um/kernel/tt/Makefile
===================================================================
--- linux-2.6.12-rc.orig/arch/um/kernel/tt/Makefile 2005-06-02 17:04:01.000000000 -0400
+++ linux-2.6.12-rc/arch/um/kernel/tt/Makefile 2005-06-06 11:52:11.000000000 -0400
@@ -3,10 +3,6 @@
# Licensed under the GPL
#
-extra-y := unmap_fin.o
-targets := unmap.o
-clean-files := unmap_tmp.o
-
obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \
syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \
uaccess.o uaccess_user.o
@@ -16,14 +12,3 @@ obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptp
USER_OBJS := gdb.o time.o tracer.o
include arch/um/scripts/Makefile.rules
-
-UNMAP_CFLAGS := $(patsubst -pg -DPROFILING,,$(USER_CFLAGS))
-UNMAP_CFLAGS := $(patsubst -fprofile-arcs -ftest-coverage,,$(UNMAP_CFLAGS))
-
-#XXX: partially copied from arch/um/scripts/Makefile.rules
-$(obj)/unmap.o: c_flags = -Wp,-MD,$(depfile) $(UNMAP_CFLAGS)
-
-$(obj)/unmap_fin.o : $(obj)/unmap.o
- $(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a)
- $(OBJCOPY) $(obj)/unmap_tmp.o $@ -G switcheroo
-
Index: linux-2.6.12-rc/arch/um/kernel/tt/unmap.c
===================================================================
--- linux-2.6.12-rc.orig/arch/um/kernel/tt/unmap.c 2005-06-02 17:04:01.000000000 -0400
+++ linux-2.6.12-rc/arch/um/kernel/tt/unmap.c 2005-06-06 05:54:35.815704808 -0400
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
- * Licensed under the GPL
- */
-
-#include <sys/mman.h>
-
-int switcheroo(int fd, int prot, void *from, void *to, int size)
-{
- if(munmap(to, size) < 0){
- return(-1);
- }
- if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
- return(-1);
- }
- if(munmap(from, size) < 0){
- return(-1);
- }
- return(0);
-}
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only. This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
Index: linux-2.6.12-rc/arch/um/kernel/uml.lds.S
===================================================================
--- linux-2.6.12-rc.orig/arch/um/kernel/uml.lds.S 2005-06-02 17:04:01.000000000 -0400
+++ linux-2.6.12-rc/arch/um/kernel/uml.lds.S 2005-06-06 11:52:10.000000000 -0400
@@ -15,20 +15,7 @@ SECTIONS
* is remapped.*/
__binary_start = .;
#ifdef MODE_TT
- .thread_private : {
- __start_thread_private = .;
- errno = .;
- . += 4;
- arch/um/kernel/tt/unmap_fin.o (.data)
- __end_thread_private = .;
- }
- . = ALIGN(4096);
- .remap : { arch/um/kernel/tt/unmap_fin.o (.text) }
-
- /* We want it only if we are in MODE_TT. In both cases, however, when MODE_TT
- * is off the resulting binary segfaults.*/
-
- . = ALIGN(4096); /* Init code and data */
+#include <unmap.lds>
#endif
_stext = .;
Index: linux-2.6.12-rc/arch/um/scripts/Makefile.rules
===================================================================
--- linux-2.6.12-rc.orig/arch/um/scripts/Makefile.rules 2005-06-06 12:14:26.000000000 -0400
+++ linux-2.6.12-rc/arch/um/scripts/Makefile.rules 2005-06-06 12:15:45.000000000 -0400
@@ -10,6 +10,11 @@ USER_OBJS := $(foreach file,$(USER_OBJS)
$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
$(CFLAGS_$(notdir $@))
+# 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
+
quiet_cmd_make_link = SYMLINK $@
cmd_make_link = ln -sf $(srctree)/arch/$(SUBARCH)/$($(notdir $@)-dir)/$(notdir $@) $@
Index: linux-2.6.12-rc/arch/um/sys-i386/Makefile
===================================================================
--- linux-2.6.12-rc.orig/arch/um/sys-i386/Makefile 2005-06-02 17:04:01.000000000 -0400
+++ linux-2.6.12-rc/arch/um/sys-i386/Makefile 2005-06-06 11:52:10.000000000 -0400
@@ -2,6 +2,8 @@ obj-y = bitops.o bugs.o checksum.o delay
ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \
sys_call_table.o
+extra-$(CONFIG_MODE_TT) := unmap_fin.o
+
obj-$(CONFIG_HIGHMEM) += highmem.o
obj-$(CONFIG_MODULES) += module.o
@@ -16,4 +18,6 @@ semaphore.c-dir = kernel
highmem.c-dir = mm
module.c-dir = kernel
+$(obj)/unmap_fin.o : _c_flags = $(call unprofile,$(CFLAGS))
+
subdir- := util
Index: linux-2.6.12-rc/arch/um/sys-i386/unmap_fin.c
===================================================================
--- linux-2.6.12-rc.orig/arch/um/sys-i386/unmap_fin.c 2005-06-06 05:54:35.815704808 -0400
+++ linux-2.6.12-rc/arch/um/sys-i386/unmap_fin.c 2005-06-03 15:36:17.000000000 -0400
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#include <linux/mman.h>
+#include <asm/unistd.h>
+
+static int errno;
+
+static inline _syscall2(int,munmap,void *,start,size_t,len)
+static inline _syscall6(void *,mmap2,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
+int switcheroo(int fd, int prot, void *from, void *to, int size)
+{
+ if(munmap(to, size) < 0){
+ return(-1);
+ }
+ if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
+ return(-1);
+ }
+ if(munmap(from, size) < 0){
+ return(-1);
+ }
+ return(0);
+}
Index: linux-2.6.12-rc/arch/um/sys-x86_64/Makefile
===================================================================
--- linux-2.6.12-rc.orig/arch/um/sys-x86_64/Makefile 2005-06-02 17:04:01.000000000 -0400
+++ linux-2.6.12-rc/arch/um/sys-x86_64/Makefile 2005-06-06 11:52:10.000000000 -0400
@@ -4,6 +4,8 @@
# Licensed under the GPL
#
+extra-$(CONFIG_MODE_TT) := unmap_fin.o
+
#XXX: why into lib-y?
lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
@@ -29,3 +31,5 @@ thunk.S-dir = lib
module.c-dir = kernel
subdir- := util
+
+$(obj)/unmap_fin.o: _c_flags = $(call unprofile,$(CFLAGS))
Index: linux-2.6.12-rc/arch/um/sys-x86_64/unmap_fin.c
===================================================================
--- linux-2.6.12-rc.orig/arch/um/sys-x86_64/unmap_fin.c 2005-06-06 05:54:35.815704808 -0400
+++ linux-2.6.12-rc/arch/um/sys-x86_64/unmap_fin.c 2005-06-02 17:04:44.000000000 -0400
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#include <linux/mman.h>
+#include <asm/unistd.h>
+
+static int errno;
+
+static inline _syscall2(int,munmap,void *,start,size_t,len)
+static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
+int switcheroo(int fd, int prot, void *from, void *to, int size)
+{
+ if(munmap(to, size) < 0){
+ return(-1);
+ }
+ if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
+ return(-1);
+ }
+ if(munmap(from, size) < 0){
+ return(-1);
+ }
+ return(0);
+}
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-06 20:08 [PATCH 3/5] UML - Clean up tt mode remapping of UML binary Jeff Dike @ 2005-06-06 23:05 ` Blaisorblade 2005-06-06 23:53 ` Al Viro 2005-06-07 0:40 ` Jeff Dike 0 siblings, 2 replies; 9+ messages in thread From: Blaisorblade @ 2005-06-06 23:05 UTC (permalink / raw) To: user-mode-linux-devel, Al Viro; +Cc: Jeff Dike, akpm, torvalds, linux-kernel On Monday 06 June 2005 22:08, Jeff Dike wrote: > From Al Viro - this turns the tt mode remapping of the binary into arch > code. NACK at all, definitely, don't apply this one please. This patch: 1) On i386 does not fix the problem it was supposed to fix when I originately sent the first version (i.e. avoiding to create a .thread_private section to allow linking against NPTL glibc). It's done on x86_64 and forgot on i386. 2) Splitting the linker script for subarchs is definitely not needed. 3) This removes the fix (done through objcopy -G switcheroo) to a link time conflict happening on some weird glibc combinations. I'll merge this work when it's ready. > Signed-off-by: Jeff Dike <jdike@addtoit.com> -- 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 ___________________________________ Yahoo! Messenger: chiamate gratuite in tutto il mondo http://it.beta.messenger.yahoo.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-06 23:05 ` [uml-devel] " Blaisorblade @ 2005-06-06 23:53 ` Al Viro 2005-06-07 0:56 ` Blaisorblade 2005-06-07 0:40 ` Jeff Dike 1 sibling, 1 reply; 9+ messages in thread From: Al Viro @ 2005-06-06 23:53 UTC (permalink / raw) To: Blaisorblade Cc: user-mode-linux-devel, Jeff Dike, akpm, torvalds, linux-kernel On Tue, Jun 07, 2005 at 01:05:19AM +0200, Blaisorblade wrote: > On Monday 06 June 2005 22:08, Jeff Dike wrote: > > From Al Viro - this turns the tt mode remapping of the binary into arch > > code. > NACK at all, definitely, don't apply this one please. This patch: > > 1) On i386 does not fix the problem it was supposed to fix when I originately > sent the first version (i.e. avoiding to create a .thread_private section to > allow linking against NPTL glibc). It's done on x86_64 and forgot on i386. True. i386 still assumes non-NPTL (as it is on the box I'm working on - such setups *do* exist). > 2) Splitting the linker script for subarchs is definitely not needed. Per-subarch - perhaps not. Per-glibc-type - definitely needed. > 3) This removes the fix (done through objcopy -G switcheroo) to a link time > conflict happening on some weird glibc combinations. *What* link-time conflict? We don't link libc into switcheroo anymore. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-06 23:53 ` Al Viro @ 2005-06-07 0:56 ` Blaisorblade 2005-06-07 0:59 ` Al Viro 0 siblings, 1 reply; 9+ messages in thread From: Blaisorblade @ 2005-06-07 0:56 UTC (permalink / raw) To: user-mode-linux-devel; +Cc: Al Viro, Jeff Dike, akpm, torvalds, linux-kernel On Tuesday 07 June 2005 01:53, Al Viro wrote: > On Tue, Jun 07, 2005 at 01:05:19AM +0200, Blaisorblade wrote: > > On Monday 06 June 2005 22:08, Jeff Dike wrote: > > > From Al Viro - this turns the tt mode remapping of the binary into arch > > > code. > > > > NACK at all, definitely, don't apply this one please. This patch: > > > > 1) On i386 does not fix the problem it was supposed to fix when I > > originately sent the first version (i.e. avoiding to create a > > .thread_private section to allow linking against NPTL glibc). It's done > > on x86_64 and forgot on i386. > > True. i386 still assumes non-NPTL (as it is on the box I'm working on - > such setups *do* exist). Yes, it's the most common one, and it's even the setup for my box currently. > > 2) Splitting the linker script for subarchs is definitely not needed. > > Per-subarch - perhaps not. Per-glibc-type - definitely needed. No, because the setup for NPTL glibc works also on non-NPTL one. Actually, to be exact, I've tested it *only* on normal glibc. I'm still waiting to get some testing in NPTL environments, but I expect it to work. > > 3) This removes the fix (done through objcopy -G switcheroo) to a link > > time conflict happening on some weird glibc combinations. > *What* link-time conflict? We don't link libc into switcheroo anymore. Hmm, yes, I noted this... and maybe it could even be good (it makes sense, at least). Probably you are right on this, too. P.S: is it only me or you've sent about 20 copies of your last message? -- 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 ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-07 0:56 ` Blaisorblade @ 2005-06-07 0:59 ` Al Viro 2005-06-07 1:18 ` Blaisorblade 2005-06-07 2:00 ` Jeff Dike 0 siblings, 2 replies; 9+ messages in thread From: Al Viro @ 2005-06-07 0:59 UTC (permalink / raw) To: Blaisorblade Cc: user-mode-linux-devel, Jeff Dike, akpm, torvalds, linux-kernel On Tue, Jun 07, 2005 at 02:56:36AM +0200, Blaisorblade wrote: > > Per-subarch - perhaps not. Per-glibc-type - definitely needed. > No, because the setup for NPTL glibc works also on non-NPTL one. Actually, to > be exact, I've tested it *only* on normal glibc. I'm still waiting to get > some testing in NPTL environments, but I expect it to work. Now, that is interesting. Which script are you using for i386 and which libc version does it work with? > P.S: is it only me or you've sent about 20 copies of your last message? Headers? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-07 0:59 ` Al Viro @ 2005-06-07 1:18 ` Blaisorblade 2005-06-07 3:46 ` Rob Landley 2005-06-07 2:00 ` Jeff Dike 1 sibling, 1 reply; 9+ messages in thread From: Blaisorblade @ 2005-06-07 1:18 UTC (permalink / raw) To: user-mode-linux-devel; +Cc: Al Viro, Jeff Dike, akpm, torvalds, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1266 bytes --] On Tuesday 07 June 2005 02:59, Al Viro wrote: > On Tue, Jun 07, 2005 at 02:56:36AM +0200, Blaisorblade wrote: > > > Per-subarch - perhaps not. Per-glibc-type - definitely needed. > > > > No, because the setup for NPTL glibc works also on non-NPTL one. > > Actually, to be exact, I've tested it *only* on normal glibc. I'm still > > waiting to get some testing in NPTL environments, but I expect it to > > work. > > Now, that is interesting. Which script are you using for i386 and which > libc version does it work with? The one I sent originally didn't work because I had been lazy (used .data instead of .bss), but only for that. Well, there were another zillion of problems, but now it works. > > P.S: is it only me or you've sent about 20 copies of your last message? > > Headers? The Message-ID seem to match, so guess it's my Kmail (never seen such a problem, though). Message-ID: <20050606235321.GJ29811@parcelfarce.linux.theplanet.co.uk> References: <200506062008.j56K89YA008957@ccure.user-mode-linux.org> <200506070105.20422.blaisorblade@yahoo.it> -- 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 [-- Attachment #2: uml-link-tt-mode-against-nptl.patch --] [-- Type: text/x-diff, Size: 9200 bytes --] From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>, Al Viro <viro@parcelfarce.linux.theplanet.co.uk> To make sure switcheroo() can execute when we remap all the executable image, we used a trick to make it use a local copy of errno... this trick does not work with NPTL glibc, only with LinuxThreads, so use another (simpler) one to make it work anyway. Hopefully, a lot improved thanks to merging with the version of Al Viro (which had his part of problems, though, i.e. removing a fix to another bug and not fixing the problem on i386). Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> --- linux-2.6.git-paolo/arch/um/Makefile | 2 - linux-2.6.git-paolo/arch/um/kernel/tt/Makefile | 15 ---------- linux-2.6.git-paolo/arch/um/kernel/uml.lds.S | 15 ++-------- linux-2.6.git-paolo/arch/um/scripts/Makefile.rules | 6 ++++ linux-2.6.git-paolo/arch/um/scripts/Makefile.unmap | 22 ++++++++++++++ linux-2.6.git-paolo/arch/um/sys-i386/Makefile | 2 + linux-2.6.git-paolo/arch/um/sys-i386/unmap.c | 25 ++++++++++++++++ linux-2.6.git-paolo/arch/um/sys-x86_64/Makefile | 2 + linux-2.6.git-paolo/arch/um/sys-x86_64/unmap.c | 25 ++++++++++++++++ linux-2.6.git/arch/um/kernel/tt/unmap.c | 31 --------------------- 10 files changed, 86 insertions(+), 59 deletions(-) diff -L arch/um/kernel/tt/unmap.c -puN arch/um/kernel/tt/unmap.c~uml-link-tt-mode-against-nptl /dev/null --- linux-2.6.git/arch/um/kernel/tt/unmap.c +++ /dev/null 2005-03-04 21:12:55.000000000 +0100 @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) - * Licensed under the GPL - */ - -#include <sys/mman.h> - -int switcheroo(int fd, int prot, void *from, void *to, int size) -{ - if(munmap(to, size) < 0){ - return(-1); - } - if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ - return(-1); - } - if(munmap(from, size) < 0){ - return(-1); - } - return(0); -} - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff -puN arch/um/kernel/uml.lds.S~uml-link-tt-mode-against-nptl arch/um/kernel/uml.lds.S --- linux-2.6.git/arch/um/kernel/uml.lds.S~uml-link-tt-mode-against-nptl 2005-06-07 02:48:03.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/kernel/uml.lds.S 2005-06-07 02:48:03.000000000 +0200 @@ -14,19 +14,10 @@ SECTIONS /* Used in arch/um/kernel/mem.c. Any memory between START and __binary_start * is remapped.*/ __binary_start = .; -#ifdef MODE_TT - .thread_private : { - __start_thread_private = .; - errno = .; - . += 4; - arch/um/kernel/tt/unmap_fin.o (.data) - __end_thread_private = .; - } - . = ALIGN(4096); - .remap : { arch/um/kernel/tt/unmap_fin.o (.text) } - /* We want it only if we are in MODE_TT. In both cases, however, when MODE_TT - * is off the resulting binary segfaults.*/ +#ifdef MODE_TT + .remap_data : { arch/um/sys-SUBARCH/unmap_fin.o (.data .bss) } + .remap : { arch/um/sys-SUBARCH/unmap_fin.o (.text) } . = ALIGN(4096); /* Init code and data */ #endif diff -puN /dev/null arch/um/sys-i386/unmap.c --- /dev/null 2005-03-04 21:12:55.000000000 +0100 +++ linux-2.6.git-paolo/arch/um/sys-i386/unmap.c 2005-06-07 02:48:03.000000000 +0200 @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#include <linux/mman.h> +#include <asm/unistd.h> + +static int errno; + +static inline _syscall2(int,munmap,void *,start,size_t,len) +static inline _syscall6(void *,mmap2,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset) +int switcheroo(int fd, int prot, void *from, void *to, int size) +{ + if(munmap(to, size) < 0){ + return(-1); + } + if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ + return(-1); + } + if(munmap(from, size) < 0){ + return(-1); + } + return(0); +} diff -puN /dev/null arch/um/sys-x86_64/unmap.c --- /dev/null 2005-03-04 21:12:55.000000000 +0100 +++ linux-2.6.git-paolo/arch/um/sys-x86_64/unmap.c 2005-06-07 02:48:03.000000000 +0200 @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#include <linux/mman.h> +#include <asm/unistd.h> + +static int errno; + +static inline _syscall2(int,munmap,void *,start,size_t,len) +static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset) +int switcheroo(int fd, int prot, void *from, void *to, int size) +{ + if(munmap(to, size) < 0){ + return(-1); + } + if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ + return(-1); + } + if(munmap(from, size) < 0){ + return(-1); + } + return(0); +} diff -puN arch/um/kernel/tt/Makefile~uml-link-tt-mode-against-nptl arch/um/kernel/tt/Makefile --- linux-2.6.git/arch/um/kernel/tt/Makefile~uml-link-tt-mode-against-nptl 2005-06-07 02:48:03.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/kernel/tt/Makefile 2005-06-07 02:48:03.000000000 +0200 @@ -3,10 +3,6 @@ # Licensed under the GPL # -extra-y := unmap_fin.o -targets := unmap.o -clean-files := unmap_tmp.o - obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \ syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \ uaccess.o uaccess_user.o @@ -16,14 +12,3 @@ obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptp USER_OBJS := gdb.o time.o tracer.o include arch/um/scripts/Makefile.rules - -UNMAP_CFLAGS := $(patsubst -pg -DPROFILING,,$(USER_CFLAGS)) -UNMAP_CFLAGS := $(patsubst -fprofile-arcs -ftest-coverage,,$(UNMAP_CFLAGS)) - -#XXX: partially copied from arch/um/scripts/Makefile.rules -$(obj)/unmap.o: c_flags = -Wp,-MD,$(depfile) $(UNMAP_CFLAGS) - -$(obj)/unmap_fin.o : $(obj)/unmap.o - $(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a) - $(OBJCOPY) $(obj)/unmap_tmp.o $@ -G switcheroo - diff -puN arch/um/sys-i386/Makefile~uml-link-tt-mode-against-nptl arch/um/sys-i386/Makefile --- linux-2.6.git/arch/um/sys-i386/Makefile~uml-link-tt-mode-against-nptl 2005-06-07 02:48:03.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/sys-i386/Makefile 2005-06-07 02:48:03.000000000 +0200 @@ -17,3 +17,5 @@ highmem.c-dir = mm module.c-dir = kernel subdir- := util + +include arch/um/scripts/Makefile.unmap diff -puN arch/um/sys-x86_64/Makefile~uml-link-tt-mode-against-nptl arch/um/sys-x86_64/Makefile --- linux-2.6.git/arch/um/sys-x86_64/Makefile~uml-link-tt-mode-against-nptl 2005-06-07 02:48:03.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/sys-x86_64/Makefile 2005-06-07 02:48:03.000000000 +0200 @@ -29,3 +29,5 @@ thunk.S-dir = lib module.c-dir = kernel subdir- := util + +include arch/um/scripts/Makefile.unmap diff -puN /dev/null arch/um/scripts/Makefile.unmap --- /dev/null 2005-03-04 21:12:55.000000000 +0100 +++ linux-2.6.git-paolo/arch/um/scripts/Makefile.unmap 2005-06-07 03:05:56.000000000 +0200 @@ -0,0 +1,22 @@ +clean-files += unmap_tmp.o unmap_fin.o unmap.o + +ifdef CONFIG_MODE_TT + +#Always build unmap_fin.o +extra-y += unmap_fin.o +#Do dependency tracking for unmap.o (it will be always built, but won't get the tracking unless we use this). +targets += unmap.o + +#XXX: partially copied from arch/um/scripts/Makefile.rules +$(obj)/unmap.o: _c_flags = $(call unprofile,$(CFLAGS)) + +quiet_cmd_wrapld = LD $@ +define cmd_wrapld + $(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a); \ + $(OBJCOPY) $(obj)/unmap_tmp.o $@ -G switcheroo +endef + +$(obj)/unmap_fin.o : $(obj)/unmap.o FORCE + $(call if_changed,wrapld) + +endif diff -puN arch/um/Makefile~uml-link-tt-mode-against-nptl arch/um/Makefile --- linux-2.6.git/arch/um/Makefile~uml-link-tt-mode-against-nptl 2005-06-07 02:48:03.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/Makefile 2005-06-07 02:48:03.000000000 +0200 @@ -118,7 +118,7 @@ endif CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE-y) \ - -DKERNEL_STACK_SIZE=$(STACK_SIZE)) + -DKERNEL_STACK_SIZE=$(STACK_SIZE) -DSUBARCH=$(SUBARCH)) #The wrappers will select whether using "malloc" or the kernel allocator. LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc diff -puN arch/um/scripts/Makefile.rules~uml-link-tt-mode-against-nptl arch/um/scripts/Makefile.rules --- linux-2.6.git/arch/um/scripts/Makefile.rules~uml-link-tt-mode-against-nptl 2005-06-07 03:03:42.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/scripts/Makefile.rules 2005-06-07 03:08:55.000000000 +0200 @@ -10,6 +10,12 @@ USER_OBJS := $(foreach file,$(USER_OBJS) $(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ $(CFLAGS_$(notdir $@)) +# 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 + + quiet_cmd_make_link = SYMLINK $@ cmd_make_link = ln -sf $(srctree)/arch/$(SUBARCH)/$($(notdir $@)-dir)/$(notdir $@) $@ _ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-07 1:18 ` Blaisorblade @ 2005-06-07 3:46 ` Rob Landley 0 siblings, 0 replies; 9+ messages in thread From: Rob Landley @ 2005-06-07 3:46 UTC (permalink / raw) To: user-mode-linux-devel; +Cc: Blaisorblade, Al Viro, Jeff Dike, linux-kernel On Monday 06 June 2005 09:18 pm, Blaisorblade wrote: > > > P.S: is it only me or you've sent about 20 copies of your last message? > > > > Headers? > > The Message-ID seem to match, so guess it's my Kmail (never seen such a > problem, though). > > Message-ID: <20050606235321.GJ29811@parcelfarce.linux.theplanet.co.uk> > References: <200506062008.j56K89YA008957@ccure.user-mode-linux.org> > <200506070105.20422.blaisorblade@yahoo.it> I got about 20 copies of that message too. There's some kind of loop going through Intel's servers, the message headers are progressively longer variants of: Return-Path: <user-mode-linux-devel-admin@lists.sourceforge.net> Received: from lists-outbound.sourceforge.net (lists-outbound.sourceforge.net [66.35.250.225]) by grelber.thyrsus.com (8.13.1/8.13.1) with ESMTP id j5727DMt031684 for <rob@landley.net>; Mon, 6 Jun 2005 22:07:13 -0400 Received: from projects.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7]) by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP id 2E0C5E4AF; Mon, 6 Jun 2005 17:46:15 -0700 (PDT) Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.12] helo=sc8-sf-mx2.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1DfSDQ-0007UB-Rp for user-mode-linux-devel@lists.sourceforge.net; Mon, 06 Jun 2005 17:45:12 -0700 Received: from fmr19.intel.com ([134.134.136.18] helo=orsfmr004.jf.intel.com) by sc8-sf-mx2.sourceforge.net with esmtp (Exim 4.41) id 1DfSDO-0003gl-Il for user-mode-linux-devel@lists.sourceforge.net; Mon, 06 Jun 2005 17:45:12 -0700 Received: from orsfmr101.jf.intel.com (orsfmr101.jf.intel.com [10.7.209.17]) by orsfmr004.jf.intel.com (8.12.10/8.12.10/d: major-outer.mc,v 1.1 2004/09/17 17:50:56 root Exp $) with ESMTP id j570j4TU027763; Tue, 7 Jun 2005 00:45:04 GMT Received: from orsmsxvs041.jf.intel.com (orsmsxvs041.jf.intel.com [192.168.65.54]) by orsfmr101.jf.intel.com (8.12.10/8.12.10/d: major-inner.mc,v 1.2 2004/09/17 18:05:01 root Exp $) with SMTP id j570dvQF011113; Tue, 7 Jun 2005 00:44:50 GMT Received: from orsmsx332.amr.corp.intel.com ([192.168.65.60]) by orsmsxvs041.jf.intel.com (SAVSMTP 3.1.7.47) with SMTP id M2005060617432614357 ; Mon, 06 Jun 2005 17:43:35 -0700 Received: from mail pickup service by orsmsx332.amr.corp.intel.com with Microsoft SMTPSVC; Mon, 6 Jun 2005 17:38:55 -0700 Received: from orsmsxvs040.jf.intel.com ([192.168.65.206]) by orsmsx332.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 6 Jun 2005 17:11:03 -0700 Received: from orsfmr100.jf.intel.com ([10.7.209.16]) by orsmsxvs040.jf.intel.com (SAVSMTP 3.1.7.47) with SMTP id M2005060617110225137 for <tom.l.nguyen@intel.com>; Mon, 06 Jun 2005 17:11:02 -0700 Received: from orsfmr004.jf.intel.com (orsfmr004.jf.intel.com [10.7.208.20]) by orsfmr100.jf.intel.com (8.12.10/8.12.10/d: major-inner.mc,v 1.2 2004/09/17 18:05:01 root Exp $) with ESMTP id j570B2qr012945 for <tom.l.nguyen@intel.com>; Tue, 7 Jun 2005 00:11:02 GMT Received: from vger.kernel.org (vger.kernel.org [12.107.209.244]) by orsfmr004.jf.intel.com (8.12.10/8.12.10/d: major-outer.mc,v 1.1 2004/09/17 17:50:56 root Exp $) with ESMTP id j570AlTr014175 for <tom.l.nguyen@intel.com>; Tue, 7 Jun 2005 00:11:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261787AbVFGABn (ORCPT <rfc822;tom.l.nguyen@intel.com>); Mon, 6 Jun 2005 20:01:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261788AbVFFX5w (ORCPT <rfc822;linux-kernel-outgoing>); Mon, 6 Jun 2005 19:57:52 -0400 Received: from parcelfarce.linux.theplanet.co.uk ([195.92.249.252]:56209 "EHLO parcelfarce.linux.theplanet.co.uk") by vger.kernel.org with ESMTP id S261778AbVFFXwe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Jun 2005 19:52:34 -0400 Received: from viro by parcelfarce.linux.theplanet.co.uk with local (Exim 4.43) id 1DfRPF-0002v4-Sq; Tue, 07 Jun 2005 00:53:21 +0100 From: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Rob ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-07 0:59 ` Al Viro 2005-06-07 1:18 ` Blaisorblade @ 2005-06-07 2:00 ` Jeff Dike 1 sibling, 0 replies; 9+ messages in thread From: Jeff Dike @ 2005-06-07 2:00 UTC (permalink / raw) To: Al Viro; +Cc: Blaisorblade, user-mode-linux-devel, linux-kernel On Tue, Jun 07, 2005 at 01:59:58AM +0100, Al Viro wrote: > > P.S: is it only me or you've sent about 20 copies of your last message? > > Headers? I got 18 copies. Something horrible happened at Intel: Received: from orsfmr005.jf.intel.com (fmr20.intel.com [134.134.136.19]) by saraswathi.solana.com (8.13.1/8.13.1) with ESMTP id j570cDAU017960 for <jdike@addtoit.com>; Mon, 6 Jun 2005 20:38:18 -0400 Received: from orsfmr101.jf.intel.com (orsfmr101.jf.intel.com [10.7.209.17]) by orsfmr005.jf.intel.com (8.12.10/8.12.10/d: major-outer.mc,v 1.1 +2004/09/17 17:50:56 root Exp $) with ESMTP id j570c60S009128; Tue, 7 Jun 2005 00:38:06 GMT Received: from orsmsxvs041.jf.intel.com (orsmsxvs041.jf.intel.com +[192.168.65.54]) by orsfmr101.jf.intel.com (8.12.10/8.12.10/d: major-inner.mc,v 1.2 +2004/09/17 18:05:01 root Exp $) with SMTP id j570c6OK009846; Tue, 7 Jun 2005 00:38:06 GMT Received: from orsmsx332.amr.corp.intel.com ([192.168.65.60]) by orsmsxvs041.jf.intel.com (SAVSMTP 3.1.7.47) with SMTP id +M2005060617380513306 ; Mon, 06 Jun 2005 17:38:05 -0700 Received: from mail pickup service by orsmsx332.amr.corp.intel.com with +Microsoft SMTPSVC; Mon, 6 Jun 2005 17:38:04 -0700 Received: from orsmsxvs041.jf.intel.com ([192.168.65.54]) by +orsmsx332.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 6 Jun 2005 17:11:02 -0700 Received: from orsfmr100.jf.intel.com ([10.7.209.16]) by orsmsxvs041.jf.intel.com (SAVSMTP 3.1.7.47) with SMTP id +M2005060617110210382 for <suresh.b.siddha@intel.com>; Mon, 06 Jun 2005 17:11:02 -0700 Received: from orsfmr004.jf.intel.com (orsfmr004.jf.intel.com [10.7.208.20]) by orsfmr100.jf.intel.com (8.12.10/8.12.10/d: major-inner.mc,v 1.2 +2004/09/17 18:05:01 root Exp $) with ESMTP id j570B2qr012933 for <suresh.b.siddha@intel.com>; Tue, 7 Jun 2005 00:11:02 GMT Received: from vger.kernel.org (vger.kernel.org [12.107.209.244]) by orsfmr004.jf.intel.com (8.12.10/8.12.10/d: major-outer.mc,v 1.1 +2004/09/17 17:50:56 root Exp $) with ESMTP id j570AlTq014175 for <suresh.b.siddha@intel.com>; Tue, 7 Jun 2005 00:11:01 GMT This looks like it was intended for Suresh (hi!), but Intel forwarded it back to my server. The others are the same, except they involve different Intel people, some of whom I know, some I don't :-) Jeff ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [uml-devel] [PATCH 3/5] UML - Clean up tt mode remapping of UML binary 2005-06-06 23:05 ` [uml-devel] " Blaisorblade 2005-06-06 23:53 ` Al Viro @ 2005-06-07 0:40 ` Jeff Dike 1 sibling, 0 replies; 9+ messages in thread From: Jeff Dike @ 2005-06-07 0:40 UTC (permalink / raw) To: Blaisorblade; +Cc: user-mode-linux-devel, akpm, linux-kernel On Tue, Jun 07, 2005 at 01:05:19AM +0200, Blaisorblade wrote: > NACK at all, definitely, don't apply this one please. This patch: > > 1) On i386 does not fix the problem it was supposed to fix when I originately > sent the first version (i.e. avoiding to create a .thread_private section to > allow linking against NPTL glibc). It's done on x86_64 and forgot on i386. > 2) Splitting the linker script for subarchs is definitely not needed. > 3) This removes the fix (done through objcopy -G switcheroo) to a link time > conflict happening on some weird glibc combinations. > > I'll merge this work when it's ready. OK, Andrew, just drop this one for now. Jeff ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-06-07 4:51 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-06-06 20:08 [PATCH 3/5] UML - Clean up tt mode remapping of UML binary Jeff Dike 2005-06-06 23:05 ` [uml-devel] " Blaisorblade 2005-06-06 23:53 ` Al Viro 2005-06-07 0:56 ` Blaisorblade 2005-06-07 0:59 ` Al Viro 2005-06-07 1:18 ` Blaisorblade 2005-06-07 3:46 ` Rob Landley 2005-06-07 2:00 ` Jeff Dike 2005-06-07 0:40 ` Jeff Dike
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome