]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
coredump: clarify "unsafe core_pattern" warning
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 14 Dec 2016 23:04:14 +0000 (15:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 15 Dec 2016 00:04:07 +0000 (16:04 -0800)
I was amused to find "unsafe core_pattern" warning having these lines in
/etc/sysctl.conf:

fs.suid_dumpable=2
kernel.core_pattern=/core/core-%e-%p-%E
kernel.core_uses_pid=0

Turns out kernel is formally right.  Default core_pattern is just "core",
which doesn't qualify for secure path while setting suid.dumpable.

Hint admins about solution, clarify sysctl names, delete unnecessary '\'
characters (string literals are concatenated regardless) and reformat for
easier grepping.

Link: http://lkml.kernel.org/r/20161029152124.GA1258@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/sysctl.c

index 39b3368f6de67119b830f3bc3db4382b00a54728..1475d2545b7e8ba6ef789ad6276ab5191b1b741f 100644 (file)
@@ -2389,9 +2389,11 @@ static void validate_coredump_safety(void)
 #ifdef CONFIG_COREDUMP
        if (suid_dumpable == SUID_DUMP_ROOT &&
            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");
+               printk(KERN_WARNING
+"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"
+               );
        }
 #endif
 }