aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/ia32
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2007-11-06 18:30:38 -0500
committerThomas Gleixner <tglx@apollo.(none)>2007-11-09 22:30:36 -0500
commitfd181c72a3c202a3986bcee7551c0838265aec2a (patch)
treeb07b0a662baaace2c5addfca77b537e1267e8d12 /arch/x86/ia32
parent1a0c3ea65ca4838a803a14f0ff2bfc78aa69c9a0 (diff)
x86_64: ia32 ptrace THREAD_AREA fix
The addr argument to PTRACE_GET_THREAD_AREA and PTRACE_SET_THREAD_AREA is not a magic constant. It's derived from the segment register values being used, which are computed originally from the index used with set_thread_area. The value does not need to match what a native i386 kernel would accept. It needs to match the segment selectors that can actually be in use in this 32-bit process. The 64-bit ptrace support for PTRACE_GET_THREAD_AREA (normally used only on 32-bit processes) is correct, but the 32-bit emulation of ptrace is broken. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/ia32')
-rw-r--r--arch/x86/ia32/ptrace32.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/arch/x86/ia32/ptrace32.c b/arch/x86/ia32/ptrace32.c
index f52770ef0ee3..4a233ad6269c 100644
--- a/arch/x86/ia32/ptrace32.c
+++ b/arch/x86/ia32/ptrace32.c
@@ -228,8 +228,6 @@ static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data)
228 return ret; 228 return ret;
229} 229}
230 230
231#define COMPAT_GDT_ENTRY_TLS_MIN 6
232
233asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) 231asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
234{ 232{
235 struct task_struct *child; 233 struct task_struct *child;
@@ -248,6 +246,8 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
248 case PTRACE_SYSCALL: 246 case PTRACE_SYSCALL:
249 case PTRACE_OLDSETOPTIONS: 247 case PTRACE_OLDSETOPTIONS:
250 case PTRACE_SETOPTIONS: 248 case PTRACE_SETOPTIONS:
249 case PTRACE_SET_THREAD_AREA:
250 case PTRACE_GET_THREAD_AREA:
251 return sys_ptrace(request, pid, addr, data); 251 return sys_ptrace(request, pid, addr, data);
252 252
253 default: 253 default:
@@ -271,12 +271,6 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
271 case PTRACE_SETSIGINFO: 271 case PTRACE_SETSIGINFO:
272 case PTRACE_GETSIGINFO: 272 case PTRACE_GETSIGINFO:
273 return ptrace32_siginfo(request, pid, addr, data); 273 return ptrace32_siginfo(request, pid, addr, data);
274
275 case PTRACE_SET_THREAD_AREA:
276 case PTRACE_GET_THREAD_AREA:
277 return sys_ptrace(request, pid,
278 addr + GDT_ENTRY_TLS_MIN - COMPAT_GDT_ENTRY_TLS_MIN,
279 data);
280 } 274 }
281 275
282 child = ptrace_get_task_struct(pid); 276 child = ptrace_get_task_struct(pid);