[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20201123200636.2dbbf127e7cd75b4022bd75f@linux-foundation.org>
Date: Mon, 23 Nov 2020 20:06:36 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: menglong8.dong@...il.com
Cc: pabs3@...edaddy.net, viro@...iv.linux.org.uk,
nhorman@...driver.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Menglong Dong <dong.menglong@....com.cn>
Subject: Re: [PATCH] coredump: fix core_pattern parse error
On Thu, 19 Nov 2020 03:08:43 -0500 menglong8.dong@...il.com wrote:
> From: Menglong Dong <dong.menglong@....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',
> 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'.
>
> ...
>
> --- 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) {
Looks good to me. It's been a bit more than a year, but I'll add a
cc:stable to this so that the earlier kernels get the fix.
Powered by blists - more mailing lists