]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fs: amended coredump-related sysctl functions
authorAlex Kelly <alex.page.kelly@gmail.com>
Fri, 28 Sep 2012 00:22:13 +0000 (10:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Oct 2012 05:04:01 +0000 (15:04 +1000)
This fixes an error introduced in the coredump-header patch in the
coredump removal patch I submitted earlier.  It should be squashed into
that patch series so that the Kconfig option to remove coredump doesn't
cause compile-time errors.

Signed-off-by: Alex Kelly <alex.page.kelly@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/sysctl.c

index 36de71906684f3f3bd772016124d876c4e358bf0..af25d0c91b141eb30334e6ff44b6081b90df972c 100644 (file)
@@ -179,8 +179,10 @@ static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
 
 static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
                void __user *buffer, size_t *lenp, loff_t *ppos);
+#ifdef CONFIG_COREDUMP
 static int proc_dostring_coredump(struct ctl_table *table, int write,
                void __user *buffer, size_t *lenp, loff_t *ppos);
+#endif
 
 #ifdef CONFIG_MAGIC_SYSRQ
 /* Note: sysrq code uses it's own private copy */
@@ -2051,12 +2053,14 @@ int proc_dointvec_minmax(struct ctl_table *table, int write,
 
 static void validate_coredump_safety(void)
 {
+#ifdef CONFIG_COREDUMP
        if (suid_dumpable == SUID_DUMPABLE_SAFE &&
            core_pattern[0] != '/' && core_pattern[0] != '|') {
                printk(KERN_WARNING "Unsafe core_pattern used with "\
                        "suid_dumpable=2. Pipe handler or fully qualified "\
                        "core dump path required.\n");
        }
+#endif
 }
 
 static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
@@ -2068,6 +2072,7 @@ static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
        return error;
 }
 
+#ifdef CONFIG_COREDUMP
 static int proc_dostring_coredump(struct ctl_table *table, int write,
                  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -2076,6 +2081,7 @@ static int proc_dostring_coredump(struct ctl_table *table, int write,
                validate_coredump_safety();
        return error;
 }
+#endif
 
 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
                                     void __user *buffer,