fs-coredump-move-coredump-sysctls-into-its-own-file.patch removed from -mm tree
The patch titled
Subject: fs/coredump: move coredump sysctls into its own file
has been removed from the -mm tree. Its filename was
fs-coredump-move-coredump-sysctls-into-its-own-file.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Xiaoming Ni <[email protected]>
Subject: fs/coredump: move coredump sysctls into its own file
This moves the fs/coredump.c respective sysctls to its own file.
Signed-off-by Xiaoming Ni <[email protected]>
Signed-off-by Luis Chamberlain <[email protected]>
Cc Al Viro <[email protected]>
Cc Anil S Keshavamurthy <[email protected]>
Cc Antti Palosaari <[email protected]>
Cc Christian Brauner <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Biederman <[email protected]>
Cc Eric Biggers <[email protected]>
Cc Iurii Zaikin <[email protected]>
Cc Kees Cook <[email protected]>
Cc Lukas Middendorf <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc "Naveen N. Rao" <[email protected]>
Cc Stephen Kitt <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/coredump.c | 66 ++++++++++++++++++++++++++++++++++--- fs/exec.c | 55 ------------------------------ include/linux/coredump.h | 10 +++-- kernel/sysctl.c | 2 - 4 files changed, 67 insertions(+), 66 deletions(-)
fs/coredump.c renamed from fs/coredump.c~fs-coredump-move-coredump-sysctls-into-its-own-file +61 -5
@@ -41,6 +41,7 @@#include <linux/fs.h> #include <linux/path.h> #include <linux/timekeeping.h> +#include <linux/sysctl.h> #include <linux/uaccess.h> #include <asm/mmu_context.h>
@@ -52,9 +53,9 @@#include <trace/events/sched.h> -int core_uses_pid; -unsigned int core_pipe_limit; -char core_pattern[CORENAME_MAX_SIZE ] ="core" ; +static int core_uses_pid; +static unsigned int core_pipe_limit; +static char core_pattern[CORENAME_MAX_SIZE ] ="core" ;static int core_name_size =CORENAME_MAX_SIZE ;struct core_name {
@@ -62,8 +63,6 @@ struct core_name {int used, size; }; -/* The maximal length of core_pattern is also specified in sysctl.c */ -static int expand_corename (struct core_name *cn,int size) {char *corename =krealloc (cn->corename, size,GFP_KERNEL );
@@ -893,6 +892,63 @@ int dump_align(struct coredump_params *c }EXPORT_SYMBOL (dump_align); +#ifdef CONFIG_SYSCTL + +void validate_coredump_safety (void ) +{ +if (suid_dumpable ==SUID_DUMP_ROOT && + core_pattern[0 ] !='/' && core_pattern[0 ] !='|' ) { +pr_warn ( +"Unsafe core_pattern used with fs.suid_dumpable=2.\n" +"Pipe handler or fully qualified core dump path required.\n" +"Set kernel.core_pattern before fs.suid_dumpable.\n" + ); + } +} + +static int proc_dostring_coredump (struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) +{ +int error =proc_dostring (table, write, buffer, lenp, ppos); + +if (!error) +validate_coredump_safety (); +return error; +} + +static struct ctl_table coredump_sysctls[] = { + { + .procname ="core_uses_pid" , + .data = &core_uses_pid, + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = proc_dointvec, + }, + { + .procname ="core_pattern" , + .data = core_pattern, + .maxlen =CORENAME_MAX_SIZE , + .mode =0644 , + .proc_handler = proc_dostring_coredump, + }, + { + .procname ="core_pipe_limit" , + .data = &core_pipe_limit, + .maxlen =sizeof (unsigned int ), + .mode =0644 , + .proc_handler = proc_dointvec, + }, + { } +}; + +static int __init init_fs_coredump_sysctls (void ) +{ +register_sysctl_init ("kernel" , coredump_sysctls); +return 0 ; +} +fs_initcall (init_fs_coredump_sysctls); +#endif /* CONFIG_SYSCTL */ +/* * The purpose of always_dump_vma() is to make sure that special kernel mappings * that are useful for post-mortem analysis are included in every core dump.
fs/exec.c renamed from fs/exec.c~fs-coredump-move-coredump-sysctls-into-its-own-file +0 -55
70 lines not on this page · raw message
include/linux/coredump.h renamed from include/linux/coredump.h~fs-coredump-move-coredump-sysctls-into-its-own-file +6 -4
@@ -14,10 +14,6 @@ struct core_vma_metadata {unsigned long dump_size; }; -extern int core_uses_pid; -extern char core_pattern[]; -extern unsigned int core_pipe_limit; -/* * These are the only things you should do on a core-file: use only these * functions to write out all the necessary info.
@@ -37,4 +33,10 @@ extern void do_coredump(const kernel_sigstatic inline void do_coredump (const kernel_siginfo_t *siginfo) {}#endif +#if defined(CONFIG_COREDUMP ) && defined(CONFIG_SYSCTL ) +extern void validate_coredump_safety (void ); +#else +static inline void validate_coredump_safety (void ) {} +#endif +#endif /* _LINUX_COREDUMP_H */
kernel/sysctl.c renamed from kernel/sysctl.c~fs-coredump-move-coredump-sysctls-into-its-own-file +0 -2
@@ -62,12 +62,10 @@#include <linux/capability.h> #include <linux/binfmts.h> #include <linux/sched/sysctl.h> -#include <linux/sched/coredump.h> #include <linux/kexec.h> #include <linux/bpf.h> #include <linux/mount.h> #include <linux/userfaultfd_k.h> -#include <linux/coredump.h> #include <linux/latencytop.h> #include <linux/pid.h> #include <linux/delayacct.h>
_
Patches currently in -mm which might be from [email protected] are