Skip to contentSkip to conversation

PATCH: 2.4.28: 32 bit ltrace oops when tracing 64 bit executable [X86_64]

PATCH Mark Bellon 1 participant 1 message Jan 5, 2005

lore
Share & tools
lore
#0 lore raw

Didn't see a fix for this so here it is. Tried using "ltrace -i" on a 64 bit executable when ltrace was a 32 bit executable. The kernel threw an oops.

The find_target routine (arch/x86/ia32/ptrace32.c) doesn't deal with a NULL return from find_task_by_pid properly - if NULL is returned put_task_struct() is still called.

mark

Index: arch/x86_64/ia32/ptrace32.c
===================================================================
RCS file: /cvsdev/mvl-kernel/linux/arch/x86_64/ia32/ptrace32.c,v retrieving revision 1.1.36.1.8.3

x86_64/ia32/ptrace32.c +4 -4
diff -a -u -r1.1.36.1.8.3 ptrace32.c
@@ -182,14 +182,14 @@
 			goto out;
 		*err = ptrace_check_attach(child, request == PTRACE_KILL); 
 		if (*err < 0) 
-				goto out;
+			goto out;
 		return child; 
-	} 
 
  out:
-	put_task_struct(child);
+		put_task_struct(child);
+	} 
+
 	return NULL; 
-	
 } 
 
 extern asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, unsigned long data);