[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061221183518.GA18827@slug>
Date: Thu, 21 Dec 2006 18:35:18 +0000
From: Frederik Deweerdt <deweerdt@...e.fr>
To: Andrew Morton <akpm@...l.org>
Cc: linux-kernel@...r.kernel.org, jeremy@...p.org
Subject: [-mm patch] ptrace: make {put,get}reg work again for gs and fs
On Thu, Dec 14, 2006 at 10:59:13PM -0800, Andrew Morton wrote:
> http://userweb.kernel.org/~akpm/2.6.20-rc1-mm1/
>
Hi all,
Following the i386 pda patches, it's not possible to set gs or fs value
from gdb anymore. The following patch restores the old behaviour of
getting and setting thread.gs of thread.fs respectively.
Here's a gdb session *before* the patch:
(gdb) info reg
[...]
fs 0x33 51
gs 0x33 51
(gdb) set $fs=0xffff
(gdb) info reg
[...]
fs 0x33 51
gs 0x33 51
(gdb) set $gs=0xffffffff
(gdb) info reg
[...]
fs 0xffff 65535
gs 0x33 51
Another one *after* the patch:
(gdb) info reg
[...]
fs 0xd8 216
gs 0x33 51
(gdb) set $fs=0xffff
(gdb) info reg
[...]
fs 0xffff 65535
gs 0x33 51
(gdb) set $gs=0xffff
(gdb) info reg
[...]
fs 0xffff 65535
gs 0xffff 65535
Andrew, this goes on top of ptrace-fix-efl_offset-value-according-to-i386-pda-changes.patch
sent by Jeremy yesterday.
Regards,
Frederik
Signed-off-by: Frederik Deweerdt <frederik.deweerdt@...il.com>
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index a803a49..7af494e 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -94,9 +94,13 @@ static int putreg(struct task_struct *child,
return -EIO;
child->thread.fs = value;
return 0;
+ case GS:
+ if (value && (value & 3) != 3)
+ return -EIO;
+ child->thread.gs = value;
+ return 0;
case DS:
case ES:
- case GS:
if (value && (value & 3) != 3)
return -EIO;
value &= 0xffff;
@@ -124,12 +128,14 @@ static unsigned long getreg(struct task_struct *child,
unsigned long retval = ~0UL;
switch (regno >> 2) {
+ case FS:
+ retval = child->thread.fs;
+ break;
case GS:
retval = child->thread.gs;
break;
case DS:
case ES:
- case FS:
case SS:
case CS:
retval = 0xffff;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists