public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	dieti.hahn@gmail.com
Subject: Re: Kernel panic because of wrong contents in core_pattern
Date: Fri, 15 Nov 2019 13:27:40 +0000	[thread overview]
Message-ID: <20191115132740.GP26530@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1856804.EHpamdVGlA@amur.mch.fsc.net>

On Fri, Nov 15, 2019 at 02:01:55PM +0100, Dietmar Hahn wrote:

> Later a user tool dumped with SIGSEGV and the linux system crashed.
> I investigated the crash dump and found the cause.
> 
> Via format_corename() in fs/coredump.c the helper_argv[] with 3 entries is
> created and helper_argv[0] == "" (because of the ' ' after the '|')
> ispipe is set to 1.
> Later in call_usermodehelper_setup():
>   sub_info->path = path;  == helper_argv[0] == ""
> This leads in call_usermodehelper_exec() to:
>   if (strlen(sub_info->path) == 0)
>                 goto out;
> with a return value of 0.
> But no pipe is created and thus cprm.file == NULL.
> This leads in file_start_write() to the panic because of dereferencing
>  file_inode(file)->i_mode)
> 
> I'am not sure what's the best way to fix this so I've no patch.
> Thanks.

Check in the caller of format_corename() for **argv being '\0' and fail
if it is?  I mean, turn that
                if (ispipe < 0) {
                        printk(KERN_WARNING "format_corename failed\n");
                        printk(KERN_WARNING "Aborting core\n");
                        goto fail_unlock;
                }   
in there into
		if (ispipe < 0 || !**argv) {
                        printk(KERN_WARNING "format_corename failed\n");
                        printk(KERN_WARNING "Aborting core\n");
                        goto fail_unlock;
                }


  reply	other threads:[~2019-11-15 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 13:01 Kernel panic because of wrong contents in core_pattern Dietmar Hahn
2019-11-15 13:27 ` Al Viro [this message]
2019-11-18 14:23   ` Dietmar Hahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191115132740.GP26530@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dieti.hahn@gmail.com \
    --cc=dietmar.hahn@ts.fujitsu.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox