Skip to contentSkip to conversation

2.6.2-rc3 broke ptrace in the vsyscall dso area

DISCUSSION Daniel Jacobowitz 2 participants 3 messages Feb 2, 2004 MM core

lore
Share & tools
lore
#0 lore raw

My last kernel was unfortunately 2.6.0-test7, so I can't say exactly when this broke. But suddenly I get:

ptrace(PTRACE_PEEKTEXT, 10259, 0xffffe000, [0xbfffe948]) = -1 EIO (Input/output error) ptrace(PTRACE_PEEKTEXT, 10259, 0xffffe000, [0xbfffe948]) = -1 EIO (Input/output error)

Any idea what might have disabled this?

Signature · 2 lines
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer
#1 lore raw
Quoted 1 line

Any idea what might have disabled this?

...Mosberger!! When Andrew asked me to sign off on David's rework of that code, I did so with the caveat that it be tested on i386 before being accepted, and evidently it never was.

The #include is the part of this patch that matters, so the #ifdef below works. (Frankly, I have never seen the rationale for conditionalizing this code on AT_SYSINFO_EHDR rather than just FIXADDR_USER_START. But David wanted it that way and Andrew approved it.) The rest of the patch removes gratuitous duplication due to some strange aversion to concision in the presence of #ifdef, the kind that is all too common, utterly pointless, and error prone.

Thanks,
Roland

Index: linux-2.6/include/linux/mm.h
===================================================================
RCS file: /home/roland/redhat/bkcvs/linux-2.5/include/linux/mm.h,v retrieving revision 1.137

include/linux/mm.h 2 Feb 2004 05:20:11 -0000 renamed from include/linux/mm.h 20 Jan 2004 05:12:38 -0000 1.137 +6 -12
diff -p -u -r1.137 mm.h
@@ -12,6 +12,7 @@
 #include <linux/mmzone.h>
 #include <linux/rbtree.h>
 #include <linux/fs.h>
+#include <linux/elf.h>
 
 #ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
 extern unsigned long max_mapnr;
@@ -643,31 +644,24 @@ kernel_map_pages(struct page *page, int 
 #endif
 
 #ifndef CONFIG_ARCH_GATE_AREA
-#ifdef AT_SYSINFO_EHDR
 static inline int in_gate_area(struct task_struct *task, unsigned long addr)
 {
+#ifdef AT_SYSINFO_EHDR
 	if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
 		return 1;
-	else
-		return 0;
+#endif
+	return 0;
 }
 
 extern struct vm_area_struct gate_vma;
 static inline struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
 {
+#ifdef AT_SYSINFO_EHDR
 	return &gate_vma;
-}
 #else
-static inline int in_gate_area(struct task_struct *task, unsigned long addr)
-{
 	return 0;
-}
-
-static inline struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
-{
-	return NULL;
-}
 #endif
+}
 #endif
 
 #endif /* __KERNEL__ */
#2 lore raw
Quoted 6 lines · Roland McGrath
Quoted 1 line

Any idea what might have disabled this?

...Mosberger!! When Andrew asked me to sign off on David's rework of that code, I did so with the caveat that it be tested on i386 before being accepted, and evidently it never was.

Quoted 7 lines

The #include is the part of this patch that matters, so the #ifdef below works. (Frankly, I have never seen the rationale for conditionalizing this code on AT_SYSINFO_EHDR rather than just FIXADDR_USER_START. But David wanted it that way and Andrew approved it.) The rest of the patch removes gratuitous duplication due to some strange aversion to concision in the presence of #ifdef, the kind that is all too common, utterly pointless, and error prone.

Thanks, adding <linux/elf.h> makes GDB much happier.

Signature · 2 lines
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer