diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/crash.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/i386/kernel/traps.c | 40 | ||||
-rw-r--r-- | arch/i386/lib/usercopy.c | 2 | ||||
-rw-r--r-- | arch/um/Makefile-x86_64 | 1 | ||||
-rw-r--r-- | arch/um/include/longjmp.h | 4 | ||||
-rw-r--r-- | arch/um/include/os.h | 68 | ||||
-rw-r--r-- | arch/um/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/process.c | 8 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 16 | ||||
-rw-r--r-- | arch/um/os-Linux/uaccess.c | 3 |
11 files changed, 73 insertions, 78 deletions
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c index 48f0f62f781..5b96f038367 100644 --- a/arch/i386/kernel/crash.c +++ b/arch/i386/kernel/crash.c @@ -90,7 +90,7 @@ static void crash_save_self(struct pt_regs *regs) crash_save_this_cpu(regs, cpu); } -#ifdef CONFIG_SMP +#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) static atomic_t waiting_for_crash_ipi; static int crash_nmi_callback(struct pt_regs *regs, int cpu) diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 7864395c144..f1682206d30 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -1327,7 +1327,10 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat res->start = e820.map[i].addr; res->end = res->start + e820.map[i].size - 1; res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; - request_resource(&iomem_resource, res); + if (request_resource(&iomem_resource, res)) { + kfree(res); + continue; + } if (e820.map[i].type == E820_RAM) { /* * We don't know which RAM region contains kernel data, diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 5cfd4f42eeb..313ac1f7dc5 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -324,35 +324,35 @@ void show_registers(struct pt_regs *regs) static void handle_BUG(struct pt_regs *regs) { + unsigned long eip = regs->eip; unsigned short ud2; - unsigned short line; - char *file; - char c; - unsigned long eip; - - eip = regs->eip; if (eip < PAGE_OFFSET) - goto no_bug; + return; if (__get_user(ud2, (unsigned short __user *)eip)) - goto no_bug; + return; if (ud2 != 0x0b0f) - goto no_bug; - if (__get_user(line, (unsigned short __user *)(eip + 2))) - goto bug; - if (__get_user(file, (char * __user *)(eip + 4)) || - (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) - file = "<bad filename>"; + return; printk(KERN_EMERG "------------[ cut here ]------------\n"); - printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line); -no_bug: - return; +#ifdef CONFIG_DEBUG_BUGVERBOSE + do { + unsigned short line; + char *file; + char c; - /* Here we know it was a BUG but file-n-line is unavailable */ -bug: - printk(KERN_EMERG "Kernel BUG\n"); + if (__get_user(line, (unsigned short __user *)(eip + 2))) + break; + if (__get_user(file, (char * __user *)(eip + 4)) || + (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) + file = "<bad filename>"; + + printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line); + return; + } while (0); +#endif + printk(KERN_EMERG "Kernel BUG at [verbose debug info unavailable]\n"); } /* This is gone through when something in the kernel diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c index 4b75212ab6d..efc7e7d5f4d 100644 --- a/arch/i386/lib/usercopy.c +++ b/arch/i386/lib/usercopy.c @@ -843,7 +843,6 @@ unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *fr unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) { - might_sleep(); BUG_ON((long) n < 0); if (access_ok(VERIFY_WRITE, to, n)) n = __copy_to_user(to, from, n); @@ -870,7 +869,6 @@ EXPORT_SYMBOL(copy_to_user); unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) { - might_sleep(); BUG_ON((long) n < 0); if (access_ok(VERIFY_READ, from, n)) n = __copy_from_user(to, from, n); diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64 index dffd1184c95..9558a7cf34d 100644 --- a/arch/um/Makefile-x86_64 +++ b/arch/um/Makefile-x86_64 @@ -11,6 +11,7 @@ USER_CFLAGS += -fno-builtin -m64 CHECKFLAGS += -m64 AFLAGS += -m64 LDFLAGS += -m elf_x86_64 +CPPFLAGS += -m64 ELF_ARCH := i386:x86-64 ELF_FORMAT := elf64-x86-64 diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h index 8e7053013f7..1b5c0131a12 100644 --- a/arch/um/include/longjmp.h +++ b/arch/um/include/longjmp.h @@ -8,8 +8,8 @@ longjmp(*buf, val); \ } while(0) -#define UML_SETJMP(buf, enable) ({ \ - int n; \ +#define UML_SETJMP(buf) ({ \ + int n, enable; \ enable = get_signals(); \ n = setjmp(*buf); \ if(n != 0) \ diff --git a/arch/um/include/os.h b/arch/um/include/os.h index b6c52496e15..5316e8a4a4f 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Licensed under the GPL */ @@ -15,9 +15,9 @@ #include "irq_user.h" #include "sysdep/tls.h" -#define OS_TYPE_FILE 1 -#define OS_TYPE_DIR 2 -#define OS_TYPE_SYMLINK 3 +#define OS_TYPE_FILE 1 +#define OS_TYPE_DIR 2 +#define OS_TYPE_SYMLINK 3 #define OS_TYPE_CHARDEV 4 #define OS_TYPE_BLOCKDEV 5 #define OS_TYPE_FIFO 6 @@ -61,68 +61,68 @@ struct openflags { }; #define OPENFLAGS() ((struct openflags) { .r = 0, .w = 0, .s = 0, .c = 0, \ - .t = 0, .a = 0, .e = 0, .cl = 0 }) + .t = 0, .a = 0, .e = 0, .cl = 0 }) static inline struct openflags of_read(struct openflags flags) { - flags.r = 1; - return(flags); + flags.r = 1; + return flags; } static inline struct openflags of_write(struct openflags flags) { - flags.w = 1; - return(flags); + flags.w = 1; + return flags; } static inline struct openflags of_rdwr(struct openflags flags) { - return(of_read(of_write(flags))); + return of_read(of_write(flags)); } static inline struct openflags of_set_rw(struct openflags flags, int r, int w) { flags.r = r; flags.w = w; - return(flags); + return flags; } static inline struct openflags of_sync(struct openflags flags) -{ - flags.s = 1; - return(flags); +{ + flags.s = 1; + return flags; } static inline struct openflags of_create(struct openflags flags) -{ - flags.c = 1; - return(flags); +{ + flags.c = 1; + return flags; } - + static inline struct openflags of_trunc(struct openflags flags) -{ - flags.t = 1; - return(flags); +{ + flags.t = 1; + return flags; } - + static inline struct openflags of_append(struct openflags flags) -{ - flags.a = 1; - return(flags); +{ + flags.a = 1; + return flags; } - + static inline struct openflags of_excl(struct openflags flags) -{ - flags.e = 1; - return(flags); +{ + flags.e = 1; + return flags; } static inline struct openflags of_cloexec(struct openflags flags) -{ - flags.cl = 1; - return(flags); +{ + flags.cl = 1; + return flags; } - + /* file.c */ extern int os_stat_file(const char *file_name, struct uml_stat *buf); extern int os_stat_fd(const int fd, struct uml_stat *buf); @@ -204,7 +204,7 @@ extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); extern int os_map_memory(void *virt, int fd, unsigned long long off, unsigned long len, int r, int w, int x); -extern int os_protect_memory(void *addr, unsigned long len, +extern int os_protect_memory(void *addr, unsigned long len, int r, int w, int x); extern int os_unmap_memory(void *addr, int len); extern int os_drop_memory(void *addr, int length); diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S index 72acdce205e..f8aeb448aab 100644 --- a/arch/um/kernel/vmlinux.lds.S +++ b/arch/um/kernel/vmlinux.lds.S @@ -1,5 +1,3 @@ -/* in case the preprocessor is a 32bit one */ -#undef i386 #ifdef CONFIG_LD_SCRIPT_STATIC #include "uml.lds.S" #else diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index b1cda818f5b..b98d3ca2cd1 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -273,12 +273,12 @@ void init_new_thread_signals(void) int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { jmp_buf buf; - int n, enable; + int n; *jmp_ptr = &buf; - n = UML_SETJMP(&buf, enable); + n = UML_SETJMP(&buf); if(n != 0) - return(n); + return n; (*fn)(arg); - return(0); + return 0; } diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index bf35572d9cf..7baf90fda58 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -435,7 +435,6 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, { unsigned long flags; jmp_buf switch_buf, fork_buf; - int enable; *switch_buf_ptr = &switch_buf; *fork_buf_ptr = &fork_buf; @@ -450,7 +449,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, */ flags = get_signals(); block_signals(); - if(UML_SETJMP(&fork_buf, enable) == 0) + if(UML_SETJMP(&fork_buf) == 0) new_thread_proc(stack, handler); remove_sigstack(); @@ -467,21 +466,19 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, void thread_wait(void *sw, void *fb) { jmp_buf buf, **switch_buf = sw, *fork_buf; - int enable; *switch_buf = &buf; fork_buf = fb; - if(UML_SETJMP(&buf, enable) == 0) + if(UML_SETJMP(&buf) == 0) siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); } void switch_threads(void *me, void *next) { jmp_buf my_buf, **me_ptr = me, *next_buf = next; - int enable; *me_ptr = &my_buf; - if(UML_SETJMP(&my_buf, enable) == 0) + if(UML_SETJMP(&my_buf) == 0) UML_LONGJMP(next_buf, 1); } @@ -495,14 +492,14 @@ static jmp_buf *cb_back; int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) { jmp_buf **switch_buf = switch_buf_ptr; - int n, enable; + int n; set_handler(SIGWINCH, (__sighandler_t) sig_handler, SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, SIGVTALRM, -1); *fork_buf_ptr = &initial_jmpbuf; - n = UML_SETJMP(&initial_jmpbuf, enable); + n = UML_SETJMP(&initial_jmpbuf); switch(n){ case INIT_JMP_NEW_THREAD: new_thread_proc((void *) stack, new_thread_handler); @@ -529,14 +526,13 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) void initial_thread_cb_skas(void (*proc)(void *), void *arg) { jmp_buf here; - int enable; cb_proc = proc; cb_arg = arg; cb_back = &here; block_signals(); - if(UML_SETJMP(&here, enable) == 0) + if(UML_SETJMP(&here) == 0) UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); unblock_signals(); diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c index e523719330b..865f6a6a259 100644 --- a/arch/um/os-Linux/uaccess.c +++ b/arch/um/os-Linux/uaccess.c @@ -14,11 +14,10 @@ unsigned long __do_user_copy(void *to, const void *from, int n, int n), int *faulted_out) { unsigned long *faddrp = (unsigned long *) fault_addr, ret; - int enable; jmp_buf jbuf; *fault_catcher = &jbuf; - if(UML_SETJMP(&jbuf, enable) == 0){ + if(UML_SETJMP(&jbuf) == 0){ (*op)(to, from, n); ret = 0; *faulted_out = 0; |