From 18c75b75f49d042e43e48e4d2e7aaa73e528ec91 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 17 Oct 2003 20:34:02 +0000 Subject: [PATCH] - Oleg's fixes against 2.4.20-uml packed into single patch: uml_missing_include.patch - this one fixes a problem where uml cannot be built on new glibc system (e,g, RedHat severn) uml_signal_fix.patch - backport from 2.4.22-2um of signal fixes. Makes uml to work on 2.6.0-testX where X < 6 uml_newthreads_fix.patch - fixes immediate uml segfault when linked with new threads stuff (also from 2.4.22-2um) --- .../patches/uml-2.4.20-fixes-1.patch | 189 +++++++++++++++++++++ lustre/kernel_patches/pc/uml-2.4.20-fixes-1.pc | 8 + 2 files changed, 197 insertions(+) create mode 100644 lustre/kernel_patches/patches/uml-2.4.20-fixes-1.patch create mode 100644 lustre/kernel_patches/pc/uml-2.4.20-fixes-1.pc diff --git a/lustre/kernel_patches/patches/uml-2.4.20-fixes-1.patch b/lustre/kernel_patches/patches/uml-2.4.20-fixes-1.patch new file mode 100644 index 0000000..6cf70ac --- /dev/null +++ b/lustre/kernel_patches/patches/uml-2.4.20-fixes-1.patch @@ -0,0 +1,189 @@ + arch/um/kernel/process.c | 2 +- + arch/um/kernel/skas/process.c | 26 +++++++++++++------------- + arch/um/kernel/skas/syscall_kern.c | 3 ++- + arch/um/kernel/trap_user.c | 2 +- + arch/um/kernel/tt/syscall_kern.c | 3 ++- + arch/um/kernel/tt/uaccess_user.c | 2 +- + arch/um/kernel/uaccess_user.c | 2 +- + arch/um/link.ld.in | 1 - + 8 files changed, 21 insertions(+), 20 deletions(-) + +--- linux-2.4.20/arch/um/link.ld.in~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/link.ld.in 2003-10-17 23:04:53.000000000 +0400 +@@ -6,7 +6,6 @@ SECTIONS + { + . = START() + SIZEOF_HEADERS; + +- . = ALIGN(4096); + __binary_start = .; + ifdef(`MODE_TT', ` + .thread_private : { +--- linux-2.4.20/arch/um/kernel/process.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/process.c 2003-10-17 23:04:53.000000000 +0400 +@@ -232,7 +232,7 @@ int run_kernel_thread(int (*fn)(void *), + int n; + + *jmp_ptr = &buf; +- n = setjmp(buf); ++ n = sigsetjmp(buf, 1); + if(n != 0) + return(n); + (*fn)(arg); +--- linux-2.4.20/arch/um/kernel/skas/process.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/skas/process.c 2003-10-17 23:04:53.000000000 +0400 +@@ -59,11 +59,11 @@ static void handle_trap(int pid, union u + int err, syscall_nr, status; + + syscall_nr = PT_SYSCALL_NR(regs->skas.regs); ++ UPT_SYSCALL_NR(regs) = syscall_nr; + if(syscall_nr < 1){ + relay_signal(SIGTRAP, regs); + return; + } +- UPT_SYSCALL_NR(regs) = syscall_nr; + + err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid); + if(err < 0) +@@ -189,7 +189,7 @@ void new_thread(void *stack, void **swit + *switch_buf_ptr = &switch_buf; + *fork_buf_ptr = &fork_buf; + +- if(setjmp(fork_buf) == 0) ++ if(sigsetjmp(fork_buf, 1) == 0) + new_thread_proc(stack, handler); + + remove_sigstack(); +@@ -201,8 +201,8 @@ void thread_wait(void *sw, void *fb) + + *switch_buf = &buf; + fork_buf = fb; +- if(setjmp(buf) == 0) +- longjmp(*fork_buf, 1); ++ if(sigsetjmp(buf, 1) == 0) ++ siglongjmp(*fork_buf, 1); + } + + static int move_registers(int int_op, int fp_op, union uml_pt_regs *regs, +@@ -260,8 +260,8 @@ void switch_threads(void *me, void *next + jmp_buf my_buf, **me_ptr = me, *next_buf = next; + + *me_ptr = &my_buf; +- if(setjmp(my_buf) == 0) +- longjmp(*next_buf, 1); ++ if(sigsetjmp(my_buf, 1) == 0) ++ siglongjmp(*next_buf, 1); + } + + static jmp_buf initial_jmpbuf; +@@ -277,14 +277,14 @@ int start_idle_thread(void *stack, void + int n; + + *fork_buf_ptr = &initial_jmpbuf; +- n = setjmp(initial_jmpbuf); ++ n = sigsetjmp(initial_jmpbuf, 1); + if(n == 0) + new_thread_proc((void *) stack, new_thread_handler); + else if(n == 1) + remove_sigstack(); + else if(n == 2){ + (*cb_proc)(cb_arg); +- longjmp(*cb_back, 1); ++ siglongjmp(*cb_back, 1); + } + else if(n == 3){ + kmalloc_ok = 0; +@@ -294,7 +294,7 @@ int start_idle_thread(void *stack, void + kmalloc_ok = 0; + return(1); + } +- longjmp(**switch_buf, 1); ++ siglongjmp(**switch_buf, 1); + } + + void remove_sigstack(void) +@@ -316,8 +316,8 @@ void initial_thread_cb_skas(void (*proc) + cb_back = &here; + + block_signals(); +- if(setjmp(here) == 0) +- longjmp(initial_jmpbuf, 2); ++ if(sigsetjmp(here, 1) == 0) ++ siglongjmp(initial_jmpbuf, 2); + unblock_signals(); + + cb_proc = NULL; +@@ -328,13 +328,13 @@ void initial_thread_cb_skas(void (*proc) + void halt_skas(void) + { + block_signals(); +- longjmp(initial_jmpbuf, 3); ++ siglongjmp(initial_jmpbuf, 3); + } + + void reboot_skas(void) + { + block_signals(); +- longjmp(initial_jmpbuf, 4); ++ siglongjmp(initial_jmpbuf, 4); + } + + int new_mm(int from) +--- linux-2.4.20/arch/um/kernel/skas/syscall_kern.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/skas/syscall_kern.c 2003-10-17 23:04:53.000000000 +0400 +@@ -23,7 +23,8 @@ long execute_syscall_skas(void *r) + nsyscalls++; + syscall = UPT_SYSCALL_NR(®s->regs); + +- if((syscall >= NR_syscalls) || (syscall < 0)) ++ if((syscall >= NR_syscalls) || (syscall < 0) || ++ (sys_call_table[syscall] == NULL)) + res = -ENOSYS; + else res = EXECUTE_SYSCALL(syscall, regs); + +--- linux-2.4.20/arch/um/kernel/trap_user.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/trap_user.c 2003-10-17 23:04:53.000000000 +0400 +@@ -125,7 +125,7 @@ void do_longjmp(void *b, int val) + { + jmp_buf *buf = b; + +- longjmp(*buf, val); ++ siglongjmp(*buf, val); + } + + /* +--- linux-2.4.20/arch/um/kernel/tt/syscall_kern.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/tt/syscall_kern.c 2003-10-17 23:04:53.000000000 +0400 +@@ -113,7 +113,8 @@ long execute_syscall_tt(void *r) + nsyscalls++; + syscall = UPT_SYSCALL_NR(®s->regs); + +- if((syscall >= NR_syscalls) || (syscall < 0)) ++ if((syscall >= NR_syscalls) || (syscall < 0) || ++ (sys_call_table[syscall] == NULL)) + res = -ENOSYS; + else if(honeypot && check_bogosity(regs)) + res = -EFAULT; +--- linux-2.4.20/arch/um/kernel/tt/uaccess_user.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/tt/uaccess_user.c 2003-10-17 23:04:53.000000000 +0400 +@@ -75,7 +75,7 @@ int __do_strnlen_user(const char *str, u + jmp_buf jbuf; + + *fault_catcher = &jbuf; +- if(setjmp(jbuf) == 0){ ++ if(sigsetjmp(jbuf, 1) == 0){ + ret = strlen(str) + 1; + } + else { +--- linux-2.4.20/arch/um/kernel/uaccess_user.c~uml-2.4.20-fixes-1 2003-10-17 23:02:15.000000000 +0400 ++++ linux-2.4.20-alexey/arch/um/kernel/uaccess_user.c 2003-10-17 23:04:53.000000000 +0400 +@@ -20,7 +20,7 @@ unsigned long __do_user_copy(void *to, c + + jmp_buf jbuf; + *fault_catcher = &jbuf; +- if(setjmp(jbuf) == 0){ ++ if(sigsetjmp(jbuf, 1) == 0){ + (*op)(to, from, n); + ret = 0; + *faulted_out = 0; + +_ diff --git a/lustre/kernel_patches/pc/uml-2.4.20-fixes-1.pc b/lustre/kernel_patches/pc/uml-2.4.20-fixes-1.pc new file mode 100644 index 0000000..0805d2e --- /dev/null +++ b/lustre/kernel_patches/pc/uml-2.4.20-fixes-1.pc @@ -0,0 +1,8 @@ +arch/um/link.ld.in +arch/um/kernel/process.c +arch/um/kernel/skas/process.c +arch/um/kernel/skas/syscall_kern.c +arch/um/kernel/trap_user.c +arch/um/kernel/tt/syscall_kern.c +arch/um/kernel/tt/uaccess_user.c +arch/um/kernel/uaccess_user.c -- 1.8.3.1