linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH x86/mm 09/11] x86 ia32 ptrace arch merge
Date: Thu, 29 Nov 2007 23:58:52 +0300	[thread overview]
Message-ID: <20071129205852.GA1726@martell.zuzino.mipt.ru> (raw)
In-Reply-To: <20071129120041.8621A26F989@magilla.localdomain>

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;
> +	}

  reply	other threads:[~2007-11-29 20:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 11:57 [PATCH x86/mm 01/11] x86-32 thread_struct.debugreg Roland McGrath
2007-11-29 11:59 ` [PATCH x86/mm 02/11] x86: ptrace_32 renamed Roland McGrath
2007-11-29 11:59 ` [PATCH x86/mm 03/11] x86: ptrace FLAG_MASK cleanup Roland McGrath
2007-11-29 11:59 ` [PATCH x86/mm 04/11] x86 ptrace getreg/putreg cleanup Roland McGrath
2007-11-29 11:59 ` [PATCH x86/mm 05/11] x86 ptrace getreg/putreg merge Roland McGrath
2007-11-29 17:27   ` Andrew Morton
2007-11-29 22:28     ` Roland McGrath
2007-11-30 11:40       ` Ingo Molnar
2007-11-29 12:00 ` [PATCH x86/mm 06/11] x86 ptrace arch merge Roland McGrath
2007-11-29 17:28   ` Andrew Morton
2007-11-29 21:33     ` Roland McGrath
2007-11-29 12:00 ` [PATCH x86/mm 07/11] x86 ptrace merge syscall trace Roland McGrath
2007-11-29 12:00 ` [PATCH x86/mm 08/11] x86 ia32 ptrace getreg/putreg merge Roland McGrath
2007-11-29 17:37   ` Christoph Hellwig
2007-11-29 17:59     ` H. Peter Anvin
2007-11-29 19:50       ` Ingo Molnar
2007-11-29 12:00 ` [PATCH x86/mm 09/11] x86 ia32 ptrace arch merge Roland McGrath
2007-11-29 20:58   ` Alexey Dobriyan [this message]
2007-11-29 21:37     ` Roland McGrath
2007-11-30 11:34       ` Ingo Molnar
2007-11-29 12:00 ` [PATCH x86/mm 10/11] x86 ptrace merge complete Roland McGrath
2007-11-29 12:00 ` [PATCH x86/mm 11/11] x86 ptrace merge removals Roland McGrath
2007-11-29 14:04   ` Jeff Dike
2007-11-29 22:38     ` Roland McGrath
2007-11-30  0:03       ` Jeff Dike
2007-11-29 12:23 ` [PATCH x86/mm 01/11] x86-32 thread_struct.debugreg Ingo Molnar
2007-11-29 21:50   ` Roland McGrath
2007-11-29 23:02     ` Chuck Ebbert
2007-11-30  0:07     ` Jeff Dike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071129205852.GA1726@martell.zuzino.mipt.ru \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).