X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=arch%2Fum%2Fkernel%2Ftt%2Fsyscall_kern.c;h=c02e504e54c1b331d56b9f198e43f5050a8e1d0c;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=1b71f9ce51843193d9aa33be1a1b8ff07f043ab8;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/um/kernel/tt/syscall_kern.c b/arch/um/kernel/tt/syscall_kern.c index 1b71f9ce5..c02e504e5 100644 --- a/arch/um/kernel/tt/syscall_kern.c +++ b/arch/um/kernel/tt/syscall_kern.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) * Licensed under the GPL */ @@ -14,95 +14,6 @@ #include "sysdep/syscalls.h" #include "kern_util.h" -static inline int check_area(void *ptr, int size) -{ - return(verify_area(VERIFY_WRITE, ptr, size)); -} - -static int check_readlink(struct pt_regs *regs) -{ - return(check_area((void *) UPT_SYSCALL_ARG1(®s->regs), - UPT_SYSCALL_ARG2(®s->regs))); -} - -static int check_utime(struct pt_regs *regs) -{ - return(check_area((void *) UPT_SYSCALL_ARG1(®s->regs), - sizeof(struct utimbuf))); -} - -static int check_oldstat(struct pt_regs *regs) -{ - return(check_area((void *) UPT_SYSCALL_ARG1(®s->regs), - sizeof(struct __old_kernel_stat))); -} - -static int check_stat(struct pt_regs *regs) -{ - return(check_area((void *) UPT_SYSCALL_ARG1(®s->regs), - sizeof(struct stat))); -} - -static int check_stat64(struct pt_regs *regs) -{ - return(check_area((void *) UPT_SYSCALL_ARG1(®s->regs), - sizeof(struct stat64))); -} - -struct bogus { - int kernel_ds; - int (*check_params)(struct pt_regs *); -}; - -struct bogus this_is_bogus[256] = { - [ __NR_mknod ] = { 1, NULL }, - [ __NR_mkdir ] = { 1, NULL }, - [ __NR_rmdir ] = { 1, NULL }, - [ __NR_unlink ] = { 1, NULL }, - [ __NR_symlink ] = { 1, NULL }, - [ __NR_link ] = { 1, NULL }, - [ __NR_rename ] = { 1, NULL }, - [ __NR_umount ] = { 1, NULL }, - [ __NR_mount ] = { 1, NULL }, - [ __NR_pivot_root ] = { 1, NULL }, - [ __NR_chdir ] = { 1, NULL }, - [ __NR_chroot ] = { 1, NULL }, - [ __NR_open ] = { 1, NULL }, - [ __NR_quotactl ] = { 1, NULL }, - [ __NR_sysfs ] = { 1, NULL }, - [ __NR_readlink ] = { 1, check_readlink }, - [ __NR_acct ] = { 1, NULL }, - [ __NR_execve ] = { 1, NULL }, - [ __NR_uselib ] = { 1, NULL }, - [ __NR_statfs ] = { 1, NULL }, - [ __NR_truncate ] = { 1, NULL }, - [ __NR_access ] = { 1, NULL }, - [ __NR_chmod ] = { 1, NULL }, - [ __NR_chown ] = { 1, NULL }, - [ __NR_lchown ] = { 1, NULL }, - [ __NR_utime ] = { 1, check_utime }, - [ __NR_oldlstat ] = { 1, check_oldstat }, - [ __NR_oldstat ] = { 1, check_oldstat }, - [ __NR_stat ] = { 1, check_stat }, - [ __NR_lstat ] = { 1, check_stat }, - [ __NR_stat64 ] = { 1, check_stat64 }, - [ __NR_lstat64 ] = { 1, check_stat64 }, - [ __NR_chown32 ] = { 1, NULL }, -}; - -/* sys_utimes */ - -static int check_bogosity(struct pt_regs *regs) -{ - struct bogus *bogon = &this_is_bogus[UPT_SYSCALL_NR(®s->regs)]; - - if(!bogon->kernel_ds) return(0); - if(bogon->check_params && (*bogon->check_params)(regs)) - return(-EFAULT); - set_fs(KERNEL_DS); - return(0); -} - extern syscall_handler_t *sys_call_table[]; long execute_syscall_tt(void *r) @@ -117,18 +28,8 @@ long execute_syscall_tt(void *r) if((syscall >= NR_syscalls) || (syscall < 0)) res = -ENOSYS; - else if(honeypot && check_bogosity(regs)) - res = -EFAULT; else res = EXECUTE_SYSCALL(syscall, regs); - set_fs(USER_DS); - - if(current->thread.mode.tt.singlestep_syscall){ - current->thread.mode.tt.singlestep_syscall = 0; - current->ptrace &= ~PT_DTRACE; - force_sig(SIGTRAP, current); - } - return(res); }