* [uml-devel] [patch] uml-fixes-2.6.1-mm5-A1
@ 2004-01-20 19:17 Ingo Molnar
2004-01-20 19:43 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A0 Ingo Molnar
0 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2004-01-20 19:17 UTC (permalink / raw)
To: Jeff Dike; +Cc: user-mode-linux-devel, Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
Jeff, Andrew,
the attached patch is needed to make UML work on 2.6.1-mm5. It does the
following things:
- update UML to the extable changes
- remove __i386__ kgdb dependency from config.h. The config.h kgdb.h
thing is a kludge by itself i think - but this change doesnt make it
any better. It might break amd64 which has CONFIG_X86 too iirc - but
this unbreaks UML compilation.
- move i386 TASK_SIZE definition from page.h back to processor.h. This
was moved to page.h by the 4G/4G patch and there's no reason why we
couldnt leave it in processor.h. This unbreaks UML compilation.
- a top Makefile change broke UML compilation. I'm not sure why, but it
makes the difference.
with this patch applied, UML compiles & works fine.
Ingo
[-- Attachment #2: uml-fixes-2.6.1-mm5-A1 --]
[-- Type: text/plain, Size: 4038 bytes --]
--- linux/arch/um/sys-i386/extable.c.orig
+++ linux/arch/um/sys-i386/extable.c
@@ -1,30 +0,0 @@
-/*
- * linux/arch/i386/mm/extable.c
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <asm/uaccess.h>
-
-/* Simple binary search */
-const struct exception_table_entry *
-search_extable(const struct exception_table_entry *first,
- const struct exception_table_entry *last,
- unsigned long value)
-{
- while (first <= last) {
- const struct exception_table_entry *mid;
- long diff;
-
- mid = (last - first) / 2 + first;
- diff = mid->insn - value;
- if (diff == 0)
- return mid;
- else if (diff < 0)
- first = mid+1;
- else
- last = mid-1;
- }
- return NULL;
-}
--- linux/arch/um/sys-i386/Makefile.orig
+++ linux/arch/um/sys-i386/Makefile
@@ -1,4 +1,4 @@
-obj-y = bugs.o checksum.o extable.o fault.o ksyms.o ldt.o ptrace.o \
+obj-y = bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \
ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o time.o
obj-$(CONFIG_HIGHMEM) += highmem.o
--- linux/include/linux/config.h.orig
+++ linux/include/linux/config.h
@@ -2,7 +2,7 @@
#define _LINUX_CONFIG_H
#include <linux/autoconf.h>
-#if defined(__i386__) && !defined(IN_BOOTLOADER)
+#if defined(CONFIG_X86) && !defined(IN_BOOTLOADER)
#include <asm/kgdb.h>
#endif
--- linux/include/asm-i386/page.h.orig
+++ linux/include/asm-i386/page.h
@@ -79,30 +79,6 @@ typedef struct { unsigned long pgprot; }
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
/*
- * This handles the memory map.. We could make this a config
- * option, but too many people screw it up, and too few need
- * it.
- *
- * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
- * a virtual address space of one gigabyte, which limits the
- * amount of physical memory you can use to about 950MB.
- *
- * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
- * and CONFIG_HIGHMEM64G options in the kernel configuration.
- *
- * Note: on PAE the kernel must never go below 32 MB, we use the
- * first 8 entries of the 2-level boot pgd for PAE magic.
- */
-
-#ifdef CONFIG_X86_4G_VM_LAYOUT
-#define __PAGE_OFFSET (0x02000000)
-#define TASK_SIZE (0xff000000)
-#else
-#define __PAGE_OFFSET (0xc0000000)
-#define TASK_SIZE (0xc0000000)
-#endif
-
-/*
* This much address space is reserved for vmalloc() and iomap()
* as well as fixmap mappings.
*/
--- linux/include/asm-i386/processor.h.orig
+++ linux/include/asm-i386/processor.h
@@ -291,6 +291,30 @@ extern unsigned int machine_submodel_id;
extern unsigned int BIOS_revision;
extern unsigned int mca_pentium_flag;
+/*
+ * This handles the memory map.. We could make this a config
+ * option, but too many people screw it up, and too few need
+ * it.
+ *
+ * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
+ * a virtual address space of one gigabyte, which limits the
+ * amount of physical memory you can use to about 950MB.
+ *
+ * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
+ * and CONFIG_HIGHMEM64G options in the kernel configuration.
+ *
+ * Note: on PAE the kernel must never go below 32 MB, we use the
+ * first 8 entries of the 2-level boot pgd for PAE magic.
+ */
+
+#ifdef CONFIG_X86_4G_VM_LAYOUT
+#define __PAGE_OFFSET (0x02000000)
+#define TASK_SIZE (0xff000000)
+#else
+#define __PAGE_OFFSET (0xc0000000)
+#define TASK_SIZE (0xc0000000)
+#endif
+
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
*/
--- linux/Makefile.orig
+++ linux/Makefile
@@ -404,6 +404,10 @@ endif
include $(srctree)/arch/$(ARCH)/Makefile
+# Let architecture Makefiles change CPPFLAGS if needed
+CFLAGS := $(CPPFLAGS) $(CFLAGS)
+AFLAGS := $(CPPFLAGS) $(AFLAGS)
+
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/
SUBDIRS += $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
^ permalink raw reply [flat|nested] 11+ messages in thread* [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A0 2004-01-20 19:17 [uml-devel] [patch] uml-fixes-2.6.1-mm5-A1 Ingo Molnar @ 2004-01-20 19:43 ` Ingo Molnar 2004-01-20 20:01 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A1 Ingo Molnar 0 siblings, 1 reply; 11+ messages in thread From: Ingo Molnar @ 2004-01-20 19:43 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel, Andrew Morton [-- Attachment #1: Type: text/plain, Size: 128 bytes --] plus the attached patch is needed ontop of the previous one, to make x86 compile too. (and UML still compiles & works.) Ingo [-- Attachment #2: uml-fixes2-2.6.1-A0 --] [-- Type: text/plain, Size: 4154 bytes --] --- linux/arch/i386/kernel/head.S.orig +++ linux/arch/i386/kernel/head.S @@ -13,6 +13,7 @@ #include <linux/linkage.h> #include <asm/segment.h> #include <asm/page.h> +#include <asm/processor.h> #include <asm/pgtable.h> #include <asm/desc.h> #include <asm/cache.h> --- linux/arch/i386/kernel/vmlinux.lds.S.orig +++ linux/arch/i386/kernel/vmlinux.lds.S @@ -5,6 +5,7 @@ #include <asm-generic/vmlinux.lds.h> #include <linux/config.h> #include <asm/page.h> +#include <asm/processor.h> #include <asm/asm_offsets.h> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") --- linux/arch/i386/boot/setup.S.orig +++ linux/arch/i386/boot/setup.S @@ -59,6 +59,7 @@ #include <asm/e820.h> #include <asm/edd.h> #include <asm/page.h> +#include <asm/processor.h> /* Signature words to ensure LILO loaded us right */ #define SIG1 0xAA55 --- linux/include/asm-i386/processor.h.orig +++ linux/include/asm-i386/processor.h @@ -7,6 +7,8 @@ #ifndef __ASM_I386_PROCESSOR_H #define __ASM_I386_PROCESSOR_H +#ifndef __ASSEMBLY__ + #include <asm/vm86.h> #include <asm/math_emu.h> #include <asm/segment.h> @@ -649,4 +651,30 @@ extern void select_idle_routine(const st #define ARCH_HAS_SCHED_WAKE_BALANCE #endif +#endif /* ! __ASSEMBLY__ */ + +/* + * This handles the memory map.. We could make this a config + * option, but too many people screw it up, and too few need + * it. + * + * A __PAGE_OFFSET of 0xC0000000 means that the kernel has + * a virtual address space of one gigabyte, which limits the + * amount of physical memory you can use to about 950MB. + * + * If you want more physical memory than this then see the CONFIG_HIGHMEM4G + * and CONFIG_HIGHMEM64G options in the kernel configuration. + * + * Note: on PAE the kernel must never go below 32 MB, we use the + * first 8 entries of the 2-level boot pgd for PAE magic. + */ + +#ifdef CONFIG_X86_4G_VM_LAYOUT +#define __PAGE_OFFSET (0x02000000) +#define TASK_SIZE (0xff000000) +#else +#define __PAGE_OFFSET (0xc0000000) +#define TASK_SIZE (0xc0000000) +#endif + #endif /* __ASM_I386_PROCESSOR_H */ --- linux/scripts/Makefile.lib.orig +++ linux/scripts/Makefile.lib @@ -144,7 +144,8 @@ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_ # If building the kernel in a separate objtree expand all occurrences -# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). +# of -Idir to -Idir -I$(srctree)/dir. +# hereby allowing gcc to locate files in both trees. Local tree first. ifeq ($(KBUILD_SRC),) __c_flags = $(_c_flags) @@ -153,16 +154,15 @@ __hostc_flags = $(_hostc_flags) __hostcxx_flags = $(_hostcxx_flags) else flags = $(foreach o,$($(1)),\ - $(if $(filter -I%,$(filter-out -I/%,$(o))), \ - $(patsubst -I%,-I$(srctree)/%,$(o)),$(o))) + $(if $(filter -I%,$(o)),$(patsubst -I%,-I$(srctree)/%,$(o)),$(o))) -# -I$(obj) locates generated .h files -# -I$(srctree)/$(src) locates .h files in srctree, from generated .c files -# FIXME: Replace both with specific EXTRA_CFLAGS statements in the makefiles +# -I$(obj) locate generated .h files +# -I$(srctree)/$(src) locate .h files in srctree, from generated .c files +# FIXME: Replace both with specific EXTRA_CFLAGS statements __c_flags = -I$(obj) -I$(srctree)/$(src) $(call flags,_c_flags) __a_flags = $(call flags,_a_flags) __hostc_flags = -I$(obj) $(call flags,_hostc_flags) -__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) +__hostcxx_flags = $(call flags,_hostcxx_flags) endif c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ --- linux/Makefile.orig +++ linux/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 1 -EXTRAVERSION = -mm5 +EXTRAVERSION = # *DOCUMENTATION* # To see a list of typical targets execute "make help" @@ -445,10 +445,6 @@ ifdef CONFIG_DEBUG_INFO CFLAGS += -g endif -# Enable unit-at-a-time mode when possible. It shrinks the -# kernel considerably. -CFLAGS += $(call check_gcc,-funit-at-a-time,) - # warn about C99 declaration after statement CFLAGS += $(call check_gcc,-Wdeclaration-after-statement,) ^ permalink raw reply [flat|nested] 11+ messages in thread
* [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A1 2004-01-20 19:43 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A0 Ingo Molnar @ 2004-01-20 20:01 ` Ingo Molnar 2004-01-22 16:21 ` [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 Ingo Molnar 0 siblings, 1 reply; 11+ messages in thread From: Ingo Molnar @ 2004-01-20 20:01 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel, Andrew Morton [-- Attachment #1: Type: text/plain, Size: 280 bytes --] > plus the attached patch is needed ontop of the previous one, to make > x86 compile too. (and UML still compiles & works.) i've attached uml-fixes2-2.6.1-A1 which is a replacement for the uml-fixes2-2.6.1-A0 patch - the Makefile.lib and Makefile diffs were superfluous. Ingo [-- Attachment #2: uml-fixes2-2.6.1-A1 --] [-- Type: text/plain, Size: 2085 bytes --] --- linux/arch/i386/kernel/head.S.orig +++ linux/arch/i386/kernel/head.S @@ -13,6 +13,7 @@ #include <linux/linkage.h> #include <asm/segment.h> #include <asm/page.h> +#include <asm/processor.h> #include <asm/pgtable.h> #include <asm/desc.h> #include <asm/cache.h> --- linux/arch/i386/kernel/vmlinux.lds.S.orig +++ linux/arch/i386/kernel/vmlinux.lds.S @@ -5,6 +5,7 @@ #include <asm-generic/vmlinux.lds.h> #include <linux/config.h> #include <asm/page.h> +#include <asm/processor.h> #include <asm/asm_offsets.h> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") --- linux/arch/i386/boot/setup.S.orig +++ linux/arch/i386/boot/setup.S @@ -59,6 +59,7 @@ #include <asm/e820.h> #include <asm/edd.h> #include <asm/page.h> +#include <asm/processor.h> /* Signature words to ensure LILO loaded us right */ #define SIG1 0xAA55 --- linux/include/asm-i386/processor.h.orig +++ linux/include/asm-i386/processor.h @@ -7,6 +7,8 @@ #ifndef __ASM_I386_PROCESSOR_H #define __ASM_I386_PROCESSOR_H +#ifndef __ASSEMBLY__ + #include <asm/vm86.h> #include <asm/math_emu.h> #include <asm/segment.h> @@ -649,4 +651,30 @@ extern void select_idle_routine(const st #define ARCH_HAS_SCHED_WAKE_BALANCE #endif +#endif /* ! __ASSEMBLY__ */ + +/* + * This handles the memory map.. We could make this a config + * option, but too many people screw it up, and too few need + * it. + * + * A __PAGE_OFFSET of 0xC0000000 means that the kernel has + * a virtual address space of one gigabyte, which limits the + * amount of physical memory you can use to about 950MB. + * + * If you want more physical memory than this then see the CONFIG_HIGHMEM4G + * and CONFIG_HIGHMEM64G options in the kernel configuration. + * + * Note: on PAE the kernel must never go below 32 MB, we use the + * first 8 entries of the 2-level boot pgd for PAE magic. + */ + +#ifdef CONFIG_X86_4G_VM_LAYOUT +#define __PAGE_OFFSET (0x02000000) +#define TASK_SIZE (0xff000000) +#else +#define __PAGE_OFFSET (0xc0000000) +#define TASK_SIZE (0xc0000000) +#endif + #endif /* __ASM_I386_PROCESSOR_H */ ^ permalink raw reply [flat|nested] 11+ messages in thread
* [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 2004-01-20 20:01 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A1 Ingo Molnar @ 2004-01-22 16:21 ` Ingo Molnar 2004-01-22 18:42 ` Jeff Dike ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Ingo Molnar @ 2004-01-22 16:21 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel the patch below fixes a bug in UML that i've reproduced under 2.6.1-mm5. The bug hits in the following race scenario: if userspace() is just about to handle a SIGTRAP signal that it wants to relay_signal(), and SIGVTALRM hits the context before this happens but after is_user is set to 1 in userspace(), then we get a kernelspace-signal panic. Ought to be rare but definitely triggerable. Ingo --- linux/arch/um/kernel/skas/trap_user.c.orig +++ linux/arch/um/kernel/skas/trap_user.c @@ -19,8 +19,10 @@ void sig_handler_common_skas(int sig, vo struct skas_regs *r; struct signal_info *info; int save_errno = errno; + int save_user; r = &TASK_REGS(get_current())->skas; + save_user = r->is_user; r->is_user = 0; r->fault_addr = SC_FAULT_ADDR(sc); r->fault_type = SC_FAULT_TYPE(sc); @@ -32,6 +34,7 @@ void sig_handler_common_skas(int sig, vo (*info->handler)(sig, (union uml_pt_regs *) r); + r->is_user = save_user; errno = save_errno; } ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 2004-01-22 16:21 ` [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 Ingo Molnar @ 2004-01-22 18:42 ` Jeff Dike 2004-01-23 6:18 ` nsb034 2004-01-23 9:35 ` [uml-devel] " Ingo Molnar 2 siblings, 0 replies; 11+ messages in thread From: Jeff Dike @ 2004-01-22 18:42 UTC (permalink / raw) To: Ingo Molnar; +Cc: user-mode-linux-devel On Thu, Jan 22, 2004 at 05:21:39PM +0100, Ingo Molnar wrote: > the patch below fixes a bug in UML that i've reproduced under 2.6.1-mm5. > > The bug hits in the following race scenario: if userspace() is just > about to handle a SIGTRAP signal that it wants to relay_signal(), and > SIGVTALRM hits the context before this happens but after is_user is set > to 1 in userspace(), then we get a kernelspace-signal panic. Ought to be > rare but definitely triggerable. Applied, nice catch. Jeff ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 2004-01-22 16:21 ` [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 Ingo Molnar 2004-01-22 18:42 ` Jeff Dike @ 2004-01-23 6:18 ` nsb034 2004-01-28 4:39 ` Jeff Dike 2004-01-23 9:35 ` [uml-devel] " Ingo Molnar 2 siblings, 1 reply; 11+ messages in thread From: nsb034 @ 2004-01-23 6:18 UTC (permalink / raw) To: user-mode-linux-devel On Thu, Jan 22, 2004 at 05:21:39PM +0100, Ingo Molnar wrote: > > the patch below fixes a bug in UML that i've reproduced under 2.6.1-mm5. This fixes the bug "skas mode panic - ltrace strace" that occurs in uml-patch-2.4.23-2 and below. Could this patch please be applied to the 2.4.x kernels as well? Thanks, Dion. > --- linux/arch/um/kernel/skas/trap_user.c.orig > +++ linux/arch/um/kernel/skas/trap_user.c > @@ -19,8 +19,10 @@ void sig_handler_common_skas(int sig, vo > struct skas_regs *r; > struct signal_info *info; > int save_errno = errno; > + int save_user; > > r = &TASK_REGS(get_current())->skas; > + save_user = r->is_user; > r->is_user = 0; > r->fault_addr = SC_FAULT_ADDR(sc); > r->fault_type = SC_FAULT_TYPE(sc); > @@ -32,6 +34,7 @@ void sig_handler_common_skas(int sig, vo > > (*info->handler)(sig, (union uml_pt_regs *) r); > > + r->is_user = save_user; > errno = save_errno; > } > ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 2004-01-23 6:18 ` nsb034 @ 2004-01-28 4:39 ` Jeff Dike 0 siblings, 0 replies; 11+ messages in thread From: Jeff Dike @ 2004-01-28 4:39 UTC (permalink / raw) To: nsb034; +Cc: user-mode-linux-devel nsb034@lostrealm.com said: > This fixes the bug "skas mode panic - ltrace strace" that occurs in > uml-patch-2.4.23-2 and below. Could this patch please be applied to > the 2.4.x kernels as well? I did, and it will be in the next patch. Jeff ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* [uml-devel] Re: [patch] uml fixes, 2.6.1-mm5-A2 2004-01-22 16:21 ` [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 Ingo Molnar 2004-01-22 18:42 ` Jeff Dike 2004-01-23 6:18 ` nsb034 @ 2004-01-23 9:35 ` Ingo Molnar 2004-01-23 13:56 ` Jeff Dike 2 siblings, 1 reply; 11+ messages in thread From: Ingo Molnar @ 2004-01-23 9:35 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel hm, there's this code in arch/um/sys-i386/bugs.c:arch_handle_signal(): ip = UPT_IP(regs); if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40)) return(0); we are running in the UML kernel context here. Is the dereferencing of IP safe? Or does this SIGILL only ever happen for kernel code? (we dont seem to be filtering that out.) Ingo ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* [uml-devel] Re: [patch] uml fixes, 2.6.1-mm5-A2 2004-01-23 9:35 ` [uml-devel] " Ingo Molnar @ 2004-01-23 13:56 ` Jeff Dike 2004-01-23 13:51 ` Ingo Molnar 0 siblings, 1 reply; 11+ messages in thread From: Jeff Dike @ 2004-01-23 13:56 UTC (permalink / raw) To: Ingo Molnar; +Cc: user-mode-linux-devel On Fri, Jan 23, 2004 at 10:35:41AM +0100, Ingo Molnar wrote: > hm, there's this code in arch/um/sys-i386/bugs.c:arch_handle_signal(): > > ip = UPT_IP(regs); > if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40)) > return(0); > > we are running in the UML kernel context here. Is the dereferencing of > IP safe? No, it's not. There needs to be a copy_from_user in there. Jeff ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* [uml-devel] Re: [patch] uml fixes, 2.6.1-mm5-A2 2004-01-23 13:56 ` Jeff Dike @ 2004-01-23 13:51 ` Ingo Molnar 2004-01-23 16:09 ` Jeff Dike 0 siblings, 1 reply; 11+ messages in thread From: Ingo Molnar @ 2004-01-23 13:51 UTC (permalink / raw) To: Jeff Dike; +Cc: user-mode-linux-devel * Jeff Dike <jdike@addtoit.com> wrote: > On Fri, Jan 23, 2004 at 10:35:41AM +0100, Ingo Molnar wrote: > > hm, there's this code in arch/um/sys-i386/bugs.c:arch_handle_signal(): > > > > ip = UPT_IP(regs); > > if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40)) > > return(0); > > > > we are running in the UML kernel context here. Is the dereferencing of > > IP safe? > > No, it's not. There needs to be a copy_from_user in there. ok - partial patch below. (Couldnt figure out how to include the proper uaccess.h file to get copy_from_user() - so the build will fail with this patch for the time being.) Ingo --- linux/arch/um/sys-i386/bugs.c.orig +++ linux/arch/um/sys-i386/bugs.c @@ -183,15 +183,16 @@ void arch_check_bugs(void) int arch_handle_signal(int sig, union uml_pt_regs *regs) { - unsigned long ip; + unsigned char tmp[2]; /* This is testing for a cmov (0x0f 0x4x) instruction causing a * SIGILL in init. */ if((sig != SIGILL) || (TASK_PID(get_current()) != 1)) return(0); - ip = UPT_IP(regs); - if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40)) + if (copy_from_user(tmp, UPT_IP(regs), 2)) + panic("SIGILL in init, could not read instructions!\n"); + if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) return(0); if(host_has_cmov == 0) ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* [uml-devel] Re: [patch] uml fixes, 2.6.1-mm5-A2 2004-01-23 13:51 ` Ingo Molnar @ 2004-01-23 16:09 ` Jeff Dike 0 siblings, 0 replies; 11+ messages in thread From: Jeff Dike @ 2004-01-23 16:09 UTC (permalink / raw) To: Ingo Molnar; +Cc: user-mode-linux-devel On Fri, Jan 23, 2004 at 02:51:12PM +0100, Ingo Molnar wrote: > ok - partial patch below. Applied, thanks. BTW, in skas mode, this was more than just unsafe - it was just completely wrong, since the kernel has no direct access to process memory. > (Couldnt figure out how to include the proper > uaccess.h file to get copy_from_user() - so the build will fail with > this patch for the time being.) There is a procedure, copy_from_user_proc, which exists for this reason. Jeff ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-01-28 4:15 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-01-20 19:17 [uml-devel] [patch] uml-fixes-2.6.1-mm5-A1 Ingo Molnar 2004-01-20 19:43 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A0 Ingo Molnar 2004-01-20 20:01 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A1 Ingo Molnar 2004-01-22 16:21 ` [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 Ingo Molnar 2004-01-22 18:42 ` Jeff Dike 2004-01-23 6:18 ` nsb034 2004-01-28 4:39 ` Jeff Dike 2004-01-23 9:35 ` [uml-devel] " Ingo Molnar 2004-01-23 13:56 ` Jeff Dike 2004-01-23 13:51 ` Ingo Molnar 2004-01-23 16:09 ` Jeff Dike
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.