mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
coredump: make core dump functionality optional
Adds an expert Kconfig option, CONFIG_COREDUMP, which allows disabling of core dump. This saves approximately 2.6k in the compiled kernel, and complements CONFIG_ELF_CORE, which now depends on it. CONFIG_COREDUMP also disables coredump-related sysctls, except for suid_dumpable and related functions, which are necessary for ptrace. [akpm@linux-foundation.org: fix binfmt_aout.c build] Signed-off-by: Alex Kelly <alex.page.kelly@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Acked-by: Kees Cook <keescook@chromium.org> Cc: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
db9aeca97a
commit
046d662f48
@@ -32,31 +32,8 @@
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user