The attached patch is a (hacky) proposal, alternative to Jeff's 
fix-stub-syscall6, to fix the SKAS0 compilation problem.

In fact, Jeff's patch makes the problem appear on my system (where I never 
reproduced it).

I'm going to stick this in -bs2, as it makes kernels compiled for me work 
better. So please test compiling -bs2.

As an aside, I saw this code crashing at shutdown in TT mode, from 
fs/proc/array.c:do_task_stat() :

        if (mm) {
                vsize = task_vsize(mm);
                eip = KSTK_EIP(task);
                esp = KSTK_ESP(task);
        }

Went looking and guess what? There is full crap (starting from 2.6.14, due to 
the fixes for sysrq-t IIRC):

include/asm-um/processor-i386.h

#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP)
#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP)
#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP)

include/asm-um/processor-generic.h

#ifdef CONFIG_MODE_SKAS
#define KSTK_REG(tsk, reg) \
        ({ union uml_pt_regs regs; \
           get_thread_regs(&regs, tsk->thread.mode.skas.switch_buf); \
           UPT_REG(&regs, reg); })
#else
#define KSTK_REG(tsk, reg) (0xbadbabe)
#endif

I didn't fully realize the amount of crap in the patch when I reviewed it at 
that time (but I do remember complaining about 0xbadbabe rather than 
0xdeadbeef, so I'm guilty too).

I'll restore for TT mode the 2.6.13 content (which is wrong and kills sysrq-t, 
but is better than crap).

And there's no reason for letting TT mode bitrot so much, sorry. Making UML 
work for everybody, plus having a SMP testing mode, still means keeping it 
working.
-- 
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
Index: linux-2.6.14/arch/um/kernel/skas/clone.c
===================================================================
--- linux-2.6.14.orig/arch/um/kernel/skas/clone.c
+++ linux-2.6.14/arch/um/kernel/skas/clone.c
@@ -1,5 +1,6 @@
 #include <sched.h>
 #include <signal.h>
+#include <stddef.h>
 #include <sys/mman.h>
 #include <sys/time.h>
 #include <asm/unistd.h>
@@ -39,6 +40,10 @@ stub_clone_handler(void)
 			    from->fd, from->offset);
  out:
 	/* save current result. Parent: pid; child: retcode of mmap */
+#if defined(UML_CONFIG_UML_X86) && !defined(UML_CONFIG_64BIT)
+	__asm__("movl %0, %1": : "r" (err), "g" (*(long*) (UML_CONFIG_STUB_DATA + offsetof(struct stub_data, err))));
+#else
 	from->err = err;
+#endif
 	trap_myself();
 }

Reply via email to