public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] UML: last patches for 2.6.15
@ 2005-12-29 16:38 Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 1/5] uml: fix random segfaults at bootup Paolo 'Blaisorblade' Giarrusso
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-29 16:38 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jeff Dike, linux-kernel, user-mode-linux-devel

Some last-minute fixes for 2.6.15 - please merge them, they've been tested
(more or less depending on the changes).

--
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

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

* [PATCH 1/5] uml: fix random segfaults at bootup
  2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
@ 2005-12-29 16:39 ` Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 2/5] Hostfs: remove unused var Paolo 'Blaisorblade' Giarrusso
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-29 16:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jeff Dike, linux-kernel, user-mode-linux-devel


Don't use printk() where "current_thread_info()" is crap.

Until when we switch to running on init_stack, current_thread_info() evaluates
to crap. Printk uses "current" at times (in detail, &current is evaluated with
CONFIG_DEBUG_SPINLOCK to check the spinlock owner task).

And this leads to random segmentation faults.

Exactly, what happens is that &current = *(current_thread_info()), i.e. round
down $esp and dereference the value. I.e. access the stack below $esp, which
causes SIGSEGV on a VM_GROWSDOWN vma (see arch/i386/mm/fault.c).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 arch/um/os-Linux/start_up.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 37517d4..29a9e3f 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -116,16 +116,16 @@ static int stop_ptraced_child(int pid, v
 	if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
 		int exit_with = WEXITSTATUS(status);
 		if (exit_with == 2)
-			printk("check_ptrace : child exited with status 2. "
+			printf("check_ptrace : child exited with status 2. "
 			       "Serious trouble happening! Try updating your "
 			       "host skas patch!\nDisabling SYSEMU support.");
-		printk("check_ptrace : child exited with exitcode %d, while "
+		printf("check_ptrace : child exited with exitcode %d, while "
 		      "expecting %d; status 0x%x", exit_with,
 		      exitcode, status);
 		if (mustpanic)
 			panic("\n");
 		else
-			printk("\n");
+			printf("\n");
 		ret = -1;
 	}
 
@@ -183,7 +183,7 @@ static void __init check_sysemu(void)
 	void *stack;
  	int pid, n, status, count=0;
 
-	printk("Checking syscall emulation patch for ptrace...");
+	printf("Checking syscall emulation patch for ptrace...");
 	sysemu_supported = 0;
 	pid = start_ptraced_child(&stack);
 
@@ -207,10 +207,10 @@ static void __init check_sysemu(void)
 		goto fail_stopped;
 
 	sysemu_supported = 1;
-	printk("OK\n");
+	printf("OK\n");
 	set_using_sysemu(!force_sysemu_disabled);
 
-	printk("Checking advanced syscall emulation patch for ptrace...");
+	printf("Checking advanced syscall emulation patch for ptrace...");
 	pid = start_ptraced_child(&stack);
 
 	if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -246,7 +246,7 @@ static void __init check_sysemu(void)
 		goto fail_stopped;
 
 	sysemu_supported = 2;
-	printk("OK\n");
+	printf("OK\n");
 
 	if ( !force_sysemu_disabled )
 		set_using_sysemu(sysemu_supported);
@@ -255,7 +255,7 @@ static void __init check_sysemu(void)
 fail:
 	stop_ptraced_child(pid, stack, 1, 0);
 fail_stopped:
-	printk("missing\n");
+	printf("missing\n");
 }
 
 static void __init check_ptrace(void)
@@ -263,7 +263,7 @@ static void __init check_ptrace(void)
 	void *stack;
 	int pid, syscall, n, status;
 
-	printk("Checking that ptrace can change system call numbers...");
+	printf("Checking that ptrace can change system call numbers...");
 	pid = start_ptraced_child(&stack);
 
 	if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
@@ -292,7 +292,7 @@ static void __init check_ptrace(void)
 		}
 	}
 	stop_ptraced_child(pid, stack, 0, 1);
-	printk("OK\n");
+	printf("OK\n");
 	check_sysemu();
 }
 
@@ -472,6 +472,8 @@ int can_do_skas(void)
 
 int have_devanon = 0;
 
+/* Runs on boot kernel stack - already safe to use printk. */
+
 void check_devanon(void)
 {
 	int fd;


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

* [PATCH 2/5] Hostfs: remove unused var
  2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 1/5] uml: fix random segfaults at bootup Paolo 'Blaisorblade' Giarrusso
@ 2005-12-29 16:39 ` Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 3/5] uml: hostfs - fix possible PAGE_CACHE_SHIFT overflows Paolo 'Blaisorblade' Giarrusso
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-29 16:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jeff Dike, linux-kernel, user-mode-linux-devel


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Trivial removal of unused variable from this file - doesn't even change the
generated assembly code, in fact (gcc should trigger a warning for unused value
here).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 fs/hostfs/hostfs_kern.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 4684eb7..3aac164 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -910,10 +910,8 @@ static struct inode_operations hostfs_di
 int hostfs_link_readpage(struct file *file, struct page *page)
 {
 	char *buffer, *name;
-	long long start;
 	int err;
 
-	start = page->index << PAGE_CACHE_SHIFT;
 	buffer = kmap(page);
 	name = inode_name(page->mapping->host, 0);
 	if(name == NULL) return(-ENOMEM);


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

* [PATCH 3/5] uml: hostfs - fix possible PAGE_CACHE_SHIFT overflows
  2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 1/5] uml: fix random segfaults at bootup Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 2/5] Hostfs: remove unused var Paolo 'Blaisorblade' Giarrusso
@ 2005-12-29 16:39 ` Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:39 ` [PATCH 4/5] Hostfs: update for new glibc - add missing symbol exports Paolo 'Blaisorblade' Giarrusso
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-29 16:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jeff Dike, linux-kernel, user-mode-linux-devel


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Prevent page->index << PAGE_CACHE_SHIFT from overflowing.

There is a casting there, but was added without care, so it's at the wrong
place. Note the extra parens around the shift - "+" is higher precedence than
"<<", leading to a GCC warning which saved all us.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 fs/hostfs/hostfs_kern.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 3aac164..b3ad0bd 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -501,11 +501,16 @@ int hostfs_commit_write(struct file *fil
 	long long start;
 	int err = 0;
 
-	start = (long long) (page->index << PAGE_CACHE_SHIFT) + from;
+	start = (((long long) page->index) << PAGE_CACHE_SHIFT) + from;
 	buffer = kmap(page);
 	err = write_file(FILE_HOSTFS_I(file)->fd, &start, buffer + from,
 			 to - from);
 	if(err > 0) err = 0;
+
+	/* Actually, if !err, write_file has added to-from to start, so, despite
+	 * the appearance, we are comparing i_size against the _last_ written
+	 * location, as we should. */
+
 	if(!err && (start > inode->i_size))
 		inode->i_size = start;
 


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

* [PATCH 4/5] Hostfs: update for new glibc - add missing symbol exports
  2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
                   ` (2 preceding siblings ...)
  2005-12-29 16:39 ` [PATCH 3/5] uml: hostfs - fix possible PAGE_CACHE_SHIFT overflows Paolo 'Blaisorblade' Giarrusso
@ 2005-12-29 16:39 ` Paolo 'Blaisorblade' Giarrusso
  2005-12-29 16:40 ` [PATCH 5/5] uml: fix compilation with CONFIG_MODE_TT disabled Paolo 'Blaisorblade' Giarrusso
  2005-12-29 20:25 ` [uml-devel] [PATCH 0/5] UML: last patches for 2.6.15 Jeff Dike
  5 siblings, 0 replies; 7+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-29 16:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jeff Dike, linux-kernel, user-mode-linux-devel


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Today, when compiling UML, I got warnings for two used unexported symbols:
readdir64 and truncate64. Indeed, my glibc headers are aliasing readdir to
readdir64 and truncate to truncate64 (and so on).

I'm then adding additional exports. Since I've no idea if the symbols where
always provided in the supported glibc's, I've added weak definitions too.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 arch/um/os-Linux/user_syms.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 56d3f87..8da6ab3 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -34,6 +34,11 @@ EXPORT_SYMBOL(strstr);
        int sym(void);                  \
        EXPORT_SYMBOL(sym);
 
+extern void readdir64(void) __attribute__((weak));
+EXPORT_SYMBOL(readdir64);
+extern void truncate64(void) __attribute__((weak));
+EXPORT_SYMBOL(truncate64);
+
 #ifdef SUBARCH_i386
 EXPORT_SYMBOL(vsyscall_ehdr);
 EXPORT_SYMBOL(vsyscall_end);


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

* [PATCH 5/5] uml: fix compilation with CONFIG_MODE_TT disabled
  2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
                   ` (3 preceding siblings ...)
  2005-12-29 16:39 ` [PATCH 4/5] Hostfs: update for new glibc - add missing symbol exports Paolo 'Blaisorblade' Giarrusso
@ 2005-12-29 16:40 ` Paolo 'Blaisorblade' Giarrusso
  2005-12-29 20:25 ` [uml-devel] [PATCH 0/5] UML: last patches for 2.6.15 Jeff Dike
  5 siblings, 0 replies; 7+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-29 16:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jeff Dike, linux-kernel, user-mode-linux-devel


Fix UML compilation when SKAS mode is disabled. Indeed, we were compiling
SKAS-only object files, which failed due to some SKAS-only headers being
excluded from the search path.

Thanks to the bug report from Pekka J Enberg.

Acked-by: Pekka J Enberg <penberg (at) cs ! helsinki ! fi>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 arch/um/sys-i386/Makefile   |    8 +++++---
 arch/um/sys-x86_64/Makefile |    5 +++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 150059d..f5fd5b0 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -1,6 +1,8 @@
-obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
-	ptrace_user.o semaphore.o signal.o sigcontext.o stub.o stub_segv.o \
-	syscalls.o sysrq.o sys_call_table.o
+obj-y := bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
+	ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \
+	sys_call_table.o
+
+obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
 
 obj-$(CONFIG_HIGHMEM) += highmem.o
 obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 00b2025..a351091 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -6,8 +6,9 @@
 
 #XXX: why into lib-y?
 lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o ldt.o mem.o memcpy.o \
-	ptrace.o ptrace_user.o sigcontext.o signal.o stub.o \
-	stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o
+	ptrace.o ptrace_user.o sigcontext.o signal.o syscalls.o \
+	syscall_table.o sysrq.o thunk.o
+lib-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
 
 obj-y := ksyms.o
 obj-$(CONFIG_MODULES) += module.o um_module.o


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

* Re: [uml-devel] [PATCH 0/5] UML: last patches for 2.6.15
  2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
                   ` (4 preceding siblings ...)
  2005-12-29 16:40 ` [PATCH 5/5] uml: fix compilation with CONFIG_MODE_TT disabled Paolo 'Blaisorblade' Giarrusso
@ 2005-12-29 20:25 ` Jeff Dike
  5 siblings, 0 replies; 7+ messages in thread
From: Jeff Dike @ 2005-12-29 20:25 UTC (permalink / raw)
  To: Paolo 'Blaisorblade' Giarrusso
  Cc: Linus Torvalds, linux-kernel, user-mode-linux-devel

On Thu, Dec 29, 2005 at 05:38:03PM +0100, Paolo 'Blaisorblade' Giarrusso wrote:
> Some last-minute fixes for 2.6.15 - please merge them, they've been tested
> (more or less depending on the changes).

Acked-by: Jeff Dike <jdike@addtoit.com>

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

end of thread, other threads:[~2005-12-29 19:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-29 16:38 [PATCH 0/5] UML: last patches for 2.6.15 Paolo 'Blaisorblade' Giarrusso
2005-12-29 16:39 ` [PATCH 1/5] uml: fix random segfaults at bootup Paolo 'Blaisorblade' Giarrusso
2005-12-29 16:39 ` [PATCH 2/5] Hostfs: remove unused var Paolo 'Blaisorblade' Giarrusso
2005-12-29 16:39 ` [PATCH 3/5] uml: hostfs - fix possible PAGE_CACHE_SHIFT overflows Paolo 'Blaisorblade' Giarrusso
2005-12-29 16:39 ` [PATCH 4/5] Hostfs: update for new glibc - add missing symbol exports Paolo 'Blaisorblade' Giarrusso
2005-12-29 16:40 ` [PATCH 5/5] uml: fix compilation with CONFIG_MODE_TT disabled Paolo 'Blaisorblade' Giarrusso
2005-12-29 20:25 ` [uml-devel] [PATCH 0/5] UML: last patches for 2.6.15 Jeff Dike

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