lkml.org 
[lkml]   [1998]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectPATCH: Core dumps as a config option
Date

This simple patch makes core dumps a config option (which only appears
when you select support for that binary format). People who use linux for
offering shell accounts, ftp or WWW servers typically don't use core dumps.
In fact, only software devlopers are usually interested in core dumps.

(99% of the patch is just adding the CONFIG_{ELF,AOUT}_CORE to all the
arch/*/defconfig and arch/*/config.in)

Paul.
--
main(){long i,f,m=19248;f=open("/dev/tty",0);if(!fork())for(;;i++,ioctl(f,m,
(1<<23)+(rand()&2047)),ioctl(f,m+2,rand()%8),sleep(1));} /* Linux Console */


diff -ur linux-2199/arch/alpha/config.in linux/arch/alpha/config.in
--- linux-2199/arch/alpha/config.in Fri May 1 15:47:49 1998
+++ linux/arch/alpha/config.in Fri May 1 15:50:44 1998
@@ -186,7 +186,13 @@
bool 'System V IPC' CONFIG_SYSVIPC
bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
+if [ "$CONFIG_BINFMT_AOUT" != "n" ]; then
+ bool 'Include a.out core dump support' CONFIG_AOUT_CORE
+fi
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
+ bool 'Include ELF core dump support' CONFIG_ELF_CORE
+fi
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
diff -ur linux-2199/arch/alpha/defconfig linux/arch/alpha/defconfig
--- linux-2199/arch/alpha/defconfig Mon Mar 30 18:21:39 1998
+++ linux/arch/alpha/defconfig Fri May 1 15:50:44 1998
@@ -53,7 +53,9 @@
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
+CONFIG_AOUT_CORE=y
CONFIG_BINFMT_ELF=y
+CONFIG_ELF_CORE=y
# CONFIG_BINFMT_MISC is not set
CONFIG_BINFMT_EM86=y
# CONFIG_PARPORT is not set
diff -ur linux-2199/arch/arm/config.in linux/arch/arm/config.in
--- linux-2199/arch/arm/config.in Mon Apr 13 04:42:15 1998
+++ linux/arch/arm/config.in Fri May 1 15:58:25 1998
@@ -65,7 +65,13 @@
#bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
+if [ "$CONFIG_BINFMT_AOUT" != "n" ]; then
+ bool 'Include a.out core dump support' CONFIG_AOUT_CORE
+fi
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
+ bool 'Include ELF core dump support' CONFIG_ELF_CORE
+fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
# tristate 'Kernel support for JAVA binaries' CONFIG_BINFMT_JAVA
define_bool CONFIG_BINFMT_JAVA n
diff -ur linux-2199/arch/arm/defconfig linux/arch/arm/defconfig
--- linux-2199/arch/arm/defconfig Mon Apr 13 04:42:15 1998
+++ linux/arch/arm/defconfig Fri May 1 15:50:44 1998
@@ -36,7 +36,9 @@
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
+CONFIG_AOUT_CORE=y
CONFIG_BINFMT_ELF=m
+CONFIG_ELF_CORE=y
# CONFIG_BINFMT_JAVA is not set
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
diff -ur linux-2199/arch/i386/config.in linux/arch/i386/config.in
--- linux-2199/arch/i386/config.in Fri May 1 15:47:49 1998
+++ linux/arch/i386/config.in Fri May 1 15:50:44 1998
@@ -50,7 +50,13 @@
bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
+if [ "$CONFIG_BINFMT_AOUT" != "n" ]; then
+ bool 'Include a.out core dump support' CONFIG_AOUT_CORE
+fi
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
+ bool 'Include ELF core dump support' CONFIG_ELF_CORE
+fi
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
diff -ur linux-2199/arch/i386/defconfig linux/arch/i386/defconfig
--- linux-2199/arch/i386/defconfig Fri May 1 15:47:49 1998
+++ linux/arch/i386/defconfig Fri May 1 15:50:44 1998
@@ -37,7 +37,9 @@
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
+CONFIG_AOUT_CORE=y
CONFIG_BINFMT_ELF=y
+CONFIG_ELF_CORE=y
CONFIG_BINFMT_MISC=y
# CONFIG_VIDEO_SELECT is not set
# CONFIG_PARPORT is not set
diff -ur linux-2199/arch/m68k/config.in linux/arch/m68k/config.in
--- linux-2199/arch/m68k/config.in Mon Mar 30 06:16:12 1998
+++ linux/arch/m68k/config.in Fri May 1 15:57:36 1998
@@ -68,7 +68,13 @@
bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
+if [ "$CONFIG_BINFMT_AOUT" != "n" ]; then
+ bool 'Include a.out core dump support' CONFIG_AOUT_CORE
+fi
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
+ bool 'Include ELF core dump support' CONFIG_ELF_CORE
+fi
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC

if [ "$CONFIG_AMIGA" = "y" ]; then
diff -ur linux-2199/arch/m68k/defconfig linux/arch/m68k/defconfig
--- linux-2199/arch/m68k/defconfig Wed Mar 11 09:43:13 1998
+++ linux/arch/m68k/defconfig Fri May 1 15:50:44 1998
@@ -40,7 +40,9 @@
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
+CONFIG_AOUT_CORE=y
CONFIG_BINFMT_ELF=y
+CONFIG_ELF_CORE=y
CONFIG_ZORRO=y
# CONFIG_AMIGA_GSP is not set
# CONFIG_GSP_RESOLVER is not set
diff -ur linux-2199/arch/mips/config.in linux/arch/mips/config.in
--- linux-2199/arch/mips/config.in Wed Mar 11 09:43:13 1998
+++ linux/arch/mips/config.in Fri May 1 16:00:09 1998
@@ -87,7 +87,9 @@
define_bool CONFIG_FORWARD_KEYBOARD y
fi
define_bool CONFIG_BINFMT_AOUT n
+# bool 'Include a.out core dump support' CONFIG_AOUT_CORE
define_bool CONFIG_BINFMT_ELF y
+bool 'Include ELF core dump support' CONFIG_ELF_CORE
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -ur linux-2199/arch/mips/defconfig linux/arch/mips/defconfig
--- linux-2199/arch/mips/defconfig Thu Dec 11 05:31:09 1997
+++ linux/arch/mips/defconfig Fri May 1 15:50:44 1998
@@ -36,6 +36,7 @@
CONFIG_CPU_LITTLE_ENDIAN=y
# CONFIG_BINFMT_AOUT is not set
CONFIG_BINFMT_ELF=y
+CONFIG_ELF_CORE=y
# CONFIG_BINFMT_MISC is not set
CONFIG_NET=y
CONFIG_SYSVIPC=y
diff -ur linux-2199/arch/ppc/config.in linux/arch/ppc/config.in
--- linux-2199/arch/ppc/config.in Fri May 1 15:47:50 1998
+++ linux/arch/ppc/config.in Fri May 1 15:50:44 1998
@@ -61,6 +61,7 @@

# only elf supported, a.out is not -- Cort
define_bool CONFIG_BINFMT_ELF y
+bool 'Include ELF core dump support' CONFIG_ELF_CORE
define_bool CONFIG_KERNEL_ELF y
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
diff -ur linux-2199/arch/ppc/defconfig linux/arch/ppc/defconfig
--- linux-2199/arch/ppc/defconfig Mon Apr 27 23:54:42 1998
+++ linux/arch/ppc/defconfig Fri May 1 15:50:45 1998
@@ -27,6 +27,7 @@
CONFIG_SYSVIPC=y
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_BINFMT_ELF=y
+CONFIG_ELF_CORE=y
CONFIG_KERNEL_ELF=y
# CONFIG_BINFMT_MISC is not set
# CONFIG_BINFMT_JAVA is not set
diff -ur linux-2199/arch/sparc/config.in linux/arch/sparc/config.in
--- linux-2199/arch/sparc/config.in Mon Apr 27 23:54:43 1998
+++ linux/arch/sparc/config.in Fri May 1 15:50:45 1998
@@ -62,7 +62,13 @@
bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
+if [ "$CONFIG_BINFMT_AOUT" != "n" ]; then
+ bool 'Include a.out core dump support' CONFIG_AOUT_CORE
+fi
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
+ bool 'Include ELF core dump support' CONFIG_ELF_CORE
+fi
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
diff -ur linux-2199/arch/sparc/defconfig linux/arch/sparc/defconfig
--- linux-2199/arch/sparc/defconfig Mon Apr 27 23:54:43 1998
+++ linux/arch/sparc/defconfig Fri May 1 15:50:45 1998
@@ -66,7 +66,9 @@
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
+CONFIG_AOUT_CORE=y
CONFIG_BINFMT_ELF=y
+CONFIG_ELF_CORE=y
CONFIG_BINFMT_MISC=y
CONFIG_BINFMT_JAVA=m

diff -ur linux-2199/arch/sparc64/config.in linux/arch/sparc64/config.in
--- linux-2199/arch/sparc64/config.in Mon Apr 27 23:54:45 1998
+++ linux/arch/sparc64/config.in Fri May 1 15:50:45 1998
@@ -56,9 +56,15 @@
bool 'Sysctl support' CONFIG_SYSCTL
bool 'Kernel support for Linux/Sparc 32bit binary compatibility' CONFIG_SPARC32_COMPAT
tristate 'Kernel support for 64-bit ELF binaries' CONFIG_BINFMT_ELF
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
+ bool 'Include ELF core dump support' CONFIG_ELF_CORE
+fi
if [ "$CONFIG_SPARC32_COMPAT" != "n" ]; then
tristate 'Kernel support for 32-bit ELF binaries' CONFIG_BINFMT_ELF32
bool 'Kernel support for 32-bit (ie. SunOS) a.out binaries' CONFIG_BINFMT_AOUT32
+fi
+if [ "$CONFIG_BINFMT_AOUT32" != "n" ]; then
+ bool 'Include a.out core dump support' CONFIG_AOUT_CORE
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -ur linux-2199/fs/binfmt_aout.c linux/fs/binfmt_aout.c
--- linux-2199/fs/binfmt_aout.c Mon Apr 27 23:54:59 1998
+++ linux/fs/binfmt_aout.c Fri May 1 15:51:43 1998
@@ -6,6 +6,7 @@

#include <linux/module.h>

+#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -31,7 +32,11 @@

static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
static int load_aout_library(int fd);
+#ifdef CONFIG_AOUT_CORE
static int aout_core_dump(long signr, struct pt_regs * regs);
+#else
+#define aout_core_dump NULL
+#endif

extern void dump_thread(struct pt_regs *, struct user *);

@@ -54,6 +59,8 @@
MAP_FIXED | MAP_PRIVATE, 0);
}

+#ifdef CONFIG_AOUT_CORE
+
/*
* These are the only things you should do on a core-file: use only these
* macros to write out all the necessary info.
@@ -230,6 +237,7 @@
MOD_DEC_USE_COUNT;
return retval;
}
+#endif /* CONFIG_AOUT_CORE */

/*
* create_aout_tables() parses the env- and arg-strings in new user
diff -ur linux-2199/fs/binfmt_elf.c linux/fs/binfmt_elf.c
--- linux-2199/fs/binfmt_elf.c Fri May 1 15:47:53 1998
+++ linux/fs/binfmt_elf.c Fri May 1 15:50:45 1998
@@ -57,7 +57,7 @@
* If we don't support core dumping, then supply a NULL so we
* don't even try.
*/
-#ifdef USE_ELF_CORE_DUMP
+#ifdef CONFIG_ELF_CORE
static int elf_core_dump(long signr, struct pt_regs * regs);
#else
#define elf_core_dump NULL
@@ -909,7 +909,7 @@
* Note that some platforms still use traditional core dumps and not
* the ELF core dump. Each platform can select it as appropriate.
*/
-#ifdef USE_ELF_CORE_DUMP
+#ifdef CONFIG_ELF_CORE

/*
* ELF core dumper
@@ -1326,7 +1326,7 @@
#endif
return has_dumped;
}
-#endif /* USE_ELF_CORE_DUMP */
+#endif /* CONFIG_ELF_CORE */

__initfunc(int init_elf_binfmt(void))
{
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.338 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site