From: Menglong Dong dong.menglong@zte.com.cn
'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@zte.com.cn Signed-off-by: Andrew Morton akpm@linux-foundation.org Cc: Paul Wise pabs3@bonedaddy.net Cc: Jakub Wilk jwilk@jwilk.net [https://bugs.debian.org/924398] Cc: Neil Horman nhorman@tuxdriver.com Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/5fb62870.1c69fb81.8ef5d.af76@mx.google.com Signed-off-by: Linus Torvalds torvalds@linux-foundation.org --- fs/coredump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/coredump.c b/fs/coredump.c index 0cd9056d79cc..c6acfc694f65 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -229,7 +229,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm, */ if (ispipe) { if (isspace(*pat_ptr)) { - was_space = true; + if (cn->used != 0) + was_space = true; pat_ptr++; continue; } else if (was_space) {
On Sun, Jan 17, 2021 at 12:52:28PM +0800, menglong8.dong@gmail.com wrote:
From: Menglong Dong dong.menglong@zte.com.cn
'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@zte.com.cn Signed-off-by: Andrew Morton akpm@linux-foundation.org Cc: Paul Wise pabs3@bonedaddy.net Cc: Jakub Wilk jwilk@jwilk.net [https://bugs.debian.org/924398] Cc: Neil Horman nhorman@tuxdriver.com Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/5fb62870.1c69fb81.8ef5d.af76@mx.google.com Signed-off-by: Linus Torvalds torvalds@linux-foundation.org
fs/coredump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
What is the git commit id of this, and what stable trees do you want it merged to?
I'm so sorry! I just send this patch by mistake~
On Sun, Jan 17, 2021 at 4:21 PM Greg KH greg@kroah.com wrote:
[...]
What is the git commit id of this, and what stable trees do you want it merged to?
I just wanted to make a test, and never expect that 'git send-email' add CC automatically
Sorry! (sincerely) Menglong Dong
linux-stable-mirror@lists.linaro.org