All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Ebbert <cebbert@redhat.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 6/6] x86-64 ia32 ptrace get/putreg32 current task
Date: Thu, 29 Nov 2007 12:34:28 -0500	[thread overview]
Message-ID: <474EF824.3020806@redhat.com> (raw)
In-Reply-To: <20071129004222.E49AD26F8E7@magilla.localdomain>

On 11/28/2007 07:42 PM, Roland McGrath wrote:
> --- a/arch/x86/ia32/ptrace32.c
> +++ b/arch/x86/ia32/ptrace32.c
> @@ -48,19 +48,27 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val)
>  		if (val && (val & 3) != 3)
>  			return -EIO;
>  		child->thread.fsindex = val & 0xffff;
> +		if (child == current)
> +			loadsegment(fs, child->thread.fsindex);
>  		break;
>  	case offsetof(struct user32, regs.gs):
>  		if (val && (val & 3) != 3)
>  			return -EIO;
>  		child->thread.gsindex = val & 0xffff;
> +		if (child == current)
> +			load_gs_index(child->thread.gsindex);
>  		break;
>  	case offsetof(struct user32, regs.ds):
>  		if (val && (val & 3) != 3)
>  			return -EIO;
>  		child->thread.ds = val & 0xffff;
> +		if (child == current)
> +			loadsegment(ds, child->thread.ds);
>  		break;
>  	case offsetof(struct user32, regs.es):
>  		child->thread.es = val & 0xffff;
> +		if (child == current)
> +			loadsegment(es, child->thread.ds);

                                        child->thread.es ??

> @@ -129,15 +137,23 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val)
>  	switch (regno) {
>  	case offsetof(struct user32, regs.fs):
>  		*val = child->thread.fsindex;
> +		if (child == current)
> +			asm("movl %%fs,%0" : "=r" (*val));
>  		break;
>  	case offsetof(struct user32, regs.gs):
>  		*val = child->thread.gsindex;
> +		if (child == current)
> +			asm("movl %%gs,%0" : "=r" (*val));

Won't this return the kernel's GS instead of the user's?

  reply	other threads:[~2007-11-29 17:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29  0:38 [PATCH x86/mm 1/6] x86-64 ia32 ptrace pt_regs cleanup Roland McGrath
2007-11-29  0:40 ` [PATCH x86/mm 2/6] x86-64 ptrace whitespace Roland McGrath
2007-11-29  0:40 ` [PATCH x86/mm 3/6] x86-32 " Roland McGrath
2007-11-29  0:41 ` [PATCH x86/mm 4/6] x86-64 ptrace get/putreg current task Roland McGrath
2007-11-29 17:39   ` Christoph Hellwig
2007-11-29  0:42 ` [PATCH x86/mm 5/6] x86-32 " Roland McGrath
2007-11-29  0:42 ` [PATCH x86/mm 6/6] x86-64 ia32 ptrace get/putreg32 " Roland McGrath
2007-11-29 17:34   ` Chuck Ebbert [this message]
2007-11-29 18:09     ` Linus Torvalds
2007-11-29 18:16       ` H. Peter Anvin
2007-11-29 18:31         ` Linus Torvalds
2007-11-29 18:45           ` H. Peter Anvin
2007-11-29 19:08             ` Linus Torvalds
2007-11-29 19:16               ` H. Peter Anvin
2007-11-29 19:27                 ` Andi Kleen
2007-11-29 19:44                   ` Ingo Molnar
2007-11-29 20:01                     ` H. Peter Anvin
2007-12-01 23:44                     ` Jeremy Fitzhardinge
2007-11-29 19:49                   ` Linus Torvalds
2007-11-29 20:11                     ` Andi Kleen
2007-11-29 20:23                       ` Linus Torvalds
2007-11-29 18:17       ` Chuck Ebbert
2007-11-29 18:23         ` H. Peter Anvin
2007-11-29 22:25       ` Roland McGrath
2007-11-29 22:34         ` Linus Torvalds
2007-11-29 22:21     ` Roland McGrath
2007-11-29 23:00       ` Chuck Ebbert
2007-11-29 10:39 ` [PATCH x86/mm 1/6] x86-64 ia32 ptrace pt_regs cleanup Ingo Molnar

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=474EF824.3020806@redhat.com \
    --to=cebbert@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.