public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thibaut Sautereau <thibaut.sautereau@clip-os.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: NULL pointer dereference in coredump code
Date: Tue, 19 May 2020 09:16:52 +0200	[thread overview]
Message-ID: <20200519071652.GA924@clip-os.org> (raw)
In-Reply-To: <20200330083158.GA21845@clip-os.org>

On Mon, Mar 30, 2020 at 10:31:59AM +0200, Thibaut Sautereau wrote:
> I hit a kernel NULL pointer dereference caused by the following call chain:
> 
> do_coredump()
>   file_start_write(cprm.file) # cprm.file is NULL
>     file_inode(file) # NULL ptr deref
> 
> The `ispipe` path is followed in do_coredump(), and:
>     # cat /proc/sys/kernel/core_pattern
>     |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h
> 
> It seems that cprm.file can be NULL after the call to the usermode
> helper, especially when setting CONFIG_STATIC_USERMODEHELPER=y and
> CONFIG_STATIC_USERMODEHELPER_PATH="", which is the case for me.
> 
> One may say it's a strange combination of configuration options but I
> think it should not crash the kernel anyway. As I don't know much about
> coredumps in general and this code, I don't know what's the best way to
> fix this issue in a clean and comprehensive way.
> 
> I attached the patch I used to temporarily work around this issue, if
> that can clarify anything.
> 
> Thanks,

For the record, this had previously been reported [1] and was eventually
fixed by 3740d93e3790 ("coredump: fix crash when umh is disabled").

[1] https://bugzilla.kernel.org/show_bug.cgi?id=199795

-- 
Thibaut Sautereau
CLIP OS developer

      reply	other threads:[~2020-05-19  7:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  8:31 NULL pointer dereference in coredump code Thibaut Sautereau
2020-05-19  7:16 ` Thibaut Sautereau [this message]

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=20200519071652.GA924@clip-os.org \
    --to=thibaut.sautereau@clip-os.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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