Skip to content

Commit d65bc29

Browse files
Alexey Dobriyankees
authored andcommitted
binfmt: move more stuff undef CONFIG_COREDUMP
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 <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9132c39 commit d65bc29

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

fs/binfmt_elf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ static struct linux_binfmt elf_format = {
101101
.module = THIS_MODULE,
102102
.load_binary = load_elf_binary,
103103
.load_shlib = load_elf_library,
104+
#ifdef CONFIG_COREDUMP
104105
.core_dump = elf_core_dump,
105106
.min_coredump = ELF_EXEC_PAGESIZE,
107+
#endif
106108
};
107109

108110
#define BAD_ADDR(x) (unlikely((unsigned long)(x) >= TASK_SIZE))

fs/binfmt_elf_fdpic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ static struct linux_binfmt elf_fdpic_format = {
8383
.load_binary = load_elf_fdpic_binary,
8484
#ifdef CONFIG_ELF_CORE
8585
.core_dump = elf_fdpic_core_dump,
86-
#endif
8786
.min_coredump = ELF_EXEC_PAGESIZE,
87+
#endif
8888
};
8989

9090
static int __init init_elf_fdpic_binfmt(void)

fs/binfmt_flat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ static int flat_core_dump(struct coredump_params *cprm);
102102
static struct linux_binfmt flat_format = {
103103
.module = THIS_MODULE,
104104
.load_binary = load_flat_binary,
105+
#ifdef CONFIG_COREDUMP
105106
.core_dump = flat_core_dump,
106107
.min_coredump = PAGE_SIZE
108+
#endif
107109
};
108110

109111
/****************************************************************************/

include/linux/binfmts.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ struct linux_binfmt {
9898
struct module *module;
9999
int (*load_binary)(struct linux_binprm *);
100100
int (*load_shlib)(struct file *);
101+
#ifdef CONFIG_COREDUMP
101102
int (*core_dump)(struct coredump_params *cprm);
102103
unsigned long min_coredump; /* minimal dump size */
104+
#endif
103105
} __randomize_layout;
104106

105107
extern void __register_binfmt(struct linux_binfmt *fmt, int insert);

0 commit comments

Comments
 (0)