[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201210142603.662932100@linuxfoundation.org>
Date: Thu, 10 Dec 2020 15:27:10 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Menglong Dong <dong.menglong@....com.cn>,
Andrew Morton <akpm@...ux-foundation.org>,
Paul Wise <pabs3@...edaddy.net>,
Neil Horman <nhorman@...driver.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jakub Wilk <jwilk@...lk.net>
Subject: [PATCH 5.4 33/54] coredump: fix core_pattern parse error
From: Menglong Dong <dong.menglong@....com.cn>
commit 2bf509d96d84c3336d08375e8af34d1b85ee71c8 upstream.
'format_corename()' will splite 'core_pattern' on spaces when it is in
pipe mode, and take helper_argv[0] as the path to usermode executable.
It works fine in most cases.
However, if there is a space between '|' and '/file/path', such as
'| /usr/lib/systemd/systemd-coredump %P %u %g', then helper_argv[0] will
be parsed as '', and users will get a 'Core dump to | disabled'.
It is not friendly to users, as the pattern above was valid previously.
Fix this by ignoring the spaces between '|' and '/file/path'.
Fixes: 315c69261dd3 ("coredump: split pipe command whitespace before expanding template")
Signed-off-by: Menglong Dong <dong.menglong@....com.cn>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Cc: Paul Wise <pabs3@...edaddy.net>
Cc: Jakub Wilk <jwilk@...lk.net> [https://bugs.debian.org/924398]
Cc: Neil Horman <nhorman@...driver.com>
Cc: <stable@...r.kernel.org>
Link: https://lkml.kernel.org/r/5fb62870.1c69fb81.8ef5d.af76@mx.google.com
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/coredump.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -224,7 +224,8 @@ static int format_corename(struct core_n
*/
if (ispipe) {
if (isspace(*pat_ptr)) {
- was_space = true;
+ if (cn->used != 0)
+ was_space = true;
pat_ptr++;
continue;
} else if (was_space) {
Powered by blists - more mailing lists