stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + coredump-fix-core_pattern-parse-error.patch added to -mm tree
@ 2020-11-24  4:06 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-11-24  4:06 UTC (permalink / raw)
  To: dong.menglong, jwilk, mm-commits, nhorman, pabs3, stable


The patch titled
     Subject: coredump: fix core_pattern parse error
has been added to the -mm tree.  Its filename is
     coredump-fix-core_pattern-parse-error.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/coredump-fix-core_pattern-parse-error.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/coredump-fix-core_pattern-parse-error.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Menglong Dong <dong.menglong@zte.com.cn>
Subject: coredump: fix core_pattern parse error

'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',
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'.

Link: https://lkml.kernel.org/r/5fb62870.1c69fb81.8ef5d.af76@mx.google.com
Fixes: 315c69261dd3 ("coredump: split pipe command whitespace before expanding template")
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/coredump.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/coredump.c~coredump-fix-core_pattern-parse-error
+++ a/fs/coredump.c
@@ -229,7 +229,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) {
_

Patches currently in -mm which might be from dong.menglong@zte.com.cn are

coredump-fix-core_pattern-parse-error.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-24  4:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24  4:06 + coredump-fix-core_pattern-parse-error.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).