1 Oct 2004 20:26
Security patch 3 of 3
Stroesser, Bodo <Bodo.Stroesser <at> fujitsu-siemens.com>
2004-10-01 18:26:47 GMT
2004-10-01 18:26:47 GMT
This one removes singlestepping_tt() and singlestepping_skas() and
Inserts singlestepping() instead.
Now SKAS mode should be OK, with the exception of the vsyscall page.
I have tested in tt and skas mode.
Bodo
--- linux-2.6.9-rc2-orig/arch/um/kernel/skas/process.c 2004-10-01
15:34:49.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/skas/process.c 2004-10-01
18:23:35.481627322 +0200
<at> <at> -185,10 +185,10 <at> <at>
local_using_sysemu = get_using_sysemu();
if (local_using_sysemu)
- op = singlestepping_skas() ? PTRACE_SINGLESTEP :
+ op = singlestepping(NULL) ? PTRACE_SINGLESTEP :
PTRACE_SYSEMU;
else
- op = singlestepping_skas() ? PTRACE_SINGLESTEP :
+ op = singlestepping(NULL) ? PTRACE_SINGLESTEP :
PTRACE_SYSCALL;
err = ptrace(op, pid, 0, 0);
--- linux-2.6.9-rc2-orig/arch/um/kernel/skas/include/skas.h
2004-10-01 15:34:49.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/skas/include/skas.h 2004-10-01
18:25:13.728391472 +0200
<at> <at> -28,7 +28,6 <at> <at>
extern int protect(int fd, unsigned long addr, unsigned long len,
int r, int w, int x, int must_succeed);
extern void user_signal(int sig, union uml_pt_regs *regs);
-extern int singlestepping_skas(void);
extern int new_mm(int from);
extern void start_userspace(int cpu);
--- linux-2.6.9-rc2-orig/arch/um/kernel/skas/syscall_kern.c
2004-09-13 07:32:54.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/skas/syscall_kern.c 2004-10-01
18:28:35.139107179 +0200
<at> <at> -4,6 +4,7 <at> <at>
*/
#include "linux/sys.h"
+#include "linux/ptrace.h"
#include "asm/errno.h"
#include "asm/unistd.h"
#include "asm/ptrace.h"
<at> <at> -27,6 +28,12 <at> <at>
res = -ENOSYS;
else res = EXECUTE_SYSCALL(syscall, regs);
+ if(current->thread.singlestep_syscall){
+ current->thread.singlestep_syscall = 0;
+ current->ptrace &= ~PT_DTRACE;
+ force_sig(SIGTRAP, current);
+ }
+
return(res);
}
--- linux-2.6.9-rc2-orig/arch/um/kernel/skas/process_kern.c
2004-10-01 15:34:49.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/skas/process_kern.c 2004-10-01
18:30:21.989449538 +0200
<at> <at> -79,14 +79,6 <at> <at>
late_initcall(make_proc_sysemu);
-int singlestepping_skas(void)
-{
- int ret = current->ptrace & PT_DTRACE;
-
- current->ptrace &= ~PT_DTRACE;
- return(ret);
-}
-
void *switch_to_skas(void *prev, void *next)
{
struct task_struct *from, *to;
--- linux-2.6.9-rc2-orig/arch/um/kernel/tt/tracer.c 2004-09-29
14:49:59.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/tt/tracer.c 2004-10-01
18:33:30.732258690 +0200
<at> <at> -367,7 +367,7 <at> <at>
}
if(tracing){
- if(singlestepping_tt(task))
+ if(singlestepping(task))
cont_type = PTRACE_SINGLESTEP;
else cont_type = PTRACE_SYSCALL;
}
--- linux-2.6.9-rc2-orig/arch/um/kernel/tt/include/tt.h 2004-09-13
07:32:54.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/tt/include/tt.h 2004-10-01
18:34:01.584160234 +0200
<at> <at> -24,7 +24,6 <at> <at>
extern int set_user_mode(void *task);
extern void set_tracing(void *t, int tracing);
extern int is_tracing(void *task);
-extern int singlestepping_tt(void *t);
extern void clear_singlestep(void *t);
extern void syscall_handler(int sig, union uml_pt_regs *regs);
extern void exit_kernel(int pid, void *task);
--- linux-2.6.9-rc2-orig/arch/um/kernel/tt/process_kern.c
2004-10-01 18:17:49.961726497 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/tt/process_kern.c 2004-10-01
18:36:17.124761361 +0200
<at> <at> -524,15 +524,6 <at> <at>
-err);
}
-int singlestepping_tt(void *t)
-{
- struct task_struct *task = t;
-
- if(task->thread.singlestep_syscall)
- return(0);
- return(task->ptrace & PT_DTRACE);
-}
-
void clear_singlestep(void *t)
{
struct task_struct *task = t;
--- linux-2.6.9-rc2-orig/arch/um/kernel/process_kern.c 2004-09-29
14:49:59.000000000 +0200
+++ linux-2.6.9-rc2/arch/um/kernel/process_kern.c 2004-10-01
18:42:27.756512307 +0200
<at> <at> -19,6 +19,7 <at> <at>
#include "linux/capability.h"
#include "linux/vmalloc.h"
#include "linux/spinlock.h"
+#include "linux/ptrace.h"
#include "asm/unistd.h"
#include "asm/mman.h"
#include "asm/segment.h"
<at> <at> -400,6 +401,15 <at> <at>
return(current_thread->cpu);
}
+int singlestepping(void * t)
+{
+ struct task_struct *task = t ? t : current;
+
+ if (task->thread.singlestep_syscall)
+ return(0);
+ return(task->ptrace & PT_DTRACE);
+}
+
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and
automatically
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
RSS Feed