All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jan Engelhardt <jengelh@inai.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: NULL deref around blkmq in v4.0-rc1–rc7
Date: Thu, 09 Apr 2015 15:42:51 -0600	[thread overview]
Message-ID: <5526F25B.5010501@kernel.dk> (raw)
In-Reply-To: <CA+55aFwwXLfz1mjiXGQtMZTDYEtspSPh64cokgYM9q7j9PKLwQ@mail.gmail.com>

On 04/09/2015 03:37 PM, Linus Torvalds wrote:
> On Thu, Apr 9, 2015 at 2:25 PM, Jens Axboe <axboe@kernel.dk> wrote:
>>
>> Not sure why it isn't all zeroed, definitely the saner thing to do at init
>> time.
>
> So practically speaking, it might well often be zeroed just because
> the BIOS may have initialized memory that way (and big multi-page
> allocations have probably not gotten re-used).
>
>> And if this is mpt, we recently ran into some list corruption issues due to
>> a bug in the driver. It hit on reboot, but it was scan related, so could be
>> a boot issue as well.
>
> So one of the earlier emails had this:
>
>     Copyright (c) 1999-2008 LSI Corporation
>     Fusion MPT SAS Host driver 3.04.20
>     mptbase: ioc0: Initiating bringup
>     ioc0: LSISAS1068 A0: Capabilities={Initiator}
>     scsi host0: ioc0: LSISAS1068 A0, FwRev=00000000h, Ports=8, MaxQ=256, IRQ=22
>     mptsas: ioc0: attaching ssp device: fw_channel 0, fw_id 1, phy 1,
> sas_addr 0x1060504030201a0
>     scsi 0:0:0:0: Direct-Access     VBOX     HARDDISK         1.0  PQ: 0 ANSI: 5
>     scsi 0:0:0:0: Attached scsi generic sg0 type 0
>     mptbase: ioc1: Initiating bringup
>     ioc1: LSISAS1068 A0: Capabilities={Initiator}
>     scsi host1: ioc1: LSISAS1068 A0, FwRev=00000000h, Ports=8, MaxQ=256, IRQ=17
>     mptsas: ioc1: attaching ssp device: fw_channel 0, fw_id 0, phy 0,
> sas_addr 0x60504030201a0
>     scsi 1:0:0:0: Direct-Access     VBOX     HARDDISK         1.0  PQ: 0 ANSI: 5
>     scsi 1:0:0:0: Attached scsi generic sg1 type 0
>
> and I'm assuming that that is the backing storage.

mpt is a maze of roughly duplicate, crazy drivers. The bug in question 
impacted mpt2sas and mpt3sas, and this looks like the mpt fusion driver. 
So it's probably not that.

> And yes, memory corruption sounds like a more likely cause than
> anything else. I don't like how the request data wasn't fully
> initialized, but the cmd->sense_buffer pointer itself *should* have
> been initialized by the ->init_request() call.

The block request state should be sane, we clear what we need, and 
at-alloc init will ensure that state is safe across request reuse. But 
it really should just be cleared unconditionally at allocation time.

And ->init_request() should take care of the SCSI command init. It does 
look like it's relying on zeroes already, so either adding the memset() 
or just adding the __GFP_ZERO would be prudent.

> So I don't actually expect my patch to really make any difference,
> although I do think that code should be looked at.

Jan, is it always clearing in a page size? That seems odd, especially if 
we're considering random gunk in memory.

-- 
Jens Axboe


  reply	other threads:[~2015-04-09 21:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 13:41 NULL deref around xfs in v4.0-rc1–rc7 Jan Engelhardt
2015-04-08 15:20 ` Jan Engelhardt
2015-04-09 17:38   ` Linus Torvalds
2015-04-09 18:24     ` NULL deref around blkmq " Jan Engelhardt
2015-04-09 21:12       ` Linus Torvalds
2015-04-09 21:25         ` Jens Axboe
2015-04-09 21:37           ` Linus Torvalds
2015-04-09 21:42             ` Jens Axboe [this message]
2015-04-09 22:32               ` Jan Engelhardt
2015-04-09 22:29         ` Jan Engelhardt
2015-04-10  0:07           ` Linus Torvalds
2015-04-11 17:46             ` Linus Torvalds
2015-04-11 17:47               ` Jens Axboe
2015-04-11 19:48               ` Jan Engelhardt

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=5526F25B.5010501@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=jengelh@inai.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.