Re: [Patch] arch/um/include/init.h: Fix missing macro definitions
On Thu, Jan 31, 2008 at 11:06:34PM +0800, WANG Cong wrote: > This patch fixed the following build error in current -git tree. > > arch/um/kernel/config.c:10: error: expected declaration specifiers or '...' > before '.' token > ... This is close to uml-arch-um-include-inith-needs-a-definition-of-__used.patch that's currently in -mm. Andrew, could you replace uml-arch-um-include-inith-needs-a-definition-of-__used.patch with the version below and push it to Linus? Jeff -- Work email - jdike at linux dot intel dot com init.h started breaking now for some reason. It turns out that there wasn't a definition of __used. Fixed this by copying the relevant stuff from compiler.h in the userspace case, and including compiler.h in the kernel case. >From WANG Cong <[EMAIL PROTECTED]> - added definition of __section Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Cc: WANG Cong <[EMAIL PROTECTED]> --- arch/um/include/init.h | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) Index: linux-2.6-git/arch/um/include/init.h === --- linux-2.6-git.orig/arch/um/include/init.h 2008-02-01 10:41:14.0 -0500 +++ linux-2.6-git/arch/um/include/init.h2008-02-01 10:52:34.0 -0500 @@ -40,6 +40,20 @@ typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); +#ifndef __KERNEL__ +#ifndef __section +# define __section(S) __attribute__ ((__section__(#S))) +#endif + +#if __GNUC_MINOR__ >= 3 +# define __used__attribute__((__used__)) +#else +# define __used__attribute__((__unused__)) +#endif + +#else +#include +#endif /* These are for everybody (although not all archs will actually discard it in modules) */ #define __init __section(.init.text) @@ -127,14 +141,3 @@ extern struct uml_param __uml_setup_star #endif #endif /* _LINUX_UML_INIT_H */ - -/* - * 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: - */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [git Patch] UML: a build error fix
On Thu, Jan 31, 2008 at 11:17:41PM +0800, WANG Cong wrote: > This patch fixed this error: > > arch/um/kernel/skas/syscall.c: In function 'handle_syscall': > arch/um/kernel/skas/syscall.c:33: error: 'NR_syscalls' undeclared (first use > in this function) That works, but I think doing things the way that i386 does them is cleaner. Andrew, can you stick the patch below into -mm and push it to Linus? Jeff -- Work email - jdike at linux dot intel dot com Redo the calculation of NR_syscalls since that disappeared from i386 and use a similar mechanism on x86_64. We now figure out the size of the system call table in arch code and stick that in syscall_table_size. arch/um/kernel/skas/syscall.c defines NR_syscalls in terms of that since its the only thing that needs to know how many system calls there are. The old mechananism that was used on x86_64 is gone. arch/um/include/sysdep-i386/syscalls.h got some formatting since I was looking at it. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Cc: WANG Cong <[EMAIL PROTECTED]> --- arch/um/include/sysdep-i386/syscalls.h |5 +++-- arch/um/include/sysdep-x86_64/kernel-offsets.h |9 - arch/um/include/sysdep-x86_64/syscalls.h |2 -- arch/um/kernel/skas/syscall.c |3 +++ arch/um/sys-i386/sys_call_table.S |5 + arch/um/sys-x86_64/syscall_table.c | 17 ++--- 6 files changed, 25 insertions(+), 16 deletions(-) Index: linux-2.6-git/arch/um/include/sysdep-x86_64/syscalls.h === --- linux-2.6-git.orig/arch/um/include/sysdep-x86_64/syscalls.h 2008-02-01 11:24:32.0 -0500 +++ linux-2.6-git/arch/um/include/sysdep-x86_64/syscalls.h 2008-02-01 11:47:51.0 -0500 @@ -30,6 +30,4 @@ extern long old_mmap(unsigned long addr, extern syscall_handler_t sys_modify_ldt; extern syscall_handler_t sys_arch_prctl; -#define NR_syscalls (UM_NR_syscall_max + 1) - #endif Index: linux-2.6-git/arch/um/kernel/skas/syscall.c === --- linux-2.6-git.orig/arch/um/kernel/skas/syscall.c2008-02-01 11:24:32.0 -0500 +++ linux-2.6-git/arch/um/kernel/skas/syscall.c 2008-02-01 11:48:02.0 -0500 @@ -9,6 +9,9 @@ #include "sysdep/ptrace.h" #include "sysdep/syscalls.h" +extern int syscall_table_size; +#define NR_syscalls (syscall_table_size / sizeof(void *)) + void handle_syscall(struct uml_pt_regs *r) { struct pt_regs *regs = container_of(r, struct pt_regs, regs); Index: linux-2.6-git/arch/um/sys-i386/sys_call_table.S === --- linux-2.6-git.orig/arch/um/sys-i386/sys_call_table.S2008-02-01 11:24:32.0 -0500 +++ linux-2.6-git/arch/um/sys-i386/sys_call_table.S 2008-02-01 12:08:17.0 -0500 @@ -9,4 +9,9 @@ #define old_mmap old_mmap_i386 +.section .rodata,"a" + #include "../../x86/kernel/syscall_table_32.S" + +ENTRY(syscall_table_size) +.long .-sys_call_table Index: linux-2.6-git/arch/um/include/sysdep-i386/syscalls.h === --- linux-2.6-git.orig/arch/um/include/sysdep-i386/syscalls.h 2007-11-28 13:01:17.0 -0500 +++ linux-2.6-git/arch/um/include/sysdep-i386/syscalls.h 2008-02-01 11:48:02.0 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000 Jeff Dike ([EMAIL PROTECTED]) + * Copyright (C) 2000 - 2008 Jeff Dike ([EMAIL PROTECTED],linux.intel}.com) * Licensed under the GPL */ @@ -18,7 +18,8 @@ extern syscall_handler_t old_mmap_i386; extern syscall_handler_t *sys_call_table[]; #define EXECUTE_SYSCALL(syscall, regs) \ - ((long (*)(struct syscall_args)) (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) + ((long (*)(struct syscall_args)) \ +(*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) extern long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, Index: linux-2.6-git/arch/um/include/sysdep-x86_64/kernel-offsets.h === --- linux-2.6-git.orig/arch/um/include/sysdep-x86_64/kernel-offsets.h 2007-12-03 23:56:34.0 -0500 +++ linux-2.6-git/arch/um/include/sysdep-x86_64/kernel-offsets.h 2008-02-01 11:48:01.0 -0500 @@ -17,16 +17,7 @@ #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)); -#define __NO_STUBS 1 -#undef __SYSCALL -#undef _ASM_X86_64_UNISTD_H_ -#define __SYSCALL(nr, sym) [nr] = 1, -static char syscalls[] = { -#include -}; - void foo(void) { #include -DEFINE(UM_NR_syscall_max, sizeof(syscalls) - 1); } Index: linux-2.6-git/arch/um/sys-x86_64/syscall_table.c =
Re: [-mm Patch] arch/um/kernel/initrd.c: fix a missed conversion specifier
On Wed, Feb 06, 2008 at 12:25:57AM +0800, WANG Cong wrote: > > Fix a missed conversion specifier of a printk in > arch/um/kernel/initrd.c. > > Signed-off-by: WANG Cong <[EMAIL PROTECTED]> > Cc: Jeff Dike <[EMAIL PROTECTED]> ACK - 2.6.25 material. Sigh. Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] uml: handle unusual results from find_tempdir.
On Tue, Feb 05, 2008 at 05:25:06PM +0100, Jim Meyering wrote: > > An alternative: make find_tempdir set tempdir to default_tempdir > upon malloc failure. > > * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. > Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. > > Signed-off-by: Jim Meyering <[EMAIL PROTECTED]> Thanks, I'll forward this on. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slob: fix linking for user mode linux
On Mon, Feb 11, 2008 at 02:44:21PM -0800, Christoph Lameter wrote: > UML defined its own external __kmalloc and things. Isnt there some other > way to fix it? I guess including slab.h is not possible here? This is definitely dubious code on my part and I wouldn't support Pekka's patch unless you're going to uninline __kmalloc for some other reason. The reason for this is that part of UML is userspace code, and thus can't use kernel headers. However, they do need some kernel interfaces in some form. That form has traditionally been little wrappers in the kernel side of UML which just call the kernel interface. In this case, there used to be um_kmalloc, which just called kmalloc. I've been trying to get rid of these stupid little helpers for a while, and this is what I ended up with for kmalloc. It would be an annoyance to reintroduce um_kmalloc, but that might be the best thing to do here. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] UML - Fix helper_wait calls in watchdog
From: Johann Felix Soden <[EMAIL PROTECTED]> In 1aa351a308d2c3ddb92b6cc45083fc54271d0010 the arguments of helper_wait() were changed. The adaptation of harddog_user.c was forgotten, so this errors occur: /arch/um/drivers/harddog_user.c: In function 'start_watchdog': /arch/um/drivers/harddog_user.c:82: error: too many arguments to function 'helper_wait' /arch/um/drivers/harddog_user.c:89: error: too many arguments to function 'helper_wait' Signed-off-by: Johann Felix Soden <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/drivers/harddog_user.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: linux-2.6.22/arch/um/drivers/harddog_user.c === --- linux-2.6.22.orig/arch/um/drivers/harddog_user.c2008-01-17 12:50:20.0 -0500 +++ linux-2.6.22/arch/um/drivers/harddog_user.c 2008-02-11 18:46:05.0 -0500 @@ -79,14 +79,14 @@ int start_watchdog(int *in_fd_ret, int * n = read(in_fds[0], &c, sizeof(c)); if (n == 0) { printk("harddog_open - EOF on watchdog pipe\n"); - helper_wait(pid, 1, NULL); + helper_wait(pid); err = -EIO; goto out_close_out; } else if (n < 0) { printk("harddog_open - read of watchdog pipe failed, " "err = %d\n", errno); - helper_wait(pid, 1, NULL); + helper_wait(pid); err = n; goto out_close_out; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] UML - Fix initrd printk
From: Johann Felix Soden <[EMAIL PROTECTED]> If the initrd file has zero-length, the error message should contain the filepath. Cc: WANG Cong <[EMAIL PROTECTED]> Signed-off-by: Johann Felix Soden <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/kernel/initrd.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Index: linux-2.6-git/arch/um/kernel/initrd.c === --- linux-2.6-git.orig/arch/um/kernel/initrd.c 2008-02-12 12:44:44.0 -0500 +++ linux-2.6-git/arch/um/kernel/initrd.c 2008-02-12 13:19:11.0 -0500 @@ -32,7 +32,7 @@ static int __init read_initrd(void) * ask for no memory. */ if (size == 0) { - printk(KERN_ERR "\"%\" is a zero-size initrd\n"); + printk(KERN_ERR "\"%s\" is a zero-size initrd\n", initrd); return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/4] UML - Four for 2.6.25
These should go to Linus - there are three build fixes and a serious bug fix. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] UML - Fix FP register corruption
Commit ee3d9bd4de1ed93d2a7ee41c331ed30a1c7b8acd, while greatly simplifying the kernel SIGSEGV handler that runs in the process address space, introduced a bug which corrupts FP state in the process. Previously, the SIGSEGV handler called the sigreturn system call by hand - it couldn't return through the restorer provided to it because that could try to call the libc restorer which likely wouldn't exist in the process address space. So, it blocked off some signals, including SIGUSR1, on entry to the SIGSEGV handler, queued a SIGUSR1 to itself, and invoked sigreturn. The SIGUSR1 was delivered, and was visible to the UML kernel after sigreturn finished. The commit eliminated the signal masking and the call to sigreturn. The handler simply hits itself with a SIGTRAP to let the UML kernel know that it is finished. UML then restores the process registers, which effectively longjmps the process out of the signal handler, skipping sigreturn's restoring of register state and the signal mask. The bug is that the host apparently sets used_fp to 0 when it saves the process FP state in the sigcontext on the process signal stack. Thus, when the process is longjmped out of the handler, its FP state is corrupt because it wasn't saved on the context switch to the UML kernel. This manifested itself as sleep hanging. For some reason, sleep uses floating point in order to calculate the sleep interval. When a page fault corrupts its FP state, it is faked into essentially sleeping forever. This patch saves the FP state before entering the SIGSEGV handler and restores it afterwards. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/include/registers.h |2 ++ arch/um/include/sysdep-i386/ptrace_user.h |3 +++ arch/um/include/sysdep-x86_64/ptrace_user.h |3 +++ arch/um/os-Linux/skas/process.c | 15 +++ arch/um/os-Linux/sys-i386/registers.c | 16 arch/um/os-Linux/sys-x86_64/registers.c | 10 ++ 6 files changed, 49 insertions(+) Index: linux-2.6-git/arch/um/include/sysdep-i386/ptrace_user.h === --- linux-2.6-git.orig/arch/um/include/sysdep-i386/ptrace_user.h 2008-02-12 13:18:59.0 -0500 +++ linux-2.6-git/arch/um/include/sysdep-i386/ptrace_user.h 2008-02-12 13:35:12.0 -0500 @@ -9,6 +9,7 @@ #include #include #include +#include "user_constants.h" #define PT_OFFSET(r) ((r) * sizeof(long)) @@ -40,6 +41,8 @@ #define PT_SP_OFFSET PT_OFFSET(UESP) #define PT_SP(regs) ((regs)[UESP]) +#define FP_SIZE ((HOST_XFP_SIZE > HOST_FP_SIZE) ? HOST_XFP_SIZE : HOST_FP_SIZE) + #ifndef FRAME_SIZE #define FRAME_SIZE (17) #endif Index: linux-2.6-git/arch/um/include/sysdep-x86_64/ptrace_user.h === --- linux-2.6-git.orig/arch/um/include/sysdep-x86_64/ptrace_user.h 2008-02-12 13:18:59.0 -0500 +++ linux-2.6-git/arch/um/include/sysdep-x86_64/ptrace_user.h 2008-02-12 13:35:12.0 -0500 @@ -12,6 +12,7 @@ #include #include #undef __FRAME_OFFSETS +#include "user_constants.h" #define PT_INDEX(off) ((off) / sizeof(unsigned long)) @@ -69,6 +70,8 @@ #define REGS_IP_INDEX PT_INDEX(RIP) #define REGS_SP_INDEX PT_INDEX(RSP) +#define FP_SIZE (HOST_FP_SIZE) + #endif /* Index: linux-2.6-git/arch/um/os-Linux/skas/process.c === --- linux-2.6-git.orig/arch/um/os-Linux/skas/process.c 2008-02-12 13:18:59.0 -0500 +++ linux-2.6-git/arch/um/os-Linux/skas/process.c 2008-02-12 13:37:02.0 -0500 @@ -115,6 +115,14 @@ void get_skas_faultinfo(int pid, struct sizeof(struct ptrace_faultinfo)); } else { + unsigned long fpregs[FP_SIZE]; + + err = get_fp_registers(pid, fpregs); + if (err < 0) { + printk(UM_KERN_ERR "save_fp_registers returned %d\n", + err); + fatal_sigsegv(); + } err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV); if (err) { printk(UM_KERN_ERR "Failed to continue stub, pid = %d, " @@ -128,6 +136,13 @@ void get_skas_faultinfo(int pid, struct * the stub stack page. We just have to copy it. */ memcpy(fi, (void *)current_stub_stack(), sizeof(*fi)); + + err = put_fp_registers(pid, fpregs); + if (err < 0) { + printk(UM_KERN_ERR "put_fp_registers returned %d\n", + err); + fatal_sigsegv(); + } } } Index: linux-2.6-git/arch/um/include/registers.h =
[PATCH 2/4] UML - Remove unused sigcontext accessors
The macros which extract registers from a struct sigcontext are no longer needed and can be removed. They are starting not to build anyway, given the removal of the 'e' and 'r' from register names during the x86 merge. Cc: Jiri Olsa <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/sys-i386/user-offsets.c | 27 --- arch/um/sys-x86_64/user-offsets.c | 28 2 files changed, 55 deletions(-) Index: linux-2.6.22/arch/um/sys-i386/user-offsets.c === --- linux-2.6.22.orig/arch/um/sys-i386/user-offsets.c 2007-11-14 10:33:29.0 -0500 +++ linux-2.6.22/arch/um/sys-i386/user-offsets.c2008-02-11 20:10:56.0 -0500 @@ -17,36 +17,9 @@ void foo(void) { - OFFSET(HOST_SC_IP, sigcontext, eip); - OFFSET(HOST_SC_SP, sigcontext, esp); - OFFSET(HOST_SC_FS, sigcontext, fs); - OFFSET(HOST_SC_GS, sigcontext, gs); - OFFSET(HOST_SC_DS, sigcontext, ds); - OFFSET(HOST_SC_ES, sigcontext, es); - OFFSET(HOST_SC_SS, sigcontext, ss); - OFFSET(HOST_SC_CS, sigcontext, cs); - OFFSET(HOST_SC_EFLAGS, sigcontext, eflags); - OFFSET(HOST_SC_EAX, sigcontext, eax); - OFFSET(HOST_SC_EBX, sigcontext, ebx); - OFFSET(HOST_SC_ECX, sigcontext, ecx); - OFFSET(HOST_SC_EDX, sigcontext, edx); - OFFSET(HOST_SC_EDI, sigcontext, edi); - OFFSET(HOST_SC_ESI, sigcontext, esi); - OFFSET(HOST_SC_EBP, sigcontext, ebp); OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); OFFSET(HOST_SC_ERR, sigcontext, err); OFFSET(HOST_SC_CR2, sigcontext, cr2); - OFFSET(HOST_SC_FPSTATE, sigcontext, fpstate); - OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask); - OFFSET(HOST_SC_FP_CW, _fpstate, cw); - OFFSET(HOST_SC_FP_SW, _fpstate, sw); - OFFSET(HOST_SC_FP_TAG, _fpstate, tag); - OFFSET(HOST_SC_FP_IPOFF, _fpstate, ipoff); - OFFSET(HOST_SC_FP_CSSEL, _fpstate, cssel); - OFFSET(HOST_SC_FP_DATAOFF, _fpstate, dataoff); - OFFSET(HOST_SC_FP_DATASEL, _fpstate, datasel); - OFFSET(HOST_SC_FP_ST, _fpstate, _st); - OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env); DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct)); Index: linux-2.6.22/arch/um/sys-x86_64/user-offsets.c === --- linux-2.6.22.orig/arch/um/sys-x86_64/user-offsets.c 2007-11-14 10:33:29.0 -0500 +++ linux-2.6.22/arch/um/sys-x86_64/user-offsets.c 2008-02-11 19:21:27.0 -0500 @@ -19,37 +19,9 @@ void foo(void) { - OFFSET(HOST_SC_RBX, sigcontext, rbx); - OFFSET(HOST_SC_RCX, sigcontext, rcx); - OFFSET(HOST_SC_RDX, sigcontext, rdx); - OFFSET(HOST_SC_RSI, sigcontext, rsi); - OFFSET(HOST_SC_RDI, sigcontext, rdi); - OFFSET(HOST_SC_RBP, sigcontext, rbp); - OFFSET(HOST_SC_RAX, sigcontext, rax); - OFFSET(HOST_SC_R8, sigcontext, r8); - OFFSET(HOST_SC_R9, sigcontext, r9); - OFFSET(HOST_SC_R10, sigcontext, r10); - OFFSET(HOST_SC_R11, sigcontext, r11); - OFFSET(HOST_SC_R12, sigcontext, r12); - OFFSET(HOST_SC_R13, sigcontext, r13); - OFFSET(HOST_SC_R14, sigcontext, r14); - OFFSET(HOST_SC_R15, sigcontext, r15); - OFFSET(HOST_SC_IP, sigcontext, rip); - OFFSET(HOST_SC_SP, sigcontext, rsp); OFFSET(HOST_SC_CR2, sigcontext, cr2); OFFSET(HOST_SC_ERR, sigcontext, err); OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); - OFFSET(HOST_SC_CS, sigcontext, cs); - OFFSET(HOST_SC_FS, sigcontext, fs); - OFFSET(HOST_SC_GS, sigcontext, gs); - OFFSET(HOST_SC_EFLAGS, sigcontext, eflags); - OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask); -#if 0 - OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax); - OFFSET(HOST_SC_DS, sigcontext, ds); - OFFSET(HOST_SC_ES, sigcontext, es); - OFFSET(HOST_SC_SS, sigcontext, ss); -#endif DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); DEFINE(HOST_XFP_SIZE, 0); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] asm-*/futex.h should include linux/uaccess.h
[ non-urgent - 2.6.26 material ] Lots of asm-*/futex.h call pagefault_enable and pagefault_disable, which are declared in linux/uaccess.h, without including linux/uaccess.h. They all include asm/uaccess.h, so this patch replaces asm/uaccess.h with linux/uaccess.h. Compile-tested on sparc64, x86, ia64, mips, and powerpc. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- include/asm-generic/futex.h |2 +- include/asm-ia64/futex.h|2 +- include/asm-mips/futex.h|2 +- include/asm-parisc/futex.h |2 +- include/asm-powerpc/futex.h |2 +- include/asm-sh/futex.h |2 +- include/asm-sparc64/futex.h |2 +- include/asm-x86/futex.h |2 +- 8 files changed, 8 insertions(+), 8 deletions(-) Index: linux-2.6.22/include/asm-generic/futex.h === --- linux-2.6.22.orig/include/asm-generic/futex.h 2008-02-12 12:47:49.0 -0500 +++ linux-2.6.22/include/asm-generic/futex.h2008-02-12 12:47:52.0 -0500 @@ -4,8 +4,8 @@ #ifdef __KERNEL__ #include +#include #include -#include static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) Index: linux-2.6.22/include/asm-ia64/futex.h === --- linux-2.6.22.orig/include/asm-ia64/futex.h 2007-07-08 19:32:17.0 -0400 +++ linux-2.6.22/include/asm-ia64/futex.h 2008-02-12 12:49:31.0 -0500 @@ -2,9 +2,9 @@ #define _ASM_FUTEX_H #include +#include #include #include -#include #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ do { \ Index: linux-2.6.22/include/asm-mips/futex.h === --- linux-2.6.22.orig/include/asm-mips/futex.h 2007-12-05 10:29:35.0 -0500 +++ linux-2.6.22/include/asm-mips/futex.h 2008-02-12 12:49:49.0 -0500 @@ -11,9 +11,9 @@ #ifdef __KERNEL__ #include +#include #include #include -#include #include #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ Index: linux-2.6.22/include/asm-parisc/futex.h === --- linux-2.6.22.orig/include/asm-parisc/futex.h2007-07-08 19:32:17.0 -0400 +++ linux-2.6.22/include/asm-parisc/futex.h 2008-02-12 12:50:03.0 -0500 @@ -4,8 +4,8 @@ #ifdef __KERNEL__ #include +#include #include -#include static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) Index: linux-2.6.22/include/asm-powerpc/futex.h === --- linux-2.6.22.orig/include/asm-powerpc/futex.h 2007-07-08 19:32:17.0 -0400 +++ linux-2.6.22/include/asm-powerpc/futex.h2008-02-12 12:50:22.0 -0500 @@ -4,9 +4,9 @@ #ifdef __KERNEL__ #include +#include #include #include -#include #include #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ Index: linux-2.6.22/include/asm-sh/futex.h === --- linux-2.6.22.orig/include/asm-sh/futex.h2007-10-12 12:07:06.0 -0400 +++ linux-2.6.22/include/asm-sh/futex.h 2008-02-12 12:51:17.0 -0500 @@ -4,8 +4,8 @@ #ifdef __KERNEL__ #include +#include #include -#include /* XXX: UP variants, fix for SH-4A and SMP.. */ #include Index: linux-2.6.22/include/asm-sparc64/futex.h === --- linux-2.6.22.orig/include/asm-sparc64/futex.h 2007-11-14 10:33:41.0 -0500 +++ linux-2.6.22/include/asm-sparc64/futex.h2008-02-12 12:51:35.0 -0500 @@ -2,9 +2,9 @@ #define _SPARC64_FUTEX_H #include +#include #include #include -#include #define __futex_cas_op(insn, ret, oldval, uaddr, oparg)\ __asm__ __volatile__( \ Index: linux-2.6.22/include/asm-x86/futex.h === --- linux-2.6.22.orig/include/asm-x86/futex.h 2008-02-05 12:25:21.0 -0500 +++ linux-2.6.22/include/asm-x86/futex.h2008-02-12 12:51:51.0 -0500 @@ -4,12 +4,12 @@ #ifdef __KERNEL__ #include +#include #include #include #include #include -#include #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg)\ __asm__ __volatile( \ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.24.2 won't compile UML
On Thu, Feb 14, 2008 at 12:13:09PM +0100, Ph. Marek wrote: > make -C linux-2.6.24.2/ O=output_path/build ARCH=um bzImage > make[2]: *** No rule to make target `bzImage'. Stop. This seems pretty clear, no? bzImage is a x86-ism. Just leave it off, and you'll get linux and vmlinux. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] [Patch] arch/um/kernel/um_arch.c: some small improvements
On Fri, Feb 15, 2008 at 10:07:42PM +0800, WANG Cong wrote: > > Make some small improvements for arch/um/kernel/um_arch.c. > > Signed-off-by: WANG Cong <[EMAIL PROTECTED]> > Cc: Jeff Dike <[EMAIL PROTECTED]> ACK Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.24-mm1 bugs
On Fri, Feb 15, 2008 at 12:43:45PM +0100, Miklos Szeredi wrote: > - UML doesn't boot: guest is 2.6.24-mm1 also, haven't tried any >other. Same guest boots fine on 2.6.24 host. What does it do? Any chance you can bisect it? Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.24-mm1 bugs
On Fri, Feb 15, 2008 at 08:52:04PM +0100, Miklos Szeredi wrote: > > What does it do? > > See below. > [0.42] Checking host MADV_REMOVE support...<3>MADV_REMOVE failed, err > = -38 Where'd MADV_REMOVE go? I have it on 2.6.24. > [0.42] Failed to get registers from stub, errno = 3 > [0.42] wait_stub_done : failed to wait for SIGTRAP, pid = 30073, n = > 30073, errno = 0, status = 0x0 Is utrace in there, by any chance? When I see crazy stuff like this, I think utrace. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH] Address spaces as independent objects
Below is a patch which allows address spaces to be created, manipulated, and destroyed independently of processes. The additions are two system calls, new_mm and switch_mm /proc//mm PTRACE_SWITCH_MM new_mm() returns a file descriptor referencing a new address space which is a copy of the current one. switch_mm(fd, save_regs, new_regs, ip, sp) switches the current process to the address space referenced by fd. If save_regs is non-NULL, then the current registers are saved there. It must be a userspace pointer that's valid in the current address space. If new_regs is non-NULL, the registers are restored from there. It must be a userspace pointer valid in the new address space. If new_regs is NULL, then ip and sp will be used to initialize the instruction pointer and stack pointer, respectively. Opening /proc//mm gives you a descriptor referencing the address space of the given process. If you are switching temporarily to another address space and want to come back to the current one, then you need to open /proc/self/mm and use that descriptor to return. PTRACE_SWITCH_MM takes a file descriptor in data and makes the child process switch to the address space referenced by it. If you're familiar with UML, you'll recognize this stuff as what's in the host SKAS3 patch, except with a different interface. The purpose behind this is to allow UML to run more efficiently. With this patch, plus a PTRACE_GETSIGINFO extension, I get kernel build performance in the 82% - 83% range compared to native on i386. Internal interface changes - I made some previously static functions global: dup_mm - address space duplication getreg, putreg, getreg32, putreg32 - save and restore process register state The guts of this are in mm/mmfs.c, which implements a little filesystem sitting behind /proc//mm and new_mm(). Architecture support is there for 32 and 64-bit x86 and 32 bit compat on 64-bit. I want this to go into mainline, so I'd like to see it take a spin in -mm during 2.6.24 and then go into 2.6.25 if there no major problems with it. TODO - The architecture support needs work Register saving and restoring should include the FP registers Need to add /proc//task/mm In order to play with this, you'll need either this patch, which is a rolled-up patch containing both host and guest support: http://marc.info/?l=user-mode-linux-devel&m=120223043225099&q=raw or this broken-out series, of which the patch below is number 7: http://marc.info/?l=user-mode-linux-devel&m=120223042625081&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223044925151&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223040825042&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223001024082&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223003824164&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223038325000&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223005224218&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223003124139&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223045825168&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223046325197&q=raw http://marc.info/?l=user-mode-linux-devel&m=120223005624238&q=raw These are against 2.6.24. Build both host and guest from this tree. Jeff -- Work email - jdike at linux dot intel dot com commit 8ebb7e2d1636f0fca44caaab936e9bfe21ae515b Author: Jeff Dike <[EMAIL PROTECTED]> Date: Mon Feb 4 15:38:02 2008 -0500 Host get_mm and switch_mm This is the new_mm, switch_mm, and /proc//mm implementation for 32- and 64-bit x86 and UML, plus 32-bit support on 64-bit x86. diff --git a/arch/um/include/skas_ptrace.h b/arch/um/include/skas_ptrace.h index cd2327d..6b55c52 100644 --- a/arch/um/include/skas_ptrace.h +++ b/arch/um/include/skas_ptrace.h @@ -7,7 +7,9 @@ #define __SKAS_PTRACE_H #define PTRACE_FAULTINFO 52 -#define PTRACE_SWITCH_MM 55 +#ifndef OLD_PTRACE_SWITCH_MM +#define OLD_PTRACE_SWITCH_MM 55 +#endif #include "sysdep/skas_ptrace.h" diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 47b57b4..25721bf 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c @@ -192,7 +192,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) } #endif #ifdef CONFIG_PROC_MM - case PTRACE_SWITCH_MM: { + case OLD_PTRACE_SWITCH_MM: { struct mm_struct *old = child->mm; struct mm_struct *new = proc_mm_get_mm(data); @@ -292,3 +292,14 @@ void syscall_trace(struct uml_pt_regs *regs, int entryexit) current->exit_code = 0; } } + +int ptrace_to_pt_regs(struct pt_regs *to, s
Re: [PATCH 09/16] um: use get_personality()
On Wed, Feb 20, 2008 at 07:19:13PM +0800, WANG Cong wrote: > Signed-off-by: WANG Cong <[EMAIL PROTECTED]> Looks good - you should add some sort of changelog though. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [bug] uml doesn't boot under 2.6.25-rc1 host (was Re: 2.6.24-mm1 bugs)
On Thu, Feb 21, 2008 at 06:20:23PM +0100, Miklos Szeredi wrote: > Bisected it down to > > good e7b5e11eaaa8ef93a34e68016de51152d0d62911 > bad bde6f5f59c2b2b48a7a849c129d5b48838fe77ee > > I strongly suspect it's one of the ptrace cleanup patches. Roland, > could you please have a look? I agree. There's an awful lot of ptrace stuff in that range, and some of it apparently broke 32-bit compatibility. Thanks for chasing it down. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] UML - x86_64 should copy %fs during fork
%fs needs to be copied from parent to child during fork. Tidied up some whitespace while I was here. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- include/asm-um/processor-x86_64.h |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-2.6-git/include/asm-um/processor-x86_64.h === --- linux-2.6-git.orig/include/asm-um/processor-x86_64.h2008-02-06 11:17:20.0 -0500 +++ linux-2.6-git/include/asm-um/processor-x86_64.h 2008-02-06 12:17:21.0 -0500 @@ -26,7 +26,7 @@ static inline void rep_nop(void) #define cpu_relax() rep_nop() #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ - .debugregs_seq = 0, \ + .debugregs_seq = 0, \ .fs = 0, \ .faultinfo = { 0, 0, 0 } } @@ -37,6 +37,7 @@ static inline void arch_flush_thread(str static inline void arch_copy_thread(struct arch_thread *from, struct arch_thread *to) { + to->fs = from->fs; } #include "asm/arch/user.h" -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] UML - Five for 2.6.25
This batch should go into the 2.6.25 merge window. There are a couple of patches which had been sitting in -mm waiting for this merge window, but got lost somehow: runtime host vmsplit detection - Miklos spotted a bug, since fixed, with a 32-bit UML on a 64-bit host style fixes in arch/um/os-Linux - there's a false-positive checkpatch complaint with this one The rest are bug fixes. Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] UML - Fix mm_context memory leak
[ Spotted by Miklos ] Fix a memory leak in init_new_context. The struct page ** buffer allocated for install_special_mapping was never recorded, and thus leaked when the mm_struct was freed. Fix it by saving the pointer in mm_context_t and freeing it in arch_exit_mmap. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Cc: Miklos Szeredi <[EMAIL PROTECTED]> --- arch/um/include/um_mmu.h |1 + arch/um/kernel/skas/mmu.c |5 + 2 files changed, 6 insertions(+) Index: linux-2.6-git/arch/um/include/um_mmu.h === --- linux-2.6-git.orig/arch/um/include/um_mmu.h 2008-02-06 12:15:05.0 -0500 +++ linux-2.6-git/arch/um/include/um_mmu.h 2008-02-06 12:24:08.0 -0500 @@ -13,6 +13,7 @@ typedef struct mm_context { struct mm_id id; struct uml_ldt ldt; + struct page **stub_pages; } mm_context_t; extern void __switch_mm(struct mm_id * mm_idp); Index: linux-2.6-git/arch/um/kernel/skas/mmu.c === --- linux-2.6-git.orig/arch/um/kernel/skas/mmu.c2008-02-06 12:15:05.0 -0500 +++ linux-2.6-git/arch/um/kernel/skas/mmu.c 2008-02-06 12:24:31.0 -0500 @@ -91,6 +91,8 @@ int init_new_context(struct task_struct goto out_free; } + to_mm->stub_pages = NULL; + return 0; out_free: @@ -126,6 +128,7 @@ void arch_dup_mmap(struct mm_struct *old pages[0] = virt_to_page(&__syscall_stub_start); pages[1] = virt_to_page(mm->context.id.stack); + mm->context.stub_pages = pages; /* dup_mmap already holds mmap_sem */ err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START, @@ -147,6 +150,8 @@ void arch_exit_mmap(struct mm_struct *mm { pte_t *pte; + if (mm->context.stub_pages != NULL) + kfree(mm->context.stub_pages); pte = virt_to_pte(mm, STUB_CODE); if (pte != NULL) pte_clear(mm, STUB_CODE, pte); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] UML - Style fixes in arch/um/os-Linux
Style changes under arch/um/os-Linux: include trimming CodingStyle fixes some printks needed severity indicators make_tempfile turns out not to be used outside of mem.c, so it is now static. Its declaration in tempfile.h is no longer needed, and tempfile.h itself is no longer needed. create_tmp_file was also made static. checkpatch moans about an EXPORT_SYMBOL in user_syms.c which is part of a macro definition - this is copying a bit of kernel infrastructure into the libc side of UML because the kernel headers can't be included there. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/include/tempfile.h | 11 --- arch/um/os-Linux/aio.c |2 arch/um/os-Linux/drivers/ethertap_kern.c |8 +- arch/um/os-Linux/drivers/tuntap_kern.c |6 - arch/um/os-Linux/include/file.h | 13 --- arch/um/os-Linux/mem.c | 101 +++ arch/um/os-Linux/process.c |2 arch/um/os-Linux/signal.c|2 arch/um/os-Linux/skas/process.c |6 - arch/um/os-Linux/sys-i386/registers.c|4 - arch/um/os-Linux/sys-x86_64/registers.c | 21 +++--- arch/um/os-Linux/uaccess.c |4 - arch/um/os-Linux/user_syms.c |4 - arch/um/os-Linux/util.c | 43 - 14 files changed, 98 insertions(+), 129 deletions(-) Index: linux-2.6.22/arch/um/os-Linux/user_syms.c === --- linux-2.6.22.orig/arch/um/os-Linux/user_syms.c 2007-12-14 11:21:17.0 -0500 +++ linux-2.6.22/arch/um/os-Linux/user_syms.c 2007-12-14 11:23:36.0 -0500 @@ -34,8 +34,8 @@ EXPORT_SYMBOL(printf); * good; so the versions of these symbols will always match */ #define EXPORT_SYMBOL_PROTO(sym) \ - int sym(void); \ - EXPORT_SYMBOL(sym); + int sym(void); \ + EXPORT_SYMBOL(sym); extern void readdir64(void) __attribute__((weak)); EXPORT_SYMBOL(readdir64); Index: linux-2.6.22/arch/um/include/tempfile.h === --- linux-2.6.22.orig/arch/um/include/tempfile.h2007-12-14 11:21:17.0 -0500 +++ /dev/null 1970-01-01 00:00:00.0 + @@ -1,11 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Jeff Dike ([EMAIL PROTECTED]) - * Licensed under the GPL - */ - -#ifndef __TEMPFILE_H__ -#define __TEMPFILE_H__ - -extern int make_tempfile(const char *template, char **tempname, int do_unlink); - -#endif Index: linux-2.6.22/arch/um/os-Linux/aio.c === --- linux-2.6.22.orig/arch/um/os-Linux/aio.c2007-12-14 11:21:17.0 -0500 +++ linux-2.6.22/arch/um/os-Linux/aio.c 2007-12-14 11:28:05.0 -0500 @@ -142,7 +142,7 @@ static int do_not_aio(struct aio_thread_ if (actual != req->offset) return -errno; - switch(req->type) { + switch (req->type) { case AIO_READ: n = read(req->io_fd, req->buf, req->len); break; Index: linux-2.6.22/arch/um/os-Linux/include/file.h === --- linux-2.6.22.orig/arch/um/os-Linux/include/file.h 2007-12-14 11:21:17.0 -0500 +++ linux-2.6.22/arch/um/os-Linux/include/file.h2007-12-14 11:23:36.0 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Jeff Dike ([EMAIL PROTECTED]) + * Copyright (C) 2002 - 2007 Jeff Dike ([EMAIL PROTECTED],linux.intel}.com) * Licensed under the GPL */ @@ -9,14 +9,3 @@ #define DEV_NULL "/dev/null" #endif - -/* - * 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.22/arch/um/os-Linux/mem.c === --- linux-2.6.22.orig/arch/um/os-Linux/mem.c2007-12-14 11:21:17.0 -0500 +++ linux-2.6.22/arch/um/os-Linux/mem.c 2007-12-14 11:35:12.00000 -0500 @@ -1,22 +1,21 @@ +/* + * Copyright (C) 2007 Jeff Dike ([EMAIL PROTECTED],linux.intel}.com) + * Licensed under the GPL + */ + #include -#include #include -#include +#include #include #include -#include #include -#include +#include #include -#include -#include "user.h" -#include "mem_user.h" +#include #include "init.h" -#include "os.h" -#include "tempfile.h" #include "kern_constants.h" - -#include +#include "os.h" +#include "user.h" /* Modifi
[PATCH 1/5] UML - Runtime host VMSPLIT detection
Calculate TASK_SIZE at run-time by figuring out the host's VMSPLIT - this is needed on i386 if UML is to run on hosts with varying VMSPLITs without recompilation. TASK_SIZE is now defined in terms of a variable, task_size. This gets rid of an include of pgtable.h from processor.h, which can cause include loops. On i386, task_size is calculated early in boot by probing the address space in a binary search to figure out where the boundary between usable and non-usable memory is. This tries to make sure that a page that is considered to be in userspace is, or can be made, read-write. I'm concerned about a system-global VDSO page in kernel memory being hit and considered to be a userspace page. On x86_64, task_size is just the old value of CONFIG_TOP_ADDR. A bunch of config variable are gone now. CONFIG_TOP_ADDR is directly replaced by TASK_SIZE. NEST_LEVEL is gone since the relocation of the stubs makes it irrelevant. All the HOST_VMSPLIT stuff is gone. All references to these in arch/um/Makefile are also gone. I noticed and fixed a missing extern in os.h when adding os_get_task_size. Note: This has been revised to fix the 32-bit UML on 64-bit host bug that Miklos ran into. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/Kconfig | 11 -- arch/um/Kconfig.i386| 37 - arch/um/Kconfig.x86_64 |4 - arch/um/Makefile| 11 -- arch/um/defconfig |3 arch/um/include/as-layout.h |2 arch/um/include/os.h|5 + arch/um/kernel/exec.c |2 arch/um/kernel/um_arch.c| 16 +++- arch/um/os-Linux/sys-i386/Makefile |2 arch/um/os-Linux/sys-i386/task_size.c | 120 arch/um/os-Linux/sys-x86_64/Makefile|2 arch/um/os-Linux/sys-x86_64/task_size.c |5 + include/asm-um/fixmap.h |3 include/asm-um/processor-generic.h |5 - 15 files changed, 153 insertions(+), 75 deletions(-) Index: linux-2.6-git/arch/um/kernel/um_arch.c === --- linux-2.6-git.orig/arch/um/kernel/um_arch.c 2008-02-06 11:19:07.0 -0500 +++ linux-2.6-git/arch/um/kernel/um_arch.c 2008-02-06 11:31:53.0 -0500 @@ -241,6 +241,11 @@ static struct notifier_block panic_exit_ }; /* Set during early boot */ +unsigned long task_size; +EXPORT_SYMBOL(task_size); + +unsigned long host_task_size; + unsigned long brk_start; unsigned long end_iomem; EXPORT_SYMBOL(end_iomem); @@ -267,6 +272,13 @@ int __init linux_main(int argc, char **a if (have_root == 0) add_arg(DEFAULT_COMMAND_LINE); + host_task_size = os_get_task_size(); + /* +* TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps +* out +*/ + task_size = host_task_size & PGDIR_MASK; + /* OS sanity checks that need to happen before the kernel runs */ os_early_checks(); @@ -303,7 +315,7 @@ int __init linux_main(int argc, char **a highmem = 0; iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK; - max_physmem = CONFIG_TOP_ADDR - uml_physmem - iomem_size - MIN_VMALLOC; + max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC; /* * Zones have to begin on a 1 << MAX_ORDER page boundary, @@ -335,7 +347,7 @@ int __init linux_main(int argc, char **a } virtmem_size = physmem_size; - avail = CONFIG_TOP_ADDR - start_vm; + avail = TASK_SIZE - start_vm; if (physmem_size > avail) virtmem_size = avail; end_vm = start_vm + virtmem_size; Index: linux-2.6-git/include/asm-um/processor-generic.h === --- linux-2.6-git.orig/include/asm-um/processor-generic.h 2008-02-06 11:19:09.0 -0500 +++ linux-2.6-git/include/asm-um/processor-generic.h2008-02-06 11:31:53.0 -0500 @@ -11,7 +11,6 @@ struct pt_regs; struct task_struct; #include "asm/ptrace.h" -#include "asm/pgtable.h" #include "registers.h" #include "sysdep/archsetjmp.h" @@ -92,7 +91,9 @@ static inline void mm_copy_segments(stru /* * User space process size: 3GB (default). */ -#define TASK_SIZE (CONFIG_TOP_ADDR & PGDIR_MASK) +extern unsigned long task_size; + +#define TASK_SIZE (task_size) /* This decides where the kernel will search for a free chunk of vm * space during mmap's. Index: linux-2.6-git/arch/um/include/os.h === --- linux-2.6-git.orig/arch/um/include/os.h 2008-02-06 11:19:07.0 -0500 +++ linux-2.6-git/arch/um/include/os.h 2008-02-06 11:31:53.0 -0500 @@ -295,6 +295,9 @@ extern void maybe_sigio_broken(int fd
[PATCH 3/5] UML - Improved error handling while locating temp dir
From: Jim Meyering <[EMAIL PROTECTED]> * arch/um/os-Linux/mem.c (make_tempfile): Don't deref NULL upon failed malloc. * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. [ jdike - formatting cleanups, deleted obsolete comment ] Signed-off-by: Jim Meyering <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/os-Linux/mem.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) Index: linux-2.6-git/arch/um/os-Linux/mem.c === --- linux-2.6-git.orig/arch/um/os-Linux/mem.c 2008-02-05 13:20:46.0 -0500 +++ linux-2.6-git/arch/um/os-Linux/mem.c2008-02-05 16:37:37.0 -0500 @@ -162,11 +162,6 @@ found: goto out; } -/* - * This proc still used in tt-mode - * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). - * So it isn't 'static' yet. - */ static int __init make_tempfile(const char *template, char **out_tempname, int do_unlink) { @@ -175,10 +170,13 @@ static int __init make_tempfile(const ch which_tmpdir(); tempname = malloc(MAXPATHLEN); - if (!tempname) - goto out; + if (tempname == NULL) + return -1; find_tempdir(); + if ((tempdir == NULL) || (strlen(tempdir) >= MAXPATHLEN)) + return -1; + if (template[0] != '/') strcpy(tempname, tempdir); else @@ -196,9 +194,8 @@ static int __init make_tempfile(const ch } if (out_tempname) { *out_tempname = tempname; - } else { + } else free(tempname); - } return fd; out: free(tempname); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] UML - update defconfig
[ This is 2.6.25 fodder ] Update defconfig. Cc: Christoph Hellwig <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/defconfig | 280 -- 1 file changed, 187 insertions(+), 93 deletions(-) Index: linux-2.6-git/arch/um/defconfig === --- linux-2.6-git.orig/arch/um/defconfig2008-02-07 11:46:12.0 -0500 +++ linux-2.6-git/arch/um/defconfig 2008-02-07 11:49:03.0 -0500 @@ -1,13 +1,22 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.17-rc3 -# Fri Apr 28 09:31:20 2006 +# Linux kernel version: 2.6.24 +# Thu Feb 7 11:48:55 2008 # +CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig" CONFIG_GENERIC_HARDIRQS=y CONFIG_UML=y CONFIG_MMU=y +CONFIG_NO_IOMEM=y +# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set +CONFIG_LOCKDEP_SUPPORT=y +# CONFIG_STACKTRACE_SUPPORT is not set CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_TIME=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_IRQ_RELEASE_METHOD=y +CONFIG_HZ=100 # # UML-specific options @@ -40,11 +49,13 @@ CONFIG_M686=y # CONFIG_MCYRIXIII is not set # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set +# CONFIG_MPSC is not set +# CONFIG_MCORE2 is not set +# CONFIG_GENERIC_CPU is not set # CONFIG_X86_GENERIC is not set CONFIG_X86_CMPXCHG=y -CONFIG_X86_XADD=y CONFIG_X86_L1_CACHE_SHIFT=5 -CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_X86_XADD=y CONFIG_X86_PPRO_FENCE=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y @@ -53,7 +64,12 @@ CONFIG_X86_POPAD_OK=y CONFIG_X86_GOOD_APIC=y CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_TSC=y +CONFIG_X86_CMOV=y +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +CONFIG_X86_DEBUGCTLMSR=y CONFIG_UML_X86=y +CONFIG_X86_32=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y # CONFIG_64BIT is not set CONFIG_SEMAPHORE_SLEEPERS=y # CONFIG_3_LEVEL_PGTABLES is not set @@ -67,13 +83,18 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_RESOURCES_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_VIRT_TO_BUS=y CONFIG_TICK_ONESHOT=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_LD_SCRIPT_DYN=y -CONFIG_NET=y CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_MISC=m CONFIG_HOSTFS=y # CONFIG_HPPFS is not set @@ -83,31 +104,38 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_KERNEL_STACK_ORDER=0 # -# Code maturity level options +# General setup # CONFIG_EXPERIMENTAL=y CONFIG_BROKEN_ON_SMP=y -CONFIG_INIT_ENV_ARG_LIMIT=32 - -# -# General setup -# +CONFIG_INIT_ENV_ARG_LIMIT=128 CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y CONFIG_SWAP=y CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y CONFIG_POSIX_MQUEUE=y CONFIG_BSD_PROCESS_ACCT=y # CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_SYSCTL=y +# CONFIG_TASKSTATS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set # CONFIG_AUDIT is not set CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_CGROUPS is not set +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_FAIR_USER_SCHED=y +# CONFIG_FAIR_CGROUP_SCHED is not set +CONFIG_SYSFS_DEPRECATED=y # CONFIG_RELAY is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_UID16=y +# CONFIG_BLK_DEV_INITRD is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y # CONFIG_EMBEDDED is not set +CONFIG_UID16=y +CONFIG_SYSCTL_SYSCALL=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set CONFIG_KALLSYMS_EXTRA_PASS=y @@ -117,29 +145,36 @@ CONFIG_BUG=y CONFIG_ELF_CORE=y CONFIG_BASE_FULL=y CONFIG_FUTEX=y +CONFIG_ANON_INODES=y CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y CONFIG_SHMEM=y +CONFIG_VM_EVENT_COUNTERS=y CONFIG_SLAB=y +# CONFIG_SLUB is not set +# CONFIG_SLOB is not set +# CONFIG_PROFILING is not set +# CONFIG_MARKERS is not set +# CONFIG_HAVE_OPROFILE is not set +# CONFIG_HAVE_KPROBES is not set +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 -# CONFIG_SLOB is not set - -# -# Loadable module support -# CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_KMOD=y - -# -# Block layer -# +CONFIG_BLOCK=y # CONFIG_LBD is not set # CONFIG_BLK_DEV_IO_TRACE is not set # CONFIG_LSF is not set +# CONFIG_BLK_DEV_BSG is not set # # IO Schedulers @@ -153,19 +188,16 @@ CONFIG_DEFAULT_AS=y # CONFIG_DEFAULT_CFQ is not set # CONFIG_DEFAULT_NOOP is not set CONFIG_DEFAULT_IOSCHED="anticipatory" - -# -# Block devices -# +CONFIG_CLASSIC_RCU=y +# CONFIG_PREEMPT_RCU is not set +CONFIG_BLK_DEV=y CONFIG_BLK_DEV_UBD=y # CONFIG_BLK_DEV_UBD_SYNC is not set CONFIG_BLK_DEV_COW_COMMON=y -# CONFIG_MMAPPER is not set CONF
Re: Should a x86 gdb work under an x86_64 kernel?
On Mon, Feb 25, 2008 at 09:49:43AM -0500, Theodore Ts'o wrote: > I've noticed that if I try to use a 32-bit x86 gdb to debug a > 32-bit program under a 64-bit x86_64 kernel, gdb (version 6.6-debian, > from Ubuntu Gutsy) immediately core dumps as soon as I run the test > program under the debugger. Is this normal/expected/known bug? Probably - UML broke too. Roland found the bug and posted a patch fairly quickly - http://marc.info/?l=linux-kernel&m=120365510230307&q=raw Jeff -- Work email - jdike at linux dot intel dot com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.40-2.4.3
The user-mode port of 2.4.3 is available. Added --help and --version, which do the obvious things UML now creates a /tmp/uml/ pid file. The name can be set with the '-umid=' switch. This is intended to make it easier for a UI to control a number of virtual machines. There is a more general interface coming which will replace the pid file with a socket to a low-level console inside UML. Fixed several major crashes and numerous smaller bugs. The major fixes required some surgery from which UML still hasn't totally recovered, so it's still a bit wobbly. In particular, if it swaps, processes will start segfaulting, and the swap code will start spitting out various frightening-sounding messages. A number of hostfs bugfixes and cleanup. One major new feature here - hostfs can now be the root filesystem. This is done by assigning a directory to a ubd device, i.e. 'ubd0=/path/to/uml/root'. A little bit of magic will cause this to be mounted as a hostfs filesystem. Requirements: hostfs compiled into the kernel, /etc/fstab in that filesystem must have the / fs type as hostfs, you (the user running UML) must own all the files (they will be magically owned by root inside the virtual machine). modify_ldt is now implemented. /proc/cmdline is now right. gdb automatically gets breakpoints set on panic and BUG. The project's home page is http://user-mode-linux.sourceforge.net Downloads are available at http://sourceforge.net/project/filelist.php?group_id =429 and ftp://ftp.nl.linux.org/pub/uml/ Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: No 100 HZ timer !
[EMAIL PROTECTED] said: > I have a suggestion that might seem unusual at first but it is > important for Linux on S/390. We are facing the problem that we want > to start many (> 1000) Linux images on a big S/390 machine. Every > image has its own 100 HZ timer on every processor the images uses > (normally 1). On a single image system the processor use of the 100 HZ > timer is not a big deal but with > 1000 images you need a lot of > processing power just to execute the 100 HZ timers. You quickly end up > with 100% CPU only for the timer interrupts of otherwise idle images. This is going to be a problem for UML as well, and I was considering something very similar. I did a quick scan of your prose, and the description sounds like what I had in mind. So, count me in as a supporter of this. A small request: Since S/390 is not the only port that needs this, I'd be happy if it was made as generic as possible (and it may already be, I haven't gone through the code yet). Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [parisc-linux] Re: OK, let's try cleaning up another nit. Is anyone paying attention?
[EMAIL PROTECTED] said: > http://www.kernel.org/ has a list of architecture websites. Also the > CREDITS / MAINTAINERS files tend to list the people who are involved. Except it's restricted to processor ports, which would leave you not knowing about UML. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [parisc-linux] Re: OK, let's try cleaning up another nit. Is anyone paying attention?
[EMAIL PROTECTED] said: > Have you tried mailing [EMAIL PROTECTED] and asking to be added? Yes. [EMAIL PROTECTED] said: > I'd be highly surprised if they said no to adding UML to the list if > you mailed them a request to update the page. Well, be surprised then. The reply from hpa was that that list was for processor ports. He did say that there might at some point in the future be a separate list (off the main page) of other things. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Architecture-specific include files
[EMAIL PROTECTED] said: > Would anyone have a problem with this change? UML already has a arch/um/include for private headers that the rest of the kernel is not allowed to see. It would mean moving it, which is not a big deal. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: To Linus: kdb in 2.4?
[EMAIL PROTECTED] said: > I'm wondering about the possibility of re-examining the idea of a > kernel debugger option distributed with 2.4. First off, I'd like to say that I'm highly sympathetic to this, assuming that a kernel debugger doesn't change the kernel's behavior. However, > I'm thinking that it could be a great teaching tool to break and > examine structures, variables, process states, as well as an aid to > people who may not have a grasp of the entire kernel but need to write > device drivers. you might look at UML (http://user-mode-linux.sourceforge.net) for this. A number of kernel hackers are very successfully using UML for doing filesystem and mm development and debugging. With some help from the host, it's also possible to do driver development under UML. I also know of a number of people using UML to further their education by using it to poke around a running kernel. > Certainly Buddha doesn't need to know how to read to know his own > writings -- and certainly, if everyone meditates and 'evolves' to > their Buddha nature, they wouldn't need to read the texts or recognize > the letters either. So, if you can't convince Buddha of the wisdom of your arguments (or even if you can) check out UML. It makes a perfectly good kernel debugger available, and it's a lot easier to deal with than a native kernel. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.39-2.4.2
The user-mode port of 2.4.2 is available. For the particularly paranoid, the ubd device now has the option of doing all writes O_SYNC, either as a config option for all devices or on a device-by-device basis. This is thanks to Lennert Buytenhek. A couple of hostfs bugs were fixed. A crash involving breakpoints set at the very beginning or very end of an interrupt handler was fixed. SIGFPE is now passed along to processes correctly. The SIGIO handler tries harder to empty file descriptors by giving tasklets more chances to feed the input to a process. A crash involving the tracing thread trying, and failing, to allocate memory was fixed. Fixed a race which caused timer interrupts to stop being handled. Temporary files are not created in /tmp. This apparently provides a noticable performance improvement when tmpfs is mounted on /tmp. This is also due to Lennert. The project's home page is http://user-mode-linux.sourceforge.net Downloads are available at http://sourceforge.net/project/filelist.php?group_id =429 (which Sourceforge has managed to break) and ftp://ftp.nl.linux.org/pub/um l/ Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.37-2.4.0
The user-mode port of 2.4.0 is available. It was updated to 2.4.0 and that's it. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] Re: [reiserfs-list] BUG at inode.c:371
You've got two problems here, and one of them is mine: > In uml I continue the debian installation off of cdrom and as I say ok > to the final screen I get a "Kernel panic: Kernel mode fault at addr > 0xbefffe90, ip 0x1009f315" from user-mode linux which is running as > me, not as root. Can you get me a stack trace from the panic? See http://user-mode-linux.source forge.net/trouble.html if you need information on doing that. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.34-2.4.0-test11
The user-mode port of 2.4.0-test11 is available. UML is now able to run as a daemon, i.e. with no stdin/stdout/stderr. The hostfs filesystem now works as a readonly filesystem. It's now configurable. I'm using it as a module. It ought to work compiled into the kernel, but I haven't checked this. I fixed a number of bugs. NOTE: If you compile from source, you must put 'ARCH=um' on the make command line or in the environment, like: make linux ARCH=um or ARCH=um make linux or export ARCH=um make linux This is because I've changed the top-level Makefile to build either a native kernel or a usermode kernel, with the default being native. This is in preparation for submitting this port to the main pool. The ARCH calculation is now this: # SUBARCH tells the usermode build what the underlying arch is. That is set # first, and if a usermode build is happening, the "ARCH=um" on the command # line overrides the setting of ARCH below. If a native build is happening, # then ARCH is assigned, getting whatever value it gets normally, and # SUBARCH is subsequently ignored. SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) ARCH := $(SUBARCH) If anyone has any objections to this going in the main pool, let me know, and also let me know what you would suggest as a fix. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: Address translation
[EMAIL PROTECTED] said: > Does anybody know a function or method in order to translate an user > space pointer into a valid pointer in kernel mode? > I'd like to avoid copying data (such as the 'copy_to_user' and > 'copy_from_user' functions do) because it slows down my system. The reason that everyone else uses copy_{to,from}_user is that there is no way to guarantee that the userspace pointer is valid. That memory may have been swapped out. The copy macros are prepared to fault the memory in. The rest of the kernel is not. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mutliple root devs (take II)
[EMAIL PROTECTED] said: > I was unsure if it was okay to be using kmalloc during early stages of > init/main.c so I decided to follow the example allready set and just > use a static array - can anyone advise on being able to do this > dynamically? kmalloc is usable after mem_init(), I think. Before that, you can use the boot memory allocator (see mm/bootmem.c). In the arch that I'm most familiar with (arch/um), that is usable from the beginning of start_kernel. I don't know about the other arches. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.31-2.4.0-test8
The user-mode port of 2.4.0-test8 is available. It now boots on LFS kernels. The block driver now handles out-of-range accesses better. Various other bugs were fixed. There is also a Debian 2.2 filesystem, a test harness, and the beginning of a test suite available. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [User-mode-linux-user] Ptrace broken since 2.4.0-test8pre4?...
[EMAIL PROTECTED] said: > Beeing an active user mode linux user :-) I can say that since > 2.4.0-test8 (host kernel) I cannot run uml-linux successfully. > In contrast with popular feeling that "threaded programes screwed > signal handling on test8.", it is actually a small change to arch/ > i386/ptrace.c introduced since test8pre4. I don't see a problem with the ptrace fix. Before changing EIP, UML saves all of the process registers into the thread struct. So that change to ORIG_EAX shouldn't matter as far as UML is concerned. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [User-mode-linux-user] Ptrace broken since 2.4.0-test8pre4?...
[EMAIL PROTECTED] said: > I tested vanilla test7 with ptrace() patch. It breaks uml exactly > like I see with any kernel > test7. > exec_user.c:29 ptrace(PTRACE_SYSCALL, 4901, 0, 0) = 0 > And voila, we got SIGSEGV instead of happy running child: > Child 4901 exited with signal 11 Yuri, I apologize for doubting you. That's about the best evidence possible that the test8 ptrace fix is what's breaking UML and not the thread group stuff. If anyone has any idea why that fix breaks PTRACE_SYSCALL, I'd love to know. I'm kind of short on time at the moment, so I'm not in a great position to delve into this at the moment. Until this is fixed, UML doesn't work on any host kernels beyond test7. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: request advice: how stable is devfs in 2.4.0-test9?
[EMAIL PROTECTED] said: > I am currently using 2.4.0-test* as an "ordinary user" and want to try > some of the 2.4 specific new features out, but this is my only system > and I don't want it to be messed up so much, so I'd like to hear some > comments first. This is one of the things that user-mode Linux (http://user-mode-linux.sourcefo rge.net) is for. I've been shipping kernels with devfs since devfs made it into the mainline pool. With UML, you can boot up a virtual machine, and play with devfs all you want without any chance of messing up the host. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.32-2.4.0-test10
The user-mode port of 2.4.0-test10 is available. The stack overflows seen in test9 are fixed. The stack is now allocated as four pages, the top two used as a kernel stack, the third is inaccessible and acts as a guard page, and the lowest page contains the task structure. Host devices can again be mounted inside the virtual machine. This was broken a few releases ago when I made the block driver check io requests against the device size. It will no longer crash if the main console is not a terminal. I fixed a race which was causing strange kernel memory faults. In the sources (the patch and cvs), but not the binaries, there is the beginning of a hostfs filesystem. This gives you access to the host root filesystem. Doing 'mount none /wherever -t hostfs' will mount the host root filesystem on /wherever. Right now, you can mount it and cd into it, but ls will crash the kernel. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.33-2.4.0-test10 - Fixed patch
After I generated the patch, I noticed some stuff I didn't want to release, so I edited the patch by hand, and of course, messed it up. So, the new patch is available at http://sourceforge.net/project/filelist.php?g roup_id=429 as usual. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Play Kernel Hangman!
After a stranger than usual late-night #kernelnewbies session on Thursday, I was inspired to come up with Kernel Hangman. This is the traditional game of hangman, except that the words you have to guess are kernel symbols. So, test your knowledge of kernel trivia and play it at http://user-mode-linux.sourceforge.net/cgi-bin/hangman Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: Play Kernel Hangman!
[EMAIL PROTECTED] said: > Actually, OpenBSD already has this (in the kernel !) After a kernel > crash ones, I got in the kerneldebugger. I know. That's what prompted this. My little mind got to working after someone on #kernelnewbies told me about the hangman program in the OpenBSD kernel debugger, and the rest is history... Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.35-2.4.0-test12
The user-mode port of 2.4.0-test12 is finally available. It has been in CVS for a couple of days, but SourceForge only today fixed up the site enough to allow projects to make releases. hostfs now mostly works. It's still somewhat buggy. It is also possible to specify what host directory you want mounted inside the virtual machine. The problem with linking a profiling kernel was fixed. Several crashes were fixed. uname -m no longer returns 'um'. It returns the underlying arch. The reason for this is that some builds (not least the UML build itself) get confused when they see an 'um' machine. I see no advantages to having UML returning a different arch, so it doesn't any more. Several bugs in the block driver were fixed. 'dd if=ubd/0 of=/dev/null' no longer hangs, and dbench no longer produces filesystem corruption. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.36-2.4.0-prerelease
The user-mode port of 2.4.0-prerelease is available. hostfs is more improved. Writing files really works now. Executing binaries also works. There is still some memory corruption, though. I fixed the swapoff crash. The input to consoles and serial lines is now much more general. You can attach them to ptys, ttys, and ports now, with a few more interfaces to come. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] prevention of syscalls from writable segments, breaking bug exploits
[EMAIL PROTECTED] said: > This preliminary, small patch prevents execution of system calls which > were executed from a writable segment. It was tested and seems to > work, without breaking anything. It also reports of such calls by > using printk. Have you tried running UML on this kernel? Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Why does test9 outlaw HZ < 48?
UML has HZ == 20. When I built test9, I ran into trouble with this new block in include/linux/timex.h: #if HZ >= 24 && HZ < 48 # define SHIFT_HZ 5 #elif HZ >= 48 && HZ < 96 # define SHIFT_HZ 6 ... I added the obvious 12 <= HZ < 24 lines and got this from kernel/timer.c: timer.c:446: warning: right shift count is negative timer.c:449: warning: right shift count is negative Those lines are these: time_adj -= -ltemp >> (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE); time_adj += ltemp >> (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE); When you chase down the constants (the others are in timex.h, too), the shift value turns out to be: 16 + SHIFT_HZ - 22 16 + SHIFT_HZ - 22 >= 0 implies SHIFT_HZ >= 6. Now, my questions are: What's the reasoning behind these magic numbers? The comment associated with those constants is less than illumunating IMHO. Is there anything wrong with HZ < 48? If not, what's the right way to get it without upsetting the compiler? Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.32-2.4.0-test9
The user-mode port of 2.4.0-test9 is available. The bug that caused bash to occasionally segfault on address 0 was fixed. I also went on a breakpoint-fixing binge. The problems caused by the kernel debugger hitting breakpoints are fixed. Also, gdb no longer panics the kernel when it hits a breakpoint. Both the kernel debugger and gdb now seem to work well. Bill Stearns produced a number of new bootable filesystems, including Red Hat 7.0, Mandrake 7.1, and Immunix 6.2. These are available from the project's download page. The project's home page is http://user-mode-linux.sourceforge.net The project's download page is http://sourceforge.net/project/filelist.php?grou p_id=429 Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
tty_[un]register_devfs putting 3K structures on the stack
tty_register_devfs and tty_unregister_devfs both declare "struct tty_struct" locals. According to gdb: (gdb) p sizeof(struct tty_struct) $20 = 3084 This eats up most of a 4K page, and on UML this is causing the stack to flow off the page for some people. Is it possible to make that tty_struct static or kmalloc it or something? Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: TCP/IP User mode Port
> I was told somebody ported the TCP/IP stack of 2.0 as a library in > user-mode. I cannot find the code for that, can anybody tell me where > can I get it? Also, is there any other user level port of the TCP/IP > stack for more recent kernels? This is probably not what you heard about, but it might work for you. I've ported the entire kernel to userspace (including the TCP stack, obviously). See http://user-mode-linux.sourceforge.net for details. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: tty_[un]register_devfs putting 3K structures on the stack
[EMAIL PROTECTED] said: > And it's allocating a tty_struct for a really dumb reason, too. It's > just using it so it cna call tty_name. > Just replace the call to tty_name with something like this: > sprintf(buf, driver->name, idx + driver->name_base) > and make the obvious change to avoid using tty.device, and you can > avoid need to allocate a tty_struct altogether. Are you willing to consider this a critical bug that deserves to be fixed before 2.4.0? If so, I'm willing to make the fix and send it to whoever wants it. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: User-mode linux stack overflow: could be generic problem
Thank you! I've been waiting for someone to send me that stack. There aren't any real smoking guns there. I'm guessing that the difference between your laptop and the machine it works on is that your laptop is running a fairly recent kernel (2.4.0-testx) and the other isn't. The sigcontext struct greatly increased in size (to ~800 bytes IIRC) to accomodate the MMX registers or something. There are three signals on your stack, so those frames by themselves are taking up half the stack page. Anyway, the patch below removes 256 bytes from the set_signals frame. It ought to alleviate things a bit. I'll be looking for other things I can do, as well. Let me know how it works for you. Jeff --- arch/um/kernel/signal_user.c~ Thu Sep 14 17:00:08 2000 +++ arch/um/kernel/signal_user.cSun Oct 8 00:21:29 2000 @@ -45,26 +45,29 @@ int set_signals(int enable) { - sigset_t mask, unmask, old; + sigset_t mask; + int ret; check_stack_overflow(&enable); + sigprocmask(SIG_BLOCK, NULL, &mask); + ret = enable_mask(&mask); sigemptyset(&mask); - sigemptyset(&unmask); - if(enable & (1 << SIGIO_BIT)) sigaddset(&unmask, SIGIO); - else sigaddset(&mask, SIGIO); + if(enable & (1 << SIGIO_BIT)) sigaddset(&mask, SIGIO); if(enable & (1 << SIGVTALRM_BIT)){ - sigaddset(&unmask, SIGVTALRM); - sigaddset(&unmask, SIGALRM); + sigaddset(&mask, SIGVTALRM); + sigaddset(&mask, SIGALRM); } - else { + if(sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0) + panic("Failed to enable signals"); + sigemptyset(&mask); + if((enable & (1 << SIGIO_BIT)) == 0) sigaddset(&mask, SIGIO); + if((enable & (1 << SIGVTALRM_BIT)) == 0){ sigaddset(&mask, SIGVTALRM); sigaddset(&mask, SIGALRM); } - if(sigprocmask(SIG_BLOCK, &mask, &old) < 0) - panic("Failed to change signal mask"); - if(sigprocmask(SIG_UNBLOCK, &unmask, NULL) < 0) - panic("Failed to change signal mask"); - return(enable_mask(&old)); + if(sigprocmask(SIG_BLOCK, &mask, NULL) < 0) + panic("Failed to block signals"); + return(ret); } /* - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: User-mode linux stack overflow: could be generic problem
[EMAIL PROTECTED] said: > Even with this patch, the overflow is 808 bytes (without the patch > it's 1232 bytes). I was mulling over some other changes that would have saved another 256 bytes, but those don't look like they would help. Try the patch below. It essentially gives up and lets the stack occupy half of the lower page. Also, could you look at the stack pointer at each frame, to see if you are encountering any stack hogs in the generic kernel? In a different situation, I found devfs putting a 3K structure on the stack. Jeff --- arch/um/kernel/process_kern.c~ Mon Sep 25 15:34:25 2000 +++ arch/um/kernel/process_kern.c Fri Oct 6 12:07:28 2000 @@ -711,8 +711,13 @@ void check_stack_overflow(void *ptr) { - ifunsigned long) ptr) & PAGE_MASK) == (unsigned long) current) - panic("Stack overflowed onto current_task page"); + unsigned long addr, c; + + addr = (unsigned long) ptr; + c = (unsigned long) current; + + if(addr - c < PAGE_SIZE / 2) + panic("Stack overflowed well into the current_task page"); } int singlestepping(void *t) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: User-mode linux stack overflow: could be generic problem
[EMAIL PROTECTED] said: > __restore(): 764 > do_execve:340 > load_elf_binary: 324 > segv: 180 > sigio_handler:176 > load_script: 172 > ext2_get_block: 160 > set_signals: 156 > block_read_full_page: 124 There's nothing really fixable here. > All up, there's about 660 bytes of stack which can be relatively > easily saved by converting locals to kmalloced memory, which still > isn't enough to solve the problem. Yeah. I did get rid of the fd_set in sigio_handler, saving another 128 bytes. Basically, UML is being screwed by the signal frame size. > I haven't looked into UML's interrupt handling, but perhaps another > approach is to try and avoid recursive interrupts/exceptions and do > some kind of tail-recursion optimisation in the exception/signal > handler. I don't know if this would cause problems (deadlocks?). Probably :-) I don't really want to fiddle with that, because that will impose constraints that will hurt responsiveness. > Alternatively, could you just use a bigger stack? *ding ding ding* We have a winner. I'm going to allocate 4 pages instead of two, and either have three of them available for the stack or have two available for the stack and the third unmapped to protect the task structure. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: tty_[un]register_devfs putting 3K structures on the stack
> If the problem only impacts User-mode Linux, it's hard for me to > justify > hanging the "critical" label on it. However I'm willing to look at > the > patch, bless it, and send it on to Linus (who as you know sometimes is > a > softy about such things. :-) I wasn't considering it a possible critical bug because it hurts UML. I was more considering it a potentially very nasty bug that UML happened to uncover. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: tty_[un]register_devfs putting 3K structures on the stack
[EMAIL PROTECTED] said: > If the problem only impacts User-mode Linux, it's hard for me to justify > hanging the "critical" label on it. However I'm willing to look at the > patch, bless it, and send it on to Linus Below is the patch to rid tty_register_devfs and tty_unregister_devfs of the tty_struct local. I still think that treating it as critical deserves consideration because it's a potentially nasty problem, and one that could be tough to debug. As Alan pointed out, it's easier to fix the bug than it is to prove that it can't happen on any of the other arches. Jeff diff -u drivers/char/tty_io.c.orig drivers/char/tty_io.c --- drivers/char/tty_io.c.orig Tue Oct 17 00:06:04 2000 +++ drivers/char/tty_io.c Tue Oct 17 00:05:37 2000 @@ -1994,12 +1994,11 @@ { #ifdef CONFIG_DEVFS_FS umode_t mode = S_IFCHR | S_IRUSR | S_IWUSR; - struct tty_struct tty; + kdev_t device = MKDEV (driver->major, minor); + int idx = minor - driver->minor_start; char buf[32]; - tty.driver = *driver; - tty.device = MKDEV (driver->major, minor); - switch (tty.device) { + switch (device) { case TTY_DEV: case PTMX_DEV: mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; @@ -2020,23 +2019,21 @@ (driver->major < UNIX98_PTY_SLAVE_MAJOR + UNIX98_NR_MAJORS) ) flags |= DEVFS_FL_CURRENT_OWNER; # endif - devfs_register (NULL, tty_name (&tty, buf), flags | DEVFS_FL_DEFAULT, + sprintf(buf, driver->name, idx + driver->name_base); + devfs_register (NULL, buf, flags | DEVFS_FL_DEFAULT, driver->major, minor, mode, &tty_fops, NULL); #endif /* CONFIG_DEVFS_FS */ } -void tty_unregister_devfs (struct tty_driver *driver, unsigned minor) +void tty_unregister_devfs (struct tty_driver *driver, unsigned int minor) { #ifdef CONFIG_DEVFS_FS void * handle; - struct tty_struct tty; + int idx = minor - driver->minor_start; char buf[32]; - tty.driver = *driver; - tty.device = MKDEV(driver->major, minor); - - handle = devfs_find_handle (NULL, tty_name (&tty, buf), - driver->major, minor, + sprintf(buf, driver->name, idx + driver->name_base); + handle = devfs_find_handle (NULL, buf, driver->major, minor, DEVFS_SPECIAL_CHR, 0); devfs_unregister (handle); #endif /* CONFIG_DEVFS_FS */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: kernel lock contention and scalability
[EMAIL PROTECTED] said: > If you're a UP system, it never makes sense to spin in userland, since > you'll just burn up a timeslice and prevent the lock holder from > running. I haven't looked, but assume that their code only uses > spinlocks on SMP. If you're an SMP system, then you shouldn't be using > a spinlock unless the critical section is "short", in which case the > waiters should simply spin in userland rather than making system calls > which is simply overhead. This is a problem that UML is going to have when I turn SMP back on. Emulating a multiprocessor box on a UP host with the existing locking primitives is going to result in exactly this problem. > Actually, what's really needed here is an efficient form of > dynamically marking a process as non-preemptible so that when > acquiring a spinlock the process can ensure that it exits the critical > section as fast as possible, when it would relinquish its > non-preemptible privilege. That sounds like a pretty fundamental (and abusable) mechanism. I had a suggestion from an IBM guy at ALS last year to make UML "spin"-locks actually sleep in the host (this doesn't make them sleep locks in userspace because they don't call schedule), which sounds reasonable. This gives the lock-holder an opportunity to run immediately. It's unclear to me what the wake-up mechanism would be, though. Another thought I had was to raise the priority of a thread holding a spinlock. This would reduce the chance that it would be preempted by a thread that will waste a timeslice spinning on that lock. I don't know whether this is a good idea either. > Another synchronization method popular with database peeps is "post/ > wait" for which SGI have a patch available for Linux. I understand > that this is relatively "light weight" and might be a better choice > for PG. URL? Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: kernel lock contention and scalability
[EMAIL PROTECTED] said: > Here it is: > http://oss.sgi.com/projects/postwait/ > Check out the download section for a 2.4.0 patch. After having thought about this a bit more, I don't see why pw_post and pw_wait can't be implemented in userspace as: int pw_post(uid_t uid) { return(kill(uid, SIGHUP)) /* Or signal of the waiter's choice */ } int pw_wait(struct timespec *t) { return(nanosleep(t, t)); } In the case of UML, there would be a uid field in its lock structure and the spin code would look like: lock->uid = getpid(); pw_wait(NULL); and the lock release code would be: pw_post(lock->uid); Obviously, sending signals to processes from the outside could massively confuse matters, but I don't see that being a big problem, since I think you can do that now, and no one is complaining about it. Is there anything that I'm missing? Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Kernel stress testing coverage
[EMAIL PROTECTED] said: > I've heard of tools like gcov for doing this with applications, but > the kernel itself seems like it might require something more. Have a look at user-mode Linux (http://user-mode-linux.sourceforge.net). It runs the kernel in userspace, so gprof and gcov can be used on it (although, at the moment, neither work on UML because of architectural changes I've made since I first made them work - these problems will be fixed in the medium-term). Both gprof and gcov produce very interesting information when run on the kernel. So, while you're gathering up tools and information, gather up UML and start playing with it. And if you feel like it, make gcov work again on it - I accept patches :-) Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: kernel lock contention and scalability
[EMAIL PROTECTED] said: > On a uniprocessor system, a simple fallback is to just use a semaphore > instead of a spinlock, since you can guarantee that there's no point > in scheduling the current task until the holder of the "lock" releases > it. Yeah, that works. But I'm not all that interested in compiling UML differently for UP and SMP hosts. > Otherwise, the spin calling sched_yield() each iteration isn't too > horrible. This looks a lot better. For UML, if there's a thread spinning on a lock, there has to be a runnable thread holding it, and that thread will get a timeslice before the spinning one (assuming that the thread holding the lock hasn't called a blocking system call, which is something that I intend to make sure can't happen). > > That sounds like a pretty fundamental (and abusable) mechanism. > > It would be if it were generally available. The implementation on > DYNIX/ptx requires a privilege (PRIV_SCHED IIRC), to be able to use > it. OK, that makes sense. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [CHECKER] big stack variables
[EMAIL PROTECTED] said: > As usual, please report any false positives so we can fix our > checkers. Not a false positive, but a false negative: the tty_struct locals at lines 1994 and 2029 in tty_register_devfs and tty_unregister_devfs, respectively, in the 2.4.2 drivers/char/tty_io.c. Nice work, BTW. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [CHECKER] big stack variables
[EMAIL PROTECTED] said: > I've got my nose stuck in tty_io.c at present - I'll fix this this > one. This is the patch I've been carrying around in the UML pool since this bit me: diff -Naur -X exclude-files orig/drivers/char/tty_io.c um/drivers/char/tty_io.c --- orig/drivers/char/tty_io.c Thu Feb 22 11:53:50 2001 +++ um/drivers/char/tty_io.cThu Feb 22 11:54:55 2001 @@ -1991,12 +1991,11 @@ { #ifdef CONFIG_DEVFS_FS umode_t mode = S_IFCHR | S_IRUSR | S_IWUSR; - struct tty_struct tty; + kdev_t device = MKDEV (driver->major, minor); + int idx = minor - driver->minor_start; char buf[32]; - tty.driver = *driver; - tty.device = MKDEV (driver->major, minor); - switch (tty.device) { + switch (device) { case TTY_DEV: case PTMX_DEV: mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; @@ -2017,23 +2016,21 @@ (driver->major < UNIX98_PTY_SLAVE_MAJOR + UNIX98_NR_MAJORS) ) flags |= DEVFS_FL_CURRENT_OWNER; # endif - devfs_register (NULL, tty_name (&tty, buf), flags | DEVFS_FL_DEFAULT, + sprintf(buf, driver->name, idx + driver->name_base); + devfs_register (NULL, buf, flags | DEVFS_FL_DEFAULT, driver->major, minor, mode, &tty_fops, NULL); #endif /* CONFIG_DEVFS_FS */ } -void tty_unregister_devfs (struct tty_driver *driver, unsigned minor) +void tty_unregister_devfs (struct tty_driver *driver, unsigned int minor) { #ifdef CONFIG_DEVFS_FS void * handle; - struct tty_struct tty; + int idx = minor - driver->minor_start; char buf[32]; - tty.driver = *driver; - tty.device = MKDEV(driver->major, minor); - - handle = devfs_find_handle (NULL, tty_name (&tty, buf), - driver->major, minor, + sprintf(buf, driver->name, idx + driver->name_base); + handle = devfs_find_handle (NULL, buf, driver->major, minor, DEVFS_SPECIAL_CHR, 0); devfs_unregister (handle); #endif /* CONFIG_DEVFS_FS */ @@ -2192,6 +2189,9 @@ #endif #ifdef CONFIG_HWC hwc_console_init(); +#endif +#ifdef CONFIG_STDIO_CONSOLE + stdio_console_init(); #endif #ifdef CONFIG_SERIAL_21285_CONSOLE rs285_console_init(); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [CHECKER] big stack variables
[EMAIL PROTECTED] said: > Erm... That piece is UML-only. Correct, thanks for noticing that. I was a bit over-enthusiastic with my cutting and pasting. Ignore that bit. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [CHECKER] big stack variables
[EMAIL PROTECTED] said: > ObUML: something fishy happens in UML with multiple exec() in PID 1. > Try to say "telinit u" (or just boot with init=/bin/sh and say exec / > sbin/init) and you've got a nice panic()... ObFix: This is fixed in my current CVS. If you're not so desperate for the fix, then it will be in my 2.4.3 release. Basically, the problem was that it assumed that the only exec done by pid 1 was the kernel thread execing init, and things got exciting when that turned out not to be true. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [CHECKER] big stack variables
[EMAIL PROTECTED] said: > ObUML (again): Any estimated time of submission to Linus?! Is this an > early v2.5-thing, or are the changes minor enough to the rest of the > tree to allow for an v2.4-merge? There are almost no changes to the rest of the tree, and none of those affect any of the other arches, so it's an early 2.4 thing. The reason I've waiting this long to put it in is that UML is not a normal port. With the other ports, few enough people have the relevant hardware that if the port isn't all that great at submission time, not many people will be affected. With UML, the vast majority of Linux users (the i386-using ones) have the relevant platform (we could get a lot closer to 100% if owners of non-i386 boxes would port UML to them, hint, hint :-). I expect that getting it into the pool will be considered something of a stamp of approval for UML, so a lot more people will start using it. If it sucks, it will affect a large number of people, word will get around that it sucks, and lots of people won't give it a second chance. So, my goal for UML when it's submitted is that it make a solid, stable, UP virtual machine. You can see a measure of my progress by my TODO list, which I post to my devel list occasionally. The most recent one is at http://www.geocrawler.com/lists/3/SourceForge/709/25/5339352/ After the 2.4 submission, I'm going to start working on some more radical things, like SMP emulation, clustering, and artifical environments. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
user-mode port 0.38-2.4.1
The user-mode port of 2.4.1 is available. I added support for attaching file descriptors and pts devices to UML serial lines and consoles, plus specifying input and output channels separately. 'no-xterm' can now be duplicated with 'con0=fd:0,fd:1 con=pty'. There is now page dirty and access bit support. Fixed various bugs - gdb is now told where the binary really is, rather than assuming that it is ./linux, kreiserfsd now exits correctly, rather than hanging the system when it returns, and a recursively segfaulting process no longer crashes the system. Several more symbols were exported. The project's home page is http://user-mode-linux.sourceforge.net Downloads are available at http://sourceforge.net/project/filelist.php?group_id =429 and ftp://ftp.nl.linux.org/pub/uml/ Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [uml-devel] usermode linux hoses 2.2.18-SMP host machine when run from regular user account
[EMAIL PROTECTED] said: > When run from a normal user account with its current working directory > on a NFS filesystem, usermode linux causes the host machine's kernel > to enter a hosed state. No processes (including UML) seem to respond, > and the machine becomes unusable. Just to clarify what I think UML is doing that's causing the trouble: it is an extensive user of mmap. It creates several files (one 16 meg by default, but possibly much larger) in $PWD, and mmaps them into all of its threads. The "physical memory" file also has individual pages mapped twice (or more) into various threads. I've seen this confuse an old version of reiserfs and NFS, although not so much that the machine hung. UML would just see stale data, get horribly confused by it, and crash. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: start_thread question...
[EMAIL PROTECTED] said: > I'm implementing start_thread for the VAX port and am wondering does > start_thread have to return to load_elf_binary? I'm working on the > init thread and what is happening is it is returning the whole way > back to the execve caller .. which I know shouldn't happen. Ingo answered that specific question (and that had me puzzled for a while, too :-), but, in the future, you might want to look at UML if you have similar questions. All this stuff works, and it's implemented in terms of the system calls that we all know and love, so you don't have to learn about a totally different piece of hardware in order to figure out what's going on. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Threads and the LDT (Intel-specific)?
[EMAIL PROTECTED] said: > I'm trying to do something a bit unorthodox: I want to share the > address space between threads, but I want a certain region of the > address space to be writeable only for a particular thread -- for all > other threads this region is read-only. UML does this in a somewhat portable (but strange) way. Threads don't share address spaces, as far as the OS is concerned, but the areas where the executable is mapped in are copied to a file, those areas are mapped out, and the files mapped shared in their place. This happens once, in the first thread, and all subsequent threads get the executable mapped shared automatically, even though they are separate processes and separate address spaces from the point of view of the kernel. So, once this is set up, a thread just makes an area read-write (or readonly) and that mapping is private. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Has it been done: User Script File System?
[EMAIL PROTECTED] said: > Is there any filesystem in Linux that uses user scripts/executables to > implement the various function calls? http://uservfs.sourceforge.net Also, have a look at the hostfs filesystem in UML. It implements a virtual filesystem which provides access to the host filesystems from inside the virtual machine. The userspace side of it is basically trivial to implement and can be used to provide filesystem access to anything on the host that can be made to look like a filesystem. See http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/user-mode-linux/linux/arch/u m/fs/hostfs/hostfs_user.c?rev=1.11&content-type=text/vnd.viewcvs-markup for the interface that you'd have to implement. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] consolidate sys_ptrace
On Wed, Aug 10, 2005 at 10:00:57AM +0200, Christoph Hellwig wrote: > The sys_ptrace boilerplate code (everything outside the big switch > statement for the arch-specific requests) is shared by most > architectures. This patch moves it to kernel/ptrace.c and leaves the > arch-specific code as arch_ptrace. OK for UML. Jeff
Re: [patch 1/3] uml: share page bits handling between 2 and 3 level pagetables
On Wed, Aug 10, 2005 at 09:37:28PM +0200, Blaisorblade wrote: > Just noticed: you can drop them (except the first, which is a nice cleanup). > > set_pte handles that, and include/asm-generic/pgtable.h uses coherently > set_pte_at. I've checked UML by examining "grep pte", and either mk_pte or > set_pte are used. > > Exceptions: fixaddr_user_init (but that should be ok as we shouldn't map it > actually), pte_modify() (which handles that only for present pages). > > But pte_modify is used with set_pte, so probably we could as well drop that > handling. > > Also look, on the "set_pte" theme, at the attached patch. I realized this > when > I needed those lines to work - I was getting a segfault loop. OK, this sounds right. To recap, we were concerned that when the page scanner went around clearing dirty (accessed) bits, that fix_range_common wasn't write (read) protecting the page in order to emulate the cleared bits. However, set_pte does set _PAGE_NEWPAGE, which forces the page through a full update, including dirty/accessed bit emulation. Correct? However, I did add some parenthesis to your patch: WARN_ON(!pte_young(*pte) || (pte_write(*pte) && !pte_dirty(*pte))); This seems clearer to me. So, your pte consolidation patch is still in my tree, the other two pte patches are dropped. > After using set_pte(), things worked. I have now an almost perfectly working > implementation of remap_file_pages with protection support. > There will probably be some other things to update, like swapping locations, > but I can't get this kernel to fail (it's easier to find bugs in the > test-program, it grew quite complex). Excellent. > I'm going to clean up the code and write changelogs, to send then the patches > for -mm (hoping the page fault scalability patches don't get in the > way). Good. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Fix mmap_kmem (was: [question] What's the difference between /dev/kmem and /dev/mem)
On Mon, Aug 15, 2005 at 09:33:07PM +0200, Olaf Hering wrote: > ARCH=um doesnt like your version, but mine. > > drivers/char/mem.c:267: error: invalid operands to binary << > > pfn = (__pa((u64)vma->vm_pgoff) << PAGE_SHIFT) >> PAGE_SHIFT; My page.h was missing some parens. Try the patch below. Jeff Index: linux-2.6.13-rc6/include/asm-um/page.h === --- linux-2.6.13-rc6.orig/include/asm-um/page.h 2005-08-15 16:57:55.0 -0400 +++ linux-2.6.13-rc6/include/asm-um/page.h 2005-08-15 17:16:57.0 -0400 @@ -104,8 +104,8 @@ * casting is the right thing, but 32-bit UML can't have 64-bit virtual * addresses */ -#define __pa(virt) to_phys((void *) (unsigned long) virt) -#define __va(phys) to_virt((unsigned long) phys) +#define __pa(virt) to_phys((void *) (unsigned long) (virt)) +#define __va(phys) to_virt((unsigned long) (phys)) #define page_to_pfn(page) ((page) - mem_map) #define pfn_to_page(pfn) (mem_map + (pfn)) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] UML - Fix the x86_64 build
>From Al Viro: asm/elf.h breaks the x86_64 build. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.13-rc6/arch/um/os-Linux/elf_aux.c === --- linux-2.6.13-rc6.orig/arch/um/os-Linux/elf_aux.c2005-08-08 12:11:18.0 -0400 +++ linux-2.6.13-rc6/arch/um/os-Linux/elf_aux.c 2005-08-15 13:53:50.0 -0400 @@ -9,7 +9,6 @@ */ #include #include -#include #include "init.h" #include "elf_user.h" #include "mem_user.h" - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] UML - Fix a crash under screen
Running UML inside a detached screen delivers SIGWINCH when UML is not expecting it. This patch ignores them. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.13-rc6/arch/um/kernel/skas/process.c === --- linux-2.6.13-rc6.orig/arch/um/kernel/skas/process.c 2005-08-13 09:02:43.0 -0400 +++ linux-2.6.13-rc6/arch/um/kernel/skas/process.c 2005-08-13 09:03:15.0 -0400 @@ -61,7 +61,11 @@ CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); } while((n >= 0) && WIFSTOPPED(status) && -(WSTOPSIG(status) == SIGVTALRM)); +((WSTOPSIG(status) == SIGVTALRM) || +/* running UML inside a detached screen can cause + * SIGWINCHes + */ +(WSTOPSIG(status) == SIGWINCH))); if((n < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] UML -
>From Al Viro: Fix a macro typo which could break if the macro is passed arguments with side-effects. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.13-rc6/arch/um/include/sysdep-x86_64/ptrace.h === --- linux-2.6.13-rc6.orig/arch/um/include/sysdep-x86_64/ptrace.h 2005-06-17 15:48:29.0 -0400 +++ linux-2.6.13-rc6/arch/um/include/sysdep-x86_64/ptrace.h 2005-08-15 13:32:57.0 -0400 @@ -227,7 +227,7 @@ panic("Bad register in UPT_SET : %d\n", reg); \ break; \ } \ -val; \ +__upt_val; \ }) #define UPT_SET_SYSCALL_RETURN(r, res) \ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] UML - Fix signal frame copy_user
>From Al Viro: The copy_user stuff in the signal frame code was broke. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.13-rc6/arch/um/sys-i386/signal.c === --- linux-2.6.13-rc6.orig/arch/um/sys-i386/signal.c 2005-08-15 12:03:10.0 -0400 +++ linux-2.6.13-rc6/arch/um/sys-i386/signal.c 2005-08-15 12:04:08.0 -0400 @@ -122,9 +122,9 @@ int err; to_fp = to->fpstate; - from_fp = from->fpstate; sigs = to->oldmask; err = copy_from_user(to, from, sizeof(*to)); + from_fp = to->fpstate; to->oldmask = sigs; to->fpstate = to_fp; if(to_fp != NULL) Index: linux-2.6.13-rc6/arch/um/sys-x86_64/signal.c === --- linux-2.6.13-rc6.orig/arch/um/sys-x86_64/signal.c 2005-08-15 12:03:10.0 -0400 +++ linux-2.6.13-rc6/arch/um/sys-x86_64/signal.c2005-08-15 12:04:08.0 -0400 @@ -104,28 +104,35 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, int fpsize) { - struct _fpstate *to_fp, *from_fp; - unsigned long sigs; - int err; - - to_fp = to->fpstate; - from_fp = from->fpstate; - sigs = to->oldmask; - err = copy_from_user(to, from, sizeof(*to)); - to->oldmask = sigs; - return(err); + struct _fpstate *to_fp, *from_fp; + unsigned long sigs; + int err; + + to_fp = to->fpstate; + sigs = to->oldmask; + err = copy_from_user(to, from, sizeof(*to)); + from_fp = to->fpstate; + to->fpstate = to_fp; + to->oldmask = sigs; + if(to_fp != NULL) + err |= copy_from_user(to_fp, from_fp, fpsize); + return(err); } int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, struct sigcontext *from, int fpsize) { - struct _fpstate *to_fp, *from_fp; - int err; + struct _fpstate *to_fp, *from_fp; + int err; - to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); - from_fp = from->fpstate; - err = copy_to_user(to, from, sizeof(*to)); - return(err); + to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); + from_fp = from->fpstate; + err = copy_to_user(to, from, sizeof(*to)); + if(from_fp != NULL){ + err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); + err |= copy_to_user(to_fp, from_fp, fpsize); + } + return(err); } #endif - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC] [PATCH] Split host arch headers for UML's benefit
The patch below fixes the recent UML compilation failure in -rc5-mm1 without making the UML build reach further into the i386 headers. It splits the i386 ptrace.h and system.h into UML-usable and UML-unusable pieces. The string "abi" is in there because I did ptrace.h first, and that involves separating the ptrace ABI stuff from everything else (if pt_regs is not considered part of the abi). However, the system.h split is between random stuff that UML can use and random stuff that it can't. So, perhaps better names would be -uml or -userspace or something. This isolates UML somewhat from host header changes while allowing it to reuse host stuff. Build failures like the current one would be less frequent. It also allows UML headers to be cleaned up - see the deletions from ptrace-generic.h and system-generic.h which used to rename the stuff from the host headers which UML couldn't use. ptrace.h and system.h are the two problem cases at the moment. There are others, but not a lot. These two are the messiest ones. Any arch which runs UML would need similar treatment - right now, that's i386, x86_64, and s390. Jeff Index: linux-2.6.13-rc5-mm1-abi/include/asm-i386/ptrace-abi.h === --- linux-2.6.13-rc5-mm1-abi.orig/include/asm-i386/ptrace-abi.h 2005-08-16 05:22:15.349927640 -0400 +++ linux-2.6.13-rc5-mm1-abi/include/asm-i386/ptrace-abi.h 2005-08-16 11:30:46.0 -0400 @@ -0,0 +1,36 @@ +#ifndef __PTRACE_ABI__ +#define __PTRACE_ABI__ + +#define EBX 0 +#define ECX 1 +#define EDX 2 +#define ESI 3 +#define EDI 4 +#define EBP 5 +#define EAX 6 +#define DS 7 +#define ES 8 +#define FS 9 +#define GS 10 +#define ORIG_EAX 11 +#define EIP 12 +#define CS 13 +#define EFL 14 +#define UESP 15 +#define SS 16 +#define FRAME_SIZE 17 + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS12 +#define PTRACE_SETREGS13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETFPXREGS 18 +#define PTRACE_SETFPXREGS 19 + +#define PTRACE_OLDSETOPTIONS 21 + +#define PTRACE_GET_THREAD_AREA25 +#define PTRACE_SET_THREAD_AREA26 + +#endif Index: linux-2.6.13-rc5-mm1-abi/include/asm-i386/ptrace.h === --- linux-2.6.13-rc5-mm1-abi.orig/include/asm-i386/ptrace.h 2005-08-16 08:48:01.0 -0400 +++ linux-2.6.13-rc5-mm1-abi/include/asm-i386/ptrace.h 2005-08-16 11:03:34.0 -0400 @@ -1,24 +1,7 @@ #ifndef _I386_PTRACE_H #define _I386_PTRACE_H -#define EBX 0 -#define ECX 1 -#define EDX 2 -#define ESI 3 -#define EDI 4 -#define EBP 5 -#define EAX 6 -#define DS 7 -#define ES 8 -#define FS 9 -#define GS 10 -#define ORIG_EAX 11 -#define EIP 12 -#define CS 13 -#define EFL 14 -#define UESP 15 -#define SS 16 -#define FRAME_SIZE 17 +#include /* this struct defines the way the registers are stored on the stack during a system call. */ @@ -41,19 +24,6 @@ int xss; }; -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS12 -#define PTRACE_SETREGS13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 -#define PTRACE_GETFPXREGS 18 -#define PTRACE_SETFPXREGS 19 - -#define PTRACE_OLDSETOPTIONS 21 - -#define PTRACE_GET_THREAD_AREA25 -#define PTRACE_SET_THREAD_AREA26 - #ifdef __KERNEL__ #include Index: linux-2.6.13-rc5-mm1-abi/include/asm-i386/system-abi.h === --- linux-2.6.13-rc5-mm1-abi.orig/include/asm-i386/system-abi.h 2005-08-16 05:22:15.349927640 -0400 +++ linux-2.6.13-rc5-mm1-abi/include/asm-i386/system-abi.h 2005-08-16 11:32:28.0 -0400 @@ -0,0 +1,190 @@ +#ifndef __SYSTEM_ABI__ +#define __SYSTEM_ABI__ + +#include + +#ifdef CONFIG_SMP +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() +#define smp_read_barrier_depends() read_barrier_depends() +#define set_mb(var, value) do { xchg(&var, value); } while (0) +#else +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() +#define smp_read_barrier_depends() do { } while(0) +#define set_mb(var, value) do { var = value; barrier(); } while (0) +#endif + +#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr + +#define tas(ptr) (xchg((ptr),1)) + +struct __xchg_dummy { unsigned long a[100]; }; +#define __xg(x) ((struct __xchg_dummy *)(x)) + +/* + * Note: no "lock" prefix even on SMP: xchg always implies lock anyway + * Note 2: xchg has side effect, so that attribute volatile is necessary, + * but generally the primitive is invalid, *ptr is output argument. --ANK + */ +static inline unsigned long __xchg(unsigned long x,
Re: [RFC] [PATCH] Split host arch headers for UML's benefit
On Tue, Aug 16, 2005 at 10:46:56AM -0700, Zachary Amsden wrote: > I like this approach. In general, it seems beneficial to split these > into ABI and kernel implementation. Also, this stuff eventually works > its way into userspace headers. It is not really clear which asm-xxx > kernel headers are valid to include in userspace. There are definitely > multiple classes of things in the kernel header files : ABI definitions, > user-useful macros and inlines, and things that are privately useful the > kernel. The ptrace split seems quite well defined here; the system > split is a little less obvious, but I don't object to the way you have > done it. Yeah, the ptrace split is nice and ABI-like - the system split is more of a mess. > I've always wondered why we didn't have memory barriers in either > asm/atomic.h or asm/barrier.h; system.h seems to just have a mixed bag > of goodies. That may make sense. > Two things about the system.h split - do you use > arch_align_stack()?. Something does, UML doesn't build without one. > Also, do you use the alternative instruction replacement functionality, > or do you just need the macro? If you don't actually implement > instruction replacement, it seems you could more easily redefine these to be > > #define alternative(oldinstr, newinstr, feature) \ >asm volatile(oldinstr) ::: "memory") Possibly, I don't knowingly use it, but given my borrowing of host arch headers, and most asm works just as well in UML as on the host, there could be some use in UML. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] UML - Add skas0 command-line option
From: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]> This adds the "skas0" parameter to force skas0 operation on SKAS3 host and shows which operating mode has been selected. Not intrusive, much more trivial than Bodo's patch, to merge for 2.6.13. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/kernel/process.c === --- linux-2.6.12.orig/arch/um/kernel/process.c 2005-07-23 09:27:27.0 -0400 +++ linux-2.6.12/arch/um/kernel/process.c 2005-07-23 10:56:54.0 -0400 @@ -212,12 +212,26 @@ static int force_sysemu_disabled = 0; +int ptrace_faultinfo = 1; +int proc_mm = 1; + +static int __init skas0_cmd_param(char *str, int* add) +{ + ptrace_faultinfo = proc_mm = 0; + return 0; +} + static int __init nosysemu_cmd_param(char *str, int* add) { force_sysemu_disabled = 1; return 0; } +__uml_setup("skas0", skas0_cmd_param, + "skas0\n" + "Disables SKAS3 usage, so that SKAS0 is used, unless you \n" + "specify mode=tt.\n\n"); + __uml_setup("nosysemu", nosysemu_cmd_param, "nosysemu\n" "Turns off syscall emulation patch for ptrace (SYSEMU) on.\n" @@ -359,12 +373,10 @@ kill(target, SIGIO); } -int ptrace_faultinfo = 0; -int proc_mm = 1; - extern void *__syscall_stub_start, __syscall_stub_end; #ifdef UML_CONFIG_MODE_SKAS + static inline void check_skas3_ptrace_support(void) { struct ptrace_faultinfo fi; @@ -375,6 +387,7 @@ n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); if (n < 0) { + ptrace_faultinfo = 0; if(errno == EIO) printf("not found\n"); else { @@ -382,8 +395,10 @@ } } else { - ptrace_faultinfo = 1; - printf("found\n"); + if (!ptrace_faultinfo) + printf("found but disabled on command line\n"); + else + printf("found\n"); } init_registers(pid); @@ -396,13 +411,13 @@ if (os_access("/proc/mm", OS_ACC_W_OK) < 0) { proc_mm = 0; printf("not found\n"); - goto out; - } - else { - printf("found\n"); + } else { + if (!proc_mm) + printf("found but disabled on command line\n"); + else + printf("found\n"); } -out: check_skas3_ptrace_support(); return 1; } Index: linux-2.6.12/arch/um/kernel/um_arch.c === --- linux-2.6.12.orig/arch/um/kernel/um_arch.c 2005-07-23 09:27:27.0 -0400 +++ linux-2.6.12/arch/um/kernel/um_arch.c 2005-07-23 10:59:25.0 -0400 @@ -38,6 +38,9 @@ #include "choose-mode.h" #include "mode_kern.h" #include "mode.h" +#ifdef UML_CONFIG_MODE_SKAS +#include "skas.h" +#endif #define DEFAULT_COMMAND_LINE "root=98:0" @@ -318,6 +321,7 @@ unsigned long avail, diff; unsigned long virtmem_size, max_physmem; unsigned int i, add; + char * mode; for (i = 1; i < argc; i++){ if((i == 1) && (argv[i][0] == ' ')) continue; @@ -338,6 +342,21 @@ exit(1); } #endif + +#ifndef CONFIG_MODE_SKAS + mode = "TT"; +#else + /* Show to the user the result of selection */ + if (mode_tt) + mode = "TT"; + else if (proc_mm && ptrace_faultinfo) + mode = "SKAS3"; + else + mode = "SKAS0"; +#endif + + printf("UML running in %s mode\n", mode); + uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, &host_task_size, &task_size); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] UML - Fix misdeclared function
This fixes an interface which differed from its declaration, and includes the relevant header so that this doesn't happen again. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/kernel/helper.c === --- linux-2.6.12.orig/arch/um/kernel/helper.c 2005-07-25 17:22:14.0 -0400 +++ linux-2.6.12/arch/um/kernel/helper.c2005-07-26 16:01:52.0 -0400 @@ -13,6 +13,7 @@ #include "user.h" #include "kern_util.h" #include "user_util.h" +#include "helper.h" #include "os.h" struct helper_data { @@ -149,7 +150,7 @@ return(pid); } -int helper_wait(int pid, int block) +int helper_wait(int pid) { int ret; @@ -160,14 +161,3 @@ } return(ret); } - -/* - * 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: - */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] UML - Update module interface
From: Dominik Hackl <[EMAIL PROTECTED]> This patch replaces the deprecated MODULE_PARM function by the new module_param function. Signed-off-by: Dominik Hackl <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/drivers/hostaudio_kern.c === --- linux-2.6.12.orig/arch/um/drivers/hostaudio_kern.c 2005-07-19 12:03:09.0 -0400 +++ linux-2.6.12/arch/um/drivers/hostaudio_kern.c 2005-07-19 12:09:04.0 -0400 @@ -57,10 +57,10 @@ #else /*MODULE*/ -MODULE_PARM(dsp, "s"); +module_param(dsp, charp, 0644); MODULE_PARM_DESC(dsp, DSP_HELP); -MODULE_PARM(mixer, "s"); +module_param(mixer, charp, 0644); MODULE_PARM_DESC(mixer, MIXER_HELP); #endif - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] UML - Fix rc3-mm1 build
From: Olaf Hering <[EMAIL PROTECTED]> New in 2.6.13-rc3-git4: scripts/Makefile.build:13: /Makefile: No such file or directory scripts/Makefile.build:64: kbuild: Makefile.build is included improperly the define was removed, but its still required to build some targets. Signed-off-by: Olaf Hering <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/Makefile-i386 === --- linux-2.6.12.orig/arch/um/Makefile-i386 2005-07-18 11:53:17.0 -0400 +++ linux-2.6.12/arch/um/Makefile-i386 2005-07-18 11:54:30.0 -0400 @@ -33,6 +33,7 @@ ARCH_CFLAGS += -DUM_FASTCALL endif +SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util SYS_HEADERS:= $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h prepare: $(SYS_HEADERS) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 7/7] UML - Clean up prink calls
From: Christophe Lucas <[EMAIL PROTECTED]> printk() calls should include appropriate KERN_* constant. Signed-off-by: Christophe Lucas <[EMAIL PROTECTED]> Signed-off-by: Domen Puncer <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/drivers/mconsole_kern.c === --- linux-2.6.12.orig/arch/um/drivers/mconsole_kern.c 2005-07-27 16:39:27.0 -0400 +++ linux-2.6.12/arch/um/drivers/mconsole_kern.c2005-07-27 16:39:53.0 -0400 @@ -557,7 +557,7 @@ ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); if(ent == NULL){ - printk("create_proc_mconsole : create_proc_entry failed\n"); + printk(KERN_INFO "create_proc_mconsole : create_proc_entry failed\n"); return(0); } Index: linux-2.6.12/arch/um/kernel/exitcode.c === --- linux-2.6.12.orig/arch/um/kernel/exitcode.c 2005-07-27 16:39:26.0 -0400 +++ linux-2.6.12/arch/um/kernel/exitcode.c 2005-07-27 16:39:53.0 -0400 @@ -48,7 +48,7 @@ ent = create_proc_entry("exitcode", 0600, &proc_root); if(ent == NULL){ - printk("make_proc_exitcode : Failed to register " + printk(KERN_WARNING "make_proc_exitcode : Failed to register " "/proc/exitcode\n"); return(0); } Index: linux-2.6.12/arch/um/kernel/process_kern.c === --- linux-2.6.12.orig/arch/um/kernel/process_kern.c 2005-07-27 16:39:29.0 -0400 +++ linux-2.6.12/arch/um/kernel/process_kern.c 2005-07-27 16:39:53.0 -0400 @@ -412,7 +412,7 @@ if (ent == NULL) { - printk("Failed to register /proc/sysemu\n"); + printk(KERN_WARNING "Failed to register /proc/sysemu\n"); return(0); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/7] UML - Fix load average >=1
update_process_times was missing its irq_enter/irq_exit wrapper. This caused ksoftirqd to be scheduled on every clock tick. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12-rc3-mm2/arch/um/kernel/time_kern.c === --- linux-2.6.12-rc3-mm2.orig/arch/um/kernel/time_kern.c2005-07-28 11:06:35.0 -0400 +++ linux-2.6.12-rc3-mm2/arch/um/kernel/time_kern.c 2005-07-28 11:26:17.0 -0400 @@ -137,7 +137,10 @@ void timer_handler(int sig, union uml_pt_regs *regs) { local_irq_disable(); - update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), (regs)->skas.is_user)); + irq_enter(); + update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), +(regs)->skas.is_user)); + irq_exit(); local_irq_enable(); if(current_thread->cpu == 0) timer_irq(regs); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/7] UML - Fix typo
From: Bodo Stroesser <[EMAIL PROTECTED]> Fix a typo in wait_stub_done. Signed-off-by: Bodo Stroesser <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12-rc3-mm2/arch/um/kernel/skas/process.c === --- linux-2.6.12-rc3-mm2.orig/arch/um/kernel/skas/process.c 2005-07-28 11:06:35.0 -0400 +++ linux-2.6.12-rc3-mm2/arch/um/kernel/skas/process.c 2005-07-28 11:44:07.0 -0400 @@ -64,7 +64,7 @@ (WSTOPSIG(status) == SIGVTALRM)); if((n < 0) || !WIFSTOPPED(status) || - (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status != SIGTRAP))){ + (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ panic("%s : failed to wait for SIGUSR1/SIGTRAP, " "pid = %d, n = %d, errno = %d, status = 0x%x\n", fname, pid, n, errno, status); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/7] UML - -mm3 compile fix
-mm3 adds an include of asm/vm86.h in include/asm-i386/ptrace.h. Since UML includes the underlying arch's ptrace.h, it needs an asm/vm86.h in order to build. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12-rc3-mm2/include/asm-um/vm86.h === --- linux-2.6.12-rc3-mm2.orig/include/asm-um/vm86.h 2005-07-28 05:04:34.593890552 -0400 +++ linux-2.6.12-rc3-mm2/include/asm-um/vm86.h 2005-07-28 11:13:32.0 -0400 @@ -0,0 +1,6 @@ +#ifndef __UM_VM86_H +#define __UM_VM86_H + +#include "asm/arch/vm86.h" + +#endif - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/7] UML - Fix redundant assignment
By this point, .is_user has already been set, so this assignment is useless. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/kernel/skas/trap_user.c === --- linux-2.6.12.orig/arch/um/kernel/skas/trap_user.c 2005-07-27 17:00:34.0 -0400 +++ linux-2.6.12/arch/um/kernel/skas/trap_user.c2005-07-27 17:01:58.0 -0400 @@ -58,7 +58,6 @@ int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || (sig == SIGILL) || (sig == SIGTRAP)); - regs->skas.is_user = 1; if (segv) get_skas_faultinfo(pid, ®s->skas.faultinfo); info = &sig_info[sig]; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/7] UML - Fix skas0 stub return
From: Bodo Stroesser <[EMAIL PROTECTED]> It's wrong to pop a fixed number of words from stack before calling sigreturn, as the number depends on what code is generated by the compiler for the start of stub_segv_handler(). What we need is esp containing the address of sigcontext. So we explicitly load that pointer into esp. Signed-off-by: Bodo Stroesser <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12-rc3-mm2/arch/um/sys-i386/stub_segv.c === --- linux-2.6.12-rc3-mm2.orig/arch/um/sys-i386/stub_segv.c 2005-07-27 17:22:18.0 -0400 +++ linux-2.6.12-rc3-mm2/arch/um/sys-i386/stub_segv.c 2005-07-28 10:35:18.0 -0400 @@ -21,10 +21,10 @@ __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid)); __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;" "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1)); - /* Pop the frame pointer and return address since we need to leave + /* Load pointer to sigcontext into esp, since we need to leave * the stack in its original form when we do the sigreturn here, by * hand. */ - __asm__("popl %%eax ; popl %%eax ; popl %%eax ; movl %0, %%eax ; " - "int $0x80" : : "g" (__NR_sigreturn)); + __asm__("mov %0,%%esp ; movl %1, %%eax ; " + "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/7] UML - Rename Kconfig files to be like the other arches
To the extent that sub-Kconfig files exist elsewhere in the tree, they are named Kconfig.foo, rather than the Kconfig_foo that UML has. This patch brings the names in line with the rest of the tree. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12-rc3-mm2/arch/um/Kconfig === --- linux-2.6.12-rc3-mm2.orig/arch/um/Kconfig 2005-07-28 12:26:17.0 -0400 +++ linux-2.6.12-rc3-mm2/arch/um/Kconfig2005-07-28 12:27:49.0 -0400 @@ -73,7 +73,7 @@ to CONFIG_MODE_TT). Otherwise, it is safe to say Y. Disabling this option will shrink the UML binary slightly. -source "arch/um/Kconfig_arch" +source "arch/um/Kconfig.arch" source "mm/Kconfig" config LD_SCRIPT_STATIC @@ -279,7 +279,7 @@ source "drivers/base/Kconfig" -source "arch/um/Kconfig_char" +source "arch/um/Kconfig.char" source "drivers/block/Kconfig" @@ -287,7 +287,7 @@ bool default NET -source "arch/um/Kconfig_net" +source "arch/um/Kconfig.net" source "drivers/net/Kconfig" @@ -311,7 +311,7 @@ depends on SCSI default y -source "arch/um/Kconfig_scsi" +source "arch/um/Kconfig.scsi" endmenu Index: linux-2.6.12-rc3-mm2/arch/um/Kconfig.char === --- linux-2.6.12-rc3-mm2.orig/arch/um/Kconfig.char 2005-07-28 05:04:34.593890552 -0400 +++ linux-2.6.12-rc3-mm2/arch/um/Kconfig.char 2005-07-28 12:27:49.0 -0400 @@ -0,0 +1,214 @@ + +menu "Character Devices" + +config STDERR_CONSOLE + bool "stderr console" + default y + help + console driver which dumps all printk messages to stderr. + +config STDIO_CONSOLE + bool + default y + +config SSL + bool "Virtual serial line" + help +The User-Mode Linux environment allows you to create virtual serial +lines on the UML that are usually made to show up on the host as +ttys or ptys. + +See <http://user-mode-linux.sourceforge.net/input.html> for more +information and command line examples of how to use this facility. + +Unless you have a specific reason for disabling this, say Y. + +config NULL_CHAN + bool "null channel support" + help +This option enables support for attaching UML consoles and serial +lines to a device similar to /dev/null. Data written to it disappears +and there is never any data to be read. + +config PORT_CHAN + bool "port channel support" + help +This option enables support for attaching UML consoles and serial +lines to host portals. They may be accessed with 'telnet +'. Any number of consoles and serial lines may be +attached to a single portal, although what UML device you get when +you telnet to that portal will be unpredictable. +It is safe to say 'Y' here. + +config PTY_CHAN + bool "pty channel support" + help +This option enables support for attaching UML consoles and serial +lines to host pseudo-terminals. Access to both traditional +pseudo-terminals (/dev/pty*) and pts pseudo-terminals are controlled +with this option. The assignment of UML devices to host devices +will be announced in the kernel message log. +It is safe to say 'Y' here. + +config TTY_CHAN + bool "tty channel support" + help +This option enables support for attaching UML consoles and serial +lines to host terminals. Access to both virtual consoles +(/dev/tty*) and the slave side of pseudo-terminals (/dev/ttyp* and +/dev/pts/*) are controlled by this option. +It is safe to say 'Y' here. + +config XTERM_CHAN + bool "xterm channel support" + help +This option enables support for attaching UML consoles and serial +lines to xterms. Each UML device so assigned will be brought up in +its own xterm. +If you disable this option, then CONFIG_PT_PROXY will be disabled as +well, since UML's gdb currently requires an xterm. +It is safe to say 'Y' here. + +config NOCONFIG_CHAN + bool + default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && NULL_CHAN) + +config CON_ZERO_CHAN + string "Default main console channel initialization" + default "fd:0,fd:1" + help +This is the string describing the channel to which the main console +will be attached by default. This value can be overridden from the +command line. The default value is "fd:0,fd:1", which attach
[PATCH] UML - Fix vsyscall brokenness
The #if/#ifdef cleanup exposed a bug in UML's ELF header processing. With this bug fixed, UML recognizes the vsyscall info coming from the host. On FC4, there is a vsyscall page low in the address space, which UML doesn't provide. This causes an infinite page fault loop and a hang on boot. This patch works around that by making this look like a no-vsyscall system. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12-rc3-mm2/arch/um/os-Linux/elf_aux.c === --- linux-2.6.12-rc3-mm2.orig/arch/um/os-Linux/elf_aux.c2005-07-28 12:08:54.0 -0400 +++ linux-2.6.12-rc3-mm2/arch/um/os-Linux/elf_aux.c 2005-07-28 18:47:31.0 -0400 @@ -9,9 +9,10 @@ */ #include #include +#include #include "init.h" #include "elf_user.h" -#include +#include "mem_user.h" #if ELF_CLASS == ELFCLASS32 typedef Elf32_auxv_t elf_auxv_t; @@ -41,6 +42,9 @@ break; case AT_SYSINFO_EHDR: vsyscall_ehdr = auxv->a_un.a_val; + /* See if the page is under TASK_SIZE */ + if (vsyscall_ehdr < (unsigned long) envp) + vsyscall_ehdr = 0; break; case AT_HWCAP: elf_aux_hwcap = auxv->a_un.a_val; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: status of kernel memory debugging?
On Sat, Jul 30, 2005 at 01:23:27PM +0200, Willem de Bruijn wrote: > Reading through some old LKML threads I see that there has been talk of > valgrinding a UML image, but the outcome appears inconclusive. Could someone > please update me on the status of memory debugging in the kernel, especially > regarding valgrind? UML is still too strange for valgrind, despite progress on both sides (valgrind accepting more strange things and UML becoming less strange). I tried grinding UML a month or so ago, and its use of clone was a sticking point. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] uml: share page bits handling between 2 and 3 level pagetables
On Thu, Jul 28, 2005 at 08:56:53PM +0200, [EMAIL PROTECTED] wrote: > As obvious, a "core code nice cleanup" is not a "stability-friendly patch" so > usual care applies. These look reasonable, as they are what we discussed in Ottawa. I'll put them in my tree and see if I see any problems. I would suggest sending these in early after 2.6.13 if they seem OK. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] UML - Remove debugging code from page fault path
This eliminates the segfault info ring buffer, which added a system call to each page fault, and which hadn't been useful for debugging in ages. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.12/arch/um/kernel/trap_kern.c === --- linux-2.6.12.orig/arch/um/kernel/trap_kern.c2005-07-31 12:54:35.0 -0400 +++ linux-2.6.12/arch/um/kernel/trap_kern.c 2005-07-31 13:18:40.0 -0400 @@ -200,30 +200,3 @@ void trap_init(void) { } - -DEFINE_SPINLOCK(trap_lock); - -static int trap_index = 0; - -int next_trap_index(int limit) -{ - int ret; - - spin_lock(&trap_lock); - ret = trap_index; - if(++trap_index == limit) - trap_index = 0; - spin_unlock(&trap_lock); - return(ret); -} - -/* - * 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/arch/um/kernel/trap_user.c === --- linux-2.6.12.orig/arch/um/kernel/trap_user.c2005-07-31 12:54:35.0 -0400 +++ linux-2.6.12/arch/um/kernel/trap_user.c 2005-07-31 13:18:02.0 -0400 @@ -40,35 +40,14 @@ } while(1); } -/* Unlocked - don't care if this is a bit off */ -int nsegfaults = 0; - -struct { - unsigned long address; - int is_write; - int pid; - unsigned long sp; - int is_user; -} segfault_record[1024]; - void segv_handler(int sig, union uml_pt_regs *regs) { - int index, max; struct faultinfo * fi = UPT_FAULTINFO(regs); if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ bad_segv(*fi, UPT_IP(regs)); return; } - max = sizeof(segfault_record)/sizeof(segfault_record[0]); - index = next_trap_index(max); - - nsegfaults++; -segfault_record[index].address = FAULT_ADDRESS(*fi); - segfault_record[index].pid = os_getpid(); -segfault_record[index].is_write = FAULT_WRITE(*fi); - segfault_record[index].sp = UPT_SP(regs); - segfault_record[index].is_user = UPT_IS_USER(regs); segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.13-rc6-rt9
On Sat, Aug 20, 2005 at 09:27:25PM +0200, Peter Zijlstra wrote: > Jeff, could you help us out here? > What exactly does uml need to get out of the calibrate delay loop? Interrupts, it's not too demanding :-) If it's not seeing VTALRM, then it will never leave the calibration loop. Try stracing it and see what it's getting. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/9] UML - Build cleanup
>From Al Viro - Build cleanups Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: linux-2.6.13-rc6/arch/um/Makefile === --- linux-2.6.13-rc6.orig/arch/um/Makefile 2005-08-15 12:03:04.0 -0400 +++ linux-2.6.13-rc6/arch/um/Makefile 2005-08-15 13:16:39.0 -0400 @@ -56,6 +56,7 @@ CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap +AFLAGS += $(ARCH_INCLUDE) USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ Index: linux-2.6.13-rc6/arch/um/sys-i386/Makefile === --- linux-2.6.13-rc6.orig/arch/um/sys-i386/Makefile 2005-08-15 12:02:57.0 -0400 +++ linux-2.6.13-rc6/arch/um/sys-i386/Makefile 2005-08-15 13:16:55.0 -0400 @@ -22,8 +22,6 @@ # why ask why? $(obj)/stub_segv.o : c_flags = $(STUB_CFLAGS) -$(obj)/stub.o : a_flags = $(STUB_CFLAGS) - subdir- := util include arch/um/scripts/Makefile.unmap Index: linux-2.6.13-rc6/arch/um/sys-x86_64/Makefile === --- linux-2.6.13-rc6.orig/arch/um/sys-x86_64/Makefile 2005-08-15 12:03:02.0 -0400 +++ linux-2.6.13-rc6/arch/um/sys-x86_64/Makefile2005-08-15 13:17:21.0 -0400 @@ -34,8 +34,6 @@ # why ask why? $(obj)/stub_segv.o : c_flags = $(STUB_CFLAGS) -$(obj)/stub.o : a_flags = $(STUB_CFLAGS) - subdir- := util include arch/um/scripts/Makefile.unmap - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 9/9] UML - Remove debugging code
This removes some long-unused debugging code. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Index: test/arch/um/kernel/trap_kern.c === --- test.orig/arch/um/kernel/trap_kern.c2005-06-17 15:48:29.0 -0400 +++ test/arch/um/kernel/trap_kern.c 2005-08-29 13:06:43.0 -0400 @@ -200,30 +200,3 @@ void trap_init(void) { } - -DEFINE_SPINLOCK(trap_lock); - -static int trap_index = 0; - -int next_trap_index(int limit) -{ - int ret; - - spin_lock(&trap_lock); - ret = trap_index; - if(++trap_index == limit) - trap_index = 0; - spin_unlock(&trap_lock); - return(ret); -} - -/* - * 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: test/arch/um/kernel/trap_user.c === --- test.orig/arch/um/kernel/trap_user.c2005-06-17 15:48:29.0 -0400 +++ test/arch/um/kernel/trap_user.c 2005-08-29 13:06:43.0 -0400 @@ -40,35 +40,14 @@ } while(1); } -/* Unlocked - don't care if this is a bit off */ -int nsegfaults = 0; - -struct { - unsigned long address; - int is_write; - int pid; - unsigned long sp; - int is_user; -} segfault_record[1024]; - void segv_handler(int sig, union uml_pt_regs *regs) { - int index, max; struct faultinfo * fi = UPT_FAULTINFO(regs); if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ bad_segv(*fi, UPT_IP(regs)); return; } - max = sizeof(segfault_record)/sizeof(segfault_record[0]); - index = next_trap_index(max); - - nsegfaults++; -segfault_record[index].address = FAULT_ADDRESS(*fi); - segfault_record[index].pid = os_getpid(); -segfault_record[index].is_write = FAULT_WRITE(*fi); - segfault_record[index].sp = UPT_SP(regs); - segfault_record[index].is_user = UPT_IS_USER(regs); segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/