Re: [PATCH x86/mm 09/11] x86 ia32 ptrace arch merge
From: Alexey Dobriyan
Date: Thu Nov 29 2007 - 15:59:21 EST
On Thu, Nov 29, 2007 at 04:00:41AM -0800, Roland McGrath wrote:
> This moves the sys32_ptrace code into arch/x86/kernel/ptrace.c,
> verbatim except for a few hard-coded sizes replaced with sizeof.
> Here this code can use the shared local functions in this file.
> --- a/arch/x86/kernel/ptrace.c
> +++ b/arch/x86/kernel/ptrace.c
> +asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
> +{
> + struct task_struct *child;
> + struct pt_regs *childregs;
> + void __user *datap = compat_ptr(data);
> + int ret;
> + __u32 val;
> +
> + switch (request) {
> + case PTRACE_PEEKDATA:
> + case PTRACE_PEEKTEXT:
> + ret = 0;
Dead write.
> + if (access_process_vm(child, addr, &val, sizeof(u32), 0) !=
> + sizeof(u32))
> + ret = -EIO;
> + else
> + ret = put_user(val, (unsigned int __user *)datap);
> + break;
> + case PTRACE_GETFPREGS:
> + ret = -EIO;
> + if (!access_ok(VERIFY_READ, compat_ptr(data),
> + sizeof(struct user_i387_struct)))
> + break;
> + save_i387_ia32(child, datap, childregs, 1);
> + ret = 0;
> + break;
More indentation than needed.
> + case PTRACE_GETFPXREGS: {
> + struct user32_fxsr_struct __user *u = datap;
> +
> + init_fpu(child);
> + ret = -EIO;
> + if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
> + break;
> + ret = -EFAULT;
Absent { }. :^)
> + if (__copy_to_user(u, &child->thread.i387.fxsave, sizeof(*u)))
> + break;
> + ret = __put_user(childregs->cs, &u->fcs);
> + ret |= __put_user(child->thread.ds, &u->fos);
> + break;
> + }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/