Skip to contentSkip to conversation

Multi-threaded core dumps for 2.5.21.

PATCH In review mgross 2 participants 6 messages Jun 14, 2002 – Jun 18, 2002

Subsystems (3)
lore
Share & tools
lore

mgross

author
#0 lore raw

PATCH 1/1 Multi-threaded core dumps for 2.5.21.

Attached is a re-base of the 2.5.18 patch posted last week.

This patch has been tested on my SMP system and seems very stable, so far. I would like very much to see this feature added to the 2.5.x kernels and more milage given to it.

For ISV's not having the ability to create core dumps for pthread applications is a strong justification for not using Linux. Now is a good time for Linux support the ISV's WRT core files for multi-threaded applications.

To use the core files from multi-threaded applications, created with this patch you may need to strip the objects from /lib/libpthread. For my system 'strip /lib/libpthread-0.9.so makes things good, YMMV.

Please apply this patch.

--mgross

arch/i386/kernel/i387.c +33 -0
diff -urN -X dontdiff linux-2.5.21/arch/i386/kernel/i387.c linux2521.tcore/arch/i386/kernel/i387.c
@@ -528,3 +528,36 @@
 
 	return fpvalid;
 }
+
+int dump_task_fpu( struct task_struct *tsk, struct user_i387_struct *fpu )
+{
+	int fpvalid;
+
+	fpvalid = tsk->used_math;
+	if ( fpvalid ) {
+		if (tsk == current) unlazy_fpu( tsk );
+		if ( cpu_has_fxsr ) {
+			copy_fpu_fxsave( tsk, fpu );
+		} else {
+			copy_fpu_fsave( tsk, fpu );
+		}
+	}
+
+	return fpvalid;
+}
+
+int dump_task_extended_fpu( struct task_struct *tsk, struct user_fxsr_struct *fpu )
+{
+	int fpvalid;
+	
+	fpvalid = tsk->used_math && cpu_has_fxsr;
+	if ( fpvalid ) {
+		if (tsk == current) unlazy_fpu( tsk );
+		memcpy( fpu, &tsk->thread.i387.fxsave,
+		sizeof(struct user_fxsr_struct) );
+	}
+	
+	return fpvalid;
+}
+
+
arch/i386/kernel/process.c +18 -0
diff -urN -X dontdiff linux-2.5.21/arch/i386/kernel/process.c linux2521.tcore/arch/i386/kernel/process.c
@@ -610,6 +610,24 @@
 
 	dump->u_fpvalid = dump_fpu (regs, &dump->i387);
 }
+/* 
+ * Capture the user space registers if the task is not running (in user space)
+ */
+#include <linux/elfcore.h>
+int dump_task_regs(struct task_struct *tsk,  elf_gregset_t *regs)
+{
+	struct pt_regs ptregs;
+	
+	ptregs = *(struct pt_regs *)((unsigned long)tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs));
+	ptregs.xcs &= 0xffff;
+	ptregs.xds &= 0xffff;
+	ptregs.xes &= 0xffff;
+	ptregs.xss &= 0xffff;
+
+	elf_core_copy_regs(regs, &ptregs);
+
+	return 1;
+}
 
 /*
  * This special macro can be used to load a debugging register
arch/ia64/kernel/process.c +58 -14

105 lines not on this page · raw message

fs/binfmt_elf.c +252 -90

432 lines not on this page · raw message

include/asm-i386/elf.h +10 -0
diff -urN -X dontdiff linux-2.5.21/include/asm-i386/elf.h linux2521.tcore/include/asm-i386/elf.h
@@ -99,6 +99,16 @@
 
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
+
+
+extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
+extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
+extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
+
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
+
 #endif
 
 #endif
include/asm-ia64/elf.h +12 -0
diff -urN -X dontdiff linux-2.5.21/include/asm-ia64/elf.h linux2521.tcore/include/asm-ia64/elf.h
@@ -65,12 +65,16 @@
 #define ELF_NGREG	128	/* we really need just 72 but let's leave some headroom... */
 #define ELF_NFPREG	128	/* f0 and f1 could be omitted, but so what... */
 
+typedef unsigned long elf_fpxregset_t;
+
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
 typedef struct ia64_fpreg elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
+
+
 struct pt_regs;	/* forward declaration... */
 extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
 #define ELF_CORE_COPY_REGS(_dest,_regs)	ia64_elf_core_copy_regs(_regs, _dest);
@@ -88,6 +92,14 @@
 struct elf64_hdr;
 extern void ia64_set_personality (struct elf64_hdr *elf_ex, int ibcs2_interpreter);
 #define SET_PERSONALITY(ex, ibcs2)	ia64_set_personality(&(ex), ibcs2)
+
+extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
+extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
+
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_gregs) dump_task_regs(tsk, elf_gregs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+
+
 #endif
 
 #endif /* _ASM_IA64_ELF_H */
include/linux/elf.h +3 -1
diff -urN -X dontdiff linux-2.5.21/include/linux/elf.h linux2521.tcore/include/linux/elf.h
@@ -576,6 +576,9 @@
 #define NT_PRPSINFO	3
 #define NT_TASKSTRUCT	4
 #define NT_PRFPXREG	20
+#define NT_PRXFPREG     0x46e62b7f	/* note name must be "LINUX" as per GDB */
+					/* from gdb5.1/include/elf/common.h */
+
 
 /* Note header in a PT_NOTE section */
 typedef struct elf32_note {
@@ -606,6 +609,5 @@
 #define elf_note	elf64_note
 
 #endif
-
 
 #endif /* _LINUX_ELF_H */
include/linux/elfcore.h +44 -0

48 lines not on this page · raw message

include/linux/sched.h +8 -0
diff -urN -X dontdiff linux-2.5.21/include/linux/sched.h linux2521.tcore/include/linux/sched.h
@@ -132,6 +132,14 @@
 
 #include <linux/spinlock.h>
 
+
+/* functions for pausing and resumming functions 
+ * common mm's without using signals.  These are used
+ * by the multithreaded elf core dump code in binfmt_elf.c*/
+extern void tcore_suspend_threads( void );
+extern void tcore_resume_threads( void );
+
+
 /*
  * This serializes "schedule()" and also protects
  * the run-queue from deletions/modifications (but
kernel/sched.c +167 -7

224 lines not on this page · raw message

Binary files linux-2.5.21/scripts/fixdep and linux2521.tcore/scripts/fixdep differ

#1 lore raw

Mark,

You are capturing the registers of the thread dumping core twice in this patch. Please apply on top of your patch:

fs/binfmt_elf.c renamed from fs/binfmt_elf.c.ori +0 -16
@@ -1203,22 +1203,6 @@
 
 	}
 
-	memset(&prstatus, 0, sizeof(prstatus));
-	/*
-	 * This transfers the registers from regs into the standard
-	 * coredump arrangement, whatever that is.
-	 */
-#ifdef ELF_CORE_COPY_REGS
-	ELF_CORE_COPY_REGS(prstatus.pr_reg, regs)
-#else
-	if (sizeof(elf_gregset_t) != sizeof(struct pt_regs))
-	{
-		printk("sizeof(elf_gregset_t) (%ld) != sizeof(struct pt_regs) (%ld)\n",
-			(long)sizeof(elf_gregset_t), (long)sizeof(struct pt_regs));
-	}
-	else
-		*(struct pt_regs *)&prstatus.pr_reg = *regs;
-#endif
 
 	 /* capture the status of all other threads */
 	if (signr) {

Same problem is there on the patch you posted for 2.4.18 too, the above will apply with a slight offset.

Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]

Quoted 17 lines · mgross

Attached is a re-base of the 2.5.18 patch posted last week.

This patch has been tested on my SMP system and seems very stable, so far. I would like very much to see this feature added to the 2.5.x kernels and more milage given to it.

For ISV's not having the ability to create core dumps for pthread applications is a strong justification for not using Linux. Now is a good time for Linux support the ISV's WRT core files for multi-threaded applications.

To use the core files from multi-threaded applications, created with this patch you may need to strip the objects from /lib/libpthread. For my system 'strip /lib/libpthread-0.9.so makes things good, YMMV.

Please apply this patch.

--mgross

author
#2 lore raw
Quoted 4 lines · Vamsi Krishna S.

Mark,

You are capturing the registers of the thread dumping core twice in this patch. Please apply on top of your patch:

You are so right! That same code is defined as an inline in elfcore.h, and is executed just a few lines down from there. I'll incorporate this into a couple of new patches for a posting later today.

Thanks for the review.

--mgross

Quoted 56 lines
fs/binfmt_elf.c renamed from fs/binfmt_elf.c.ori +0 -16
@@ -1203,22 +1203,6 @@
 
 	}
 
-	memset(&prstatus, 0, sizeof(prstatus));
-	/*
-	 * This transfers the registers from regs into the standard
-	 * coredump arrangement, whatever that is.
-	 */
-#ifdef ELF_CORE_COPY_REGS
-	ELF_CORE_COPY_REGS(prstatus.pr_reg, regs)
-#else
-	if (sizeof(elf_gregset_t) != sizeof(struct pt_regs))
-	{
-		printk("sizeof(elf_gregset_t) (%ld) != sizeof(struct pt_regs) (%ld)\n",
-			(long)sizeof(elf_gregset_t), (long)sizeof(struct pt_regs));
-	}
-	else
-		*(struct pt_regs *)&prstatus.pr_reg = *regs;
-#endif
 
 	 /* capture the status of all other threads */
 	if (signr) {

Same problem is there on the patch you posted for 2.4.18 too, the above will apply with a slight offset.

Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]

Quoted 18 lines · mgross

Attached is a re-base of the 2.5.18 patch posted last week.

This patch has been tested on my SMP system and seems very stable, so far. I would like very much to see this feature added to the 2.5.x kernels and more milage given to it.

For ISV's not having the ability to create core dumps for pthread applications is a strong justification for not using Linux. Now is a good time for Linux support the ISV's WRT core files for multi-threaded applications.

To use the core files from multi-threaded applications, created with this patch you may need to strip the objects from /lib/libpthread. For my system 'strip /lib/libpthread-0.9.so makes things good, YMMV.

Please apply this patch.

--mgross

author
#3 lore raw

Done.

See attached ;)

--mgross

Quoted 68 lines · mgross
Quoted 4 lines · Vamsi Krishna S.

Mark,

You are capturing the registers of the thread dumping core twice in this patch. Please apply on top of your patch:

You are so right! That same code is defined as an inline in elfcore.h, and is executed just a few lines down from there. I'll incorporate this into a couple of new patches for a posting later today.

Thanks for the review.

--mgross

Quoted 54 lines
fs/binfmt_elf.c renamed from fs/binfmt_elf.c.ori +0 -15
@@ -1203,22 +1203,6 @@
 
 	}
 
-	memset(&prstatus, 0, sizeof(prstatus));
-	/*
-	 * This transfers the registers from regs into the standard
-	 * coredump arrangement, whatever that is.
-	 */
-#ifdef ELF_CORE_COPY_REGS
-	ELF_CORE_COPY_REGS(prstatus.pr_reg, regs)
-#else
-	if (sizeof(elf_gregset_t) != sizeof(struct pt_regs))
-	{
-		printk("sizeof(elf_gregset_t) (%ld) != sizeof(struct pt_regs)
 (%ld)\n", -			(long)sizeof(elf_gregset_t), (long)sizeof(struct pt_regs));
-	}
-	else
-		*(struct pt_regs *)&prstatus.pr_reg = *regs;
-#endif
 
 	 /* capture the status of all other threads */
 	if (signr) {

Same problem is there on the patch you posted for 2.4.18 too, the above will apply with a slight offset.

Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]

Quoted 17 lines · mgross

Attached is a re-base of the 2.5.18 patch posted last week.

This patch has been tested on my SMP system and seems very stable, so far. I would like very much to see this feature added to the 2.5.x kernels and more milage given to it.

For ISV's not having the ability to create core dumps for pthread applications is a strong justification for not using Linux. Now is a good time for Linux support the ISV's WRT core files for multi-threaded applications.

To use the core files from multi-threaded applications, created with this patch you may need to strip the objects from /lib/libpthread. For my system 'strip /lib/libpthread-0.9.so makes things good, YMMV.

Please apply this patch.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

--mgross

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

arch/i386/kernel/i387.c +33 -0
diff -urN -X dontdiff linux-2.5.21/arch/i386/kernel/i387.c linux2521.tcore/arch/i386/kernel/i387.c
@@ -528,3 +528,36 @@
 
 	return fpvalid;
 }
+
+int dump_task_fpu( struct task_struct *tsk, struct user_i387_struct *fpu )
+{
+	int fpvalid;
+
+	fpvalid = tsk->used_math;
+	if ( fpvalid ) {
+		if (tsk == current) unlazy_fpu( tsk );
+		if ( cpu_has_fxsr ) {
+			copy_fpu_fxsave( tsk, fpu );
+		} else {
+			copy_fpu_fsave( tsk, fpu );
+		}
+	}
+
+	return fpvalid;
+}
+
+int dump_task_extended_fpu( struct task_struct *tsk, struct user_fxsr_struct *fpu )
+{
+	int fpvalid;
+	
+	fpvalid = tsk->used_math && cpu_has_fxsr;
+	if ( fpvalid ) {
+		if (tsk == current) unlazy_fpu( tsk );
+		memcpy( fpu, &tsk->thread.i387.fxsave,
+		sizeof(struct user_fxsr_struct) );
+	}
+	
+	return fpvalid;
+}
+
+
arch/i386/kernel/process.c +18 -0
diff -urN -X dontdiff linux-2.5.21/arch/i386/kernel/process.c linux2521.tcore/arch/i386/kernel/process.c
@@ -610,6 +610,24 @@
 
 	dump->u_fpvalid = dump_fpu (regs, &dump->i387);
 }
+/* 
+ * Capture the user space registers if the task is not running (in user space)
+ */
+#include <linux/elfcore.h>
+int dump_task_regs(struct task_struct *tsk,  elf_gregset_t *regs)
+{
+	struct pt_regs ptregs;
+	
+	ptregs = *(struct pt_regs *)((unsigned long)tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs));
+	ptregs.xcs &= 0xffff;
+	ptregs.xds &= 0xffff;
+	ptregs.xes &= 0xffff;
+	ptregs.xss &= 0xffff;
+
+	elf_core_copy_regs(regs, &ptregs);
+
+	return 1;
+}
 
 /*
  * This special macro can be used to load a debugging register
arch/ia64/kernel/process.c +58 -14

105 lines not on this page · raw message

fs/binfmt_elf.c +250 -104

439 lines not on this page · raw message

include/asm-i386/elf.h +10 -0
diff -urN -X dontdiff linux-2.5.21/include/asm-i386/elf.h linux2521.tcore/include/asm-i386/elf.h
@@ -99,6 +99,16 @@
 
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
+
+
+extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
+extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
+extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
+
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
+
 #endif
 
 #endif
include/asm-ia64/elf.h +12 -0
diff -urN -X dontdiff linux-2.5.21/include/asm-ia64/elf.h linux2521.tcore/include/asm-ia64/elf.h
@@ -65,12 +65,16 @@
 #define ELF_NGREG	128	/* we really need just 72 but let's leave some headroom... */
 #define ELF_NFPREG	128	/* f0 and f1 could be omitted, but so what... */
 
+typedef unsigned long elf_fpxregset_t;
+
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
 typedef struct ia64_fpreg elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
+
+
 struct pt_regs;	/* forward declaration... */
 extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
 #define ELF_CORE_COPY_REGS(_dest,_regs)	ia64_elf_core_copy_regs(_regs, _dest);
@@ -88,6 +92,14 @@
 struct elf64_hdr;
 extern void ia64_set_personality (struct elf64_hdr *elf_ex, int ibcs2_interpreter);
 #define SET_PERSONALITY(ex, ibcs2)	ia64_set_personality(&(ex), ibcs2)
+
+extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
+extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
+
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_gregs) dump_task_regs(tsk, elf_gregs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+
+
 #endif
 
 #endif /* _ASM_IA64_ELF_H */
include/linux/elf.h +3 -1
diff -urN -X dontdiff linux-2.5.21/include/linux/elf.h linux2521.tcore/include/linux/elf.h
@@ -576,6 +576,9 @@
 #define NT_PRPSINFO	3
 #define NT_TASKSTRUCT	4
 #define NT_PRFPXREG	20
+#define NT_PRXFPREG     0x46e62b7f	/* note name must be "LINUX" as per GDB */
+					/* from gdb5.1/include/elf/common.h */
+
 
 /* Note header in a PT_NOTE section */
 typedef struct elf32_note {
@@ -606,6 +609,5 @@
 #define elf_note	elf64_note
 
 #endif
-
 
 #endif /* _LINUX_ELF_H */
include/linux/elfcore.h +44 -0

48 lines not on this page · raw message

include/linux/sched.h +8 -0
diff -urN -X dontdiff linux-2.5.21/include/linux/sched.h linux2521.tcore/include/linux/sched.h
@@ -132,6 +132,14 @@
 
 #include <linux/spinlock.h>
 
+
+/* functions for pausing and resumming functions 
+ * common mm's without using signals.  These are used
+ * by the multithreaded elf core dump code in binfmt_elf.c*/
+extern void tcore_suspend_threads( void );
+extern void tcore_resume_threads( void );
+
+
 /*
  * This serializes "schedule()" and also protects
  * the run-queue from deletions/modifications (but
kernel/sched.c +167 -7

224 lines not on this page · raw message

Binary files linux-2.5.21/scripts/fixdep and linux2521.tcore/scripts/fixdep differ

author
#4 lore raw

PATCH 1/1 TCore patch for 2.5.22

In reply to mgross

Attached is a re-base to the 2.5.22 kernel of the patch posted last week. It also includes the clean up suggested by Vamsi Krishna.

This patch has been tested on my SMP system and is stable.
I would like very much to see this feature added to the 2.5.x kernels and more milage given to it.

To use the core files from multi-threaded applications, created with this patch you may need to strip the objects from /lib/libpthread. For my system 'strip /lib/libpthread-0.9.so makes things good, YMMV.

Please apply this patch.

--mgross

author
#5 lore raw

Re: [PATCH] TCore patch for 2.5.22

Patch actually attached this time.

--mgross

Quoted 13 lines · mgross

Attached is a re-base to the 2.5.22 kernel of the patch posted last week. It also includes the clean up suggested by Vamsi Krishna.

This patch has been tested on my SMP system and is stable.
I would like very much to see this feature added to the 2.5.x kernels and more milage given to it.

To use the core files from multi-threaded applications, created with this patch you may need to strip the objects from /lib/libpthread. For my system 'strip /lib/libpthread-0.9.so makes things good, YMMV.

Please apply this patch.

Quoted 7 lines

--mgross

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

arch/i386/kernel/i387.c +33 -0
diff -urN -X dontdiff linux-2.5.22/arch/i386/kernel/i387.c linux2522.tcore/arch/i386/kernel/i387.c
@@ -528,3 +528,36 @@
 
 	return fpvalid;
 }
+
+int dump_task_fpu( struct task_struct *tsk, struct user_i387_struct *fpu )
+{
+	int fpvalid;
+
+	fpvalid = tsk->used_math;
+	if ( fpvalid ) {
+		if (tsk == current) unlazy_fpu( tsk );
+		if ( cpu_has_fxsr ) {
+			copy_fpu_fxsave( tsk, fpu );
+		} else {
+			copy_fpu_fsave( tsk, fpu );
+		}
+	}
+
+	return fpvalid;
+}
+
+int dump_task_extended_fpu( struct task_struct *tsk, struct user_fxsr_struct *fpu )
+{
+	int fpvalid;
+	
+	fpvalid = tsk->used_math && cpu_has_fxsr;
+	if ( fpvalid ) {
+		if (tsk == current) unlazy_fpu( tsk );
+		memcpy( fpu, &tsk->thread.i387.fxsave,
+		sizeof(struct user_fxsr_struct) );
+	}
+	
+	return fpvalid;
+}
+
+
arch/i386/kernel/process.c +18 -0
diff -urN -X dontdiff linux-2.5.22/arch/i386/kernel/process.c linux2522.tcore/arch/i386/kernel/process.c
@@ -626,6 +626,24 @@
 
 	dump->u_fpvalid = dump_fpu (regs, &dump->i387);
 }
+/* 
+ * Capture the user space registers if the task is not running (in user space)
+ */
+#include <linux/elfcore.h>
+int dump_task_regs(struct task_struct *tsk,  elf_gregset_t *regs)
+{
+	struct pt_regs ptregs;
+	
+	ptregs = *(struct pt_regs *)((unsigned long)tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs));
+	ptregs.xcs &= 0xffff;
+	ptregs.xds &= 0xffff;
+	ptregs.xes &= 0xffff;
+	ptregs.xss &= 0xffff;
+
+	elf_core_copy_regs(regs, &ptregs);
+
+	return 1;
+}
 
 /*
  * This special macro can be used to load a debugging register
arch/ia64/kernel/process.c +58 -14

105 lines not on this page · raw message

fs/binfmt_elf.c +250 -104

439 lines not on this page · raw message

include/asm-i386/elf.h +10 -0
diff -urN -X dontdiff linux-2.5.22/include/asm-i386/elf.h linux2522.tcore/include/asm-i386/elf.h
@@ -99,6 +99,16 @@
 
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
+
+
+extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
+extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
+extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
+
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
+
 #endif
 
 #endif
include/asm-ia64/elf.h +12 -0
diff -urN -X dontdiff linux-2.5.22/include/asm-ia64/elf.h linux2522.tcore/include/asm-ia64/elf.h
@@ -65,12 +65,16 @@
 #define ELF_NGREG	128	/* we really need just 72 but let's leave some headroom... */
 #define ELF_NFPREG	128	/* f0 and f1 could be omitted, but so what... */
 
+typedef unsigned long elf_fpxregset_t;
+
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
 typedef struct ia64_fpreg elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
+
+
 struct pt_regs;	/* forward declaration... */
 extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
 #define ELF_CORE_COPY_REGS(_dest,_regs)	ia64_elf_core_copy_regs(_regs, _dest);
@@ -88,6 +92,14 @@
 struct elf64_hdr;
 extern void ia64_set_personality (struct elf64_hdr *elf_ex, int ibcs2_interpreter);
 #define SET_PERSONALITY(ex, ibcs2)	ia64_set_personality(&(ex), ibcs2)
+
+extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
+extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
+
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_gregs) dump_task_regs(tsk, elf_gregs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+
+
 #endif
 
 #endif /* _ASM_IA64_ELF_H */
include/linux/elf.h +3 -1
diff -urN -X dontdiff linux-2.5.22/include/linux/elf.h linux2522.tcore/include/linux/elf.h
@@ -576,6 +576,9 @@
 #define NT_PRPSINFO	3
 #define NT_TASKSTRUCT	4
 #define NT_PRFPXREG	20
+#define NT_PRXFPREG     0x46e62b7f	/* note name must be "LINUX" as per GDB */
+					/* from gdb5.1/include/elf/common.h */
+
 
 /* Note header in a PT_NOTE section */
 typedef struct elf32_note {
@@ -606,6 +609,5 @@
 #define elf_note	elf64_note
 
 #endif
-
 
 #endif /* _LINUX_ELF_H */
include/linux/elfcore.h +44 -0

48 lines not on this page · raw message

include/linux/sched.h +8 -0
diff -urN -X dontdiff linux-2.5.22/include/linux/sched.h linux2522.tcore/include/linux/sched.h
@@ -132,6 +132,14 @@
 
 #include <linux/spinlock.h>
 
+
+/* functions for pausing and resumming functions 
+ * common mm's without using signals.  These are used
+ * by the multithreaded elf core dump code in binfmt_elf.c*/
+extern void tcore_suspend_threads( void );
+extern void tcore_resume_threads( void );
+
+
 /*
  * This serializes "schedule()" and also protects
  * the run-queue from deletions/modifications (but
kernel/sched.c +165 -7

222 lines not on this page · raw message

Binary files linux-2.5.22/scripts/fixdep and linux2522.tcore/scripts/fixdep differ