binfmt: move more stuff undef CONFIG_COREDUMP
authorAlexey Dobriyan <adobriyan@gmail.com>
Sun, 13 Feb 2022 19:25:20 +0000 (22:25 +0300)
committerKees Cook <keescook@chromium.org>
Wed, 2 Mar 2022 00:16:27 +0000 (16:16 -0800)
struct linux_binfmt::core_dump and struct min_coredump::min_coredump
are used under CONFIG_COREDUMP only. Shrink those embedded configs
a bit.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/YglbIFyN+OtwVyjW@localhost.localdomain
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/binfmt_flat.c
include/linux/binfmts.h

index 65ea5381c5c7344d2529f7385ccc90477168e2c1..d0c1703b9576a39c93624018e6b121b6cb43b01b 100644 (file)
@@ -101,8 +101,10 @@ static struct linux_binfmt elf_format = {
        .module         = THIS_MODULE,
        .load_binary    = load_elf_binary,
        .load_shlib     = load_elf_library,
+#ifdef CONFIG_COREDUMP
        .core_dump      = elf_core_dump,
        .min_coredump   = ELF_EXEC_PAGESIZE,
+#endif
 };
 
 #define BAD_ADDR(x) (unlikely((unsigned long)(x) >= TASK_SIZE))
index c6f588dc4a9dbe4d00b9699f60cef958abce738c..7fa6e6632d9df73f49dfdfb6d53e4473eff5dca6 100644 (file)
@@ -83,8 +83,8 @@ static struct linux_binfmt elf_fdpic_format = {
        .load_binary    = load_elf_fdpic_binary,
 #ifdef CONFIG_ELF_CORE
        .core_dump      = elf_fdpic_core_dump,
-#endif
        .min_coredump   = ELF_EXEC_PAGESIZE,
+#endif
 };
 
 static int __init init_elf_fdpic_binfmt(void)
index 5d776f80ee50c22ae3eafe48bfaac144c6dae9cf..5f0bf24bb3b856ce2b61fd88b7073fac22d1b49c 100644 (file)
@@ -102,8 +102,10 @@ static int flat_core_dump(struct coredump_params *cprm);
 static struct linux_binfmt flat_format = {
        .module         = THIS_MODULE,
        .load_binary    = load_flat_binary,
+#ifdef CONFIG_COREDUMP
        .core_dump      = flat_core_dump,
        .min_coredump   = PAGE_SIZE
+#endif
 };
 
 /****************************************************************************/
index 049cf9421d83141f5cd851ca953f3fcb85932d56..5d651c219c99b7ed4f6a6e5d757ae54b92ebc69b 100644 (file)
@@ -98,8 +98,10 @@ struct linux_binfmt {
        struct module *module;
        int (*load_binary)(struct linux_binprm *);
        int (*load_shlib)(struct file *);
+#ifdef CONFIG_COREDUMP
        int (*core_dump)(struct coredump_params *cprm);
        unsigned long min_coredump;     /* minimal dump size */
+#endif
 } __randomize_layout;
 
 extern void __register_binfmt(struct linux_binfmt *fmt, int insert);