]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
coredump-make-core-dump-functionality-optional-fix-fix
authorAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Sep 2012 00:22:13 +0000 (10:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 5 Oct 2012 04:01:38 +0000 (14:01 +1000)
fix binfmt_aout.c build

Cc: Alex Kelly <alex.page.kelly@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/binfmt_aout.c

index d146e181d10df8611050c16745195b9efca62c93..4b5b5117f00aff7a7ad707bc3c50ecce4e9c92ca 100644 (file)
 
 static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
 static int load_aout_library(struct file*);
-static int aout_core_dump(struct coredump_params *cprm);
-
-static struct linux_binfmt aout_format = {
-       .module         = THIS_MODULE,
-       .load_binary    = load_aout_binary,
-       .load_shlib     = load_aout_library,
-       .core_dump      = aout_core_dump,
-       .min_coredump   = PAGE_SIZE
-};
-
-#define BAD_ADDR(x)    ((unsigned long)(x) >= TASK_SIZE)
-
-static int set_brk(unsigned long start, unsigned long end)
-{
-       start = PAGE_ALIGN(start);
-       end = PAGE_ALIGN(end);
-       if (end > start) {
-               unsigned long addr;
-               addr = vm_brk(start, end - start);
-               if (BAD_ADDR(addr))
-                       return addr;
-       }
-       return 0;
-}
 
+#ifdef CONFIG_COREDUMP
 /*
  * Routine writes a core dump image in the current directory.
  * Currently only a stub-function.
@@ -66,7 +43,6 @@ static int set_brk(unsigned long start, unsigned long end)
  * field, which also makes sure the core-dumps won't be recursive if the
  * dumping of the process results in another error..
  */
-
 static int aout_core_dump(struct coredump_params *cprm)
 {
        struct file *file = cprm->file;
@@ -135,6 +111,32 @@ end_coredump:
        set_fs(fs);
        return has_dumped;
 }
+#else
+#define aout_core_dump NULL
+#endif
+
+static struct linux_binfmt aout_format = {
+       .module         = THIS_MODULE,
+       .load_binary    = load_aout_binary,
+       .load_shlib     = load_aout_library,
+       .core_dump      = aout_core_dump,
+       .min_coredump   = PAGE_SIZE
+};
+
+#define BAD_ADDR(x)    ((unsigned long)(x) >= TASK_SIZE)
+
+static int set_brk(unsigned long start, unsigned long end)
+{
+       start = PAGE_ALIGN(start);
+       end = PAGE_ALIGN(end);
+       if (end > start) {
+               unsigned long addr;
+               addr = vm_brk(start, end - start);
+               if (BAD_ADDR(addr))
+                       return addr;
+       }
+       return 0;
+}
 
 /*
  * create_aout_tables() parses the env- and arg-strings in new user