All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Steffen Maier <maier@linux.vnet.ibm.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.de>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
	"Taraka R. Bodireddy" <tarak.reddy@in.ibm.com>,
	"Seshagiri N. Ippili" <seshagiri.ippili@in.ibm.com>,
	"Manvanthara B. Puttashankar" <mputtash@in.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: Re: [GIT PULL] Queue free fix (was Re: [PATCH] block: Free queue resources at blk_release_queue())
Date: Mon, 17 Oct 2011 17:46:32 +0900	[thread overview]
Message-ID: <4E9BEB68.1050707@ce.jp.nec.com> (raw)
In-Reply-To: <1318608184.3018.42.camel@dabdike.int.hansenpartnership.com>

On 10/15/11 01:03, James Bottomley wrote:
> On Thu, 2011-10-13 at 15:09 +0200, Steffen Maier wrote:
>> This fix also went into 3.0.5 via
>> http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=blob;f=releases/3.0.5/block-free-queue-resources-at-blk_release_queue.patch
>> (originated at http://marc.info/?l=linux-scsi&m=131669751909474&w=2 and 
>> http://marc.info/?l=linux-scsi&m=131669414205696&w=2)
>>
>> However, it seems we still have a use-after-free bug, now causing the 
>> following oops with kernel 3.0.6 when removing paths to storage while 
>> generating load on device-mapper multipath disks:
>>
>>> Unable to handle kernel pointer dereference at virtual kernel address 6b6b6b6b6b6b6000
>>> Oops: 0038 [#1] PREEMPT SMP DEBUG_PAGEALLOC
>>> Modules linked in: iptable_filter ip_tables x_tables dm_round_robin sunrpc qeth_l3 binfmt_misc dm_multipath scsi_dh dm_mod ipv6 qeth ccwgroup [last unloaded: scsi_wait_scan]
>>> CPU: 1 Not tainted 3.0.6-50.x.20111006-s390xdefault #1
>>> Process blast.LzS_64_SL (pid: 26613, task: 0000000063e2a398, ksp: 0000000064de3560)
>>> Krnl PSW : 0704100180000000 000000000048a038 (scsi_print_command+0x44/0xf8)
>>>            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
>>> Krnl GPRS: 000000000000006b 6b6b6b6b6b6b6b6b 000000006717f800 000000000094f2e0
>>>            000000000061242e 000000000062bd88 0000000066fb90d8 0000000065391ad7
>>>            000000006717f800 000000006717f800 000000006716a090 000000006717f800
>>>            0000000000000004 0000000000672f88 0000000064de3838 0000000064de3808
>>> Krnl Code: 000000000048a026: f0b80004ebbf        srp     4(12,%r0),3007(%r14),8
>>>            000000000048a02c: f0a0000407f4        srp     4(11,%r0),2036,0
>>>            000000000048a032: e31020800004        lg      %r1,128(%r2)
>>>           >000000000048a038: e31010b00004        lg      %r1,176(%r1)
>>>            000000000048a03e: b9020011            ltgr    %r1,%r1
>>>            000000000048a042: a7840032            brc     8,48a0a6
>>>            000000000048a046: e33020000004        lg      %r3,0(%r2)
>>>            000000000048a04c: c04000182f4c        larl    %r4,78fee4
>>> Call Trace:
>>> ([<000000006717f800>] 0x6717f800)
>>>  [<0000000000487f28>] scsi_log_send+0xf0/0x130
>>>  [<000000000048824c>] scsi_dispatch_cmd+0xc8/0x4bc
>>>  [<0000000000490694>] scsi_request_fn+0x3b8/0x480
> 
> Correct me if I'm wrong, but this seems to be saying that struct
> scsi_cmnd was used after free.  This looks to be a different problem
> because the command has a separate refcounting model which wasn't
> impacted by the change ... it could be we've just exposed yet another
> refcounting problem outside of the queue one.
> 
> If I had to guess, I'd say a bio got cloned with a SCSI command already
> attached, but the ref count on the SCSI command wasn't correctly
> adjusted.

As far as dm is concerned, it shouldn't happen.
Clone is made from a dm request, not from SCSI one.
Also clone is not reused when retrying.

>> Initially, we encountered use-after-free bugs in
>> scsi_print_command / scsi_dispatch_cmd
>> http://marc.info/?l=linux-scsi&m=130824013229933&w=2

It is interesting that both this and the older report
got oopsed in scsi_log_send(), while there are other
dereferences of 'cmd' around scsi_dispatch_cmd().
Are there any reason they are special? Just by accident?

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation

  reply	other threads:[~2011-10-17  8:46 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-22 13:18 [PATCH] block: Free queue resources at blk_release_queue() Hannes Reinecke
2011-09-28  0:47 ` Jens Axboe
2011-09-28  0:55   ` Linus Torvalds
2011-09-28  1:15     ` Jens Axboe
2011-09-28  1:59       ` Linus Torvalds
2011-09-28  2:02         ` Jens Axboe
2011-09-28  4:10         ` James Bottomley
2011-09-28 14:08           ` Jens Axboe
2011-09-28 14:11             ` James Bottomley
2011-09-28 14:14               ` [GIT PULL] Queue free fix (was Re: [PATCH] block: Free queue resources at blk_release_queue()) Jens Axboe
2011-09-28 15:22                 ` Linus Torvalds
2011-09-28 15:22                   ` Linus Torvalds
2011-09-28 15:43                   ` James Bottomley
2011-09-28 17:48                     ` Vivek Goyal
2011-09-28 17:53                       ` Christoph Hellwig
2011-09-28 18:09                         ` Vivek Goyal
2011-09-28 18:16                           ` Christoph Hellwig
2011-09-28 19:05                             ` Eric Seppanen
2011-09-28 19:05                               ` Eric Seppanen
2011-09-28 19:14                               ` Christoph Hellwig
2011-11-30 10:18                               ` Jens Axboe
2011-11-30 10:26                                 ` Christoph Hellwig
2011-09-28 22:34                             ` Vivek Goyal
2011-09-28 17:59                       ` James Bottomley
2011-10-13 13:09                 ` Steffen Maier
2011-10-14 16:03                   ` James Bottomley
2011-10-17  8:46                     ` Jun'ichi Nomura [this message]
2011-10-17 14:06                       ` James Bottomley
2011-10-18 13:31                         ` Jun'ichi Nomura
2011-10-18 15:45                           ` Heiko Carstens
2011-10-18 16:29                             ` James Bottomley
2011-10-31 10:05                               ` Heiko Carstens
2011-10-31 10:42                                 ` James Bottomley
2011-10-31 11:46                                   ` Jun'ichi Nomura
2011-10-31 13:00                                     ` Heiko Carstens
2011-11-02 12:37                                       ` Jun'ichi Nomura
2011-11-02 12:44                                         ` Hannes Reinecke
2011-11-02 12:44                                           ` Hannes Reinecke
2011-11-02 13:47                                         ` Heiko Carstens
2011-11-04  4:07                                           ` Jun'ichi Nomura
2011-11-04  9:12                                             ` Heiko Carstens
2011-11-03 18:25                                       ` Mike Snitzer
2011-11-04  9:19                                         ` Heiko Carstens
2011-11-04 13:30                                           ` Mike Snitzer
2011-11-04 13:37                                             ` Hannes Reinecke
2011-11-07 11:31                                             ` Jun'ichi Nomura
2011-11-07 13:42                                               ` Mike Snitzer
2011-11-07 12:23                                             ` Heiko Carstens
2011-11-07 11:30                                           ` Jun'ichi Nomura
2011-11-07 15:36                                             ` Mike Snitzer
2011-11-07 16:43                                               ` Heiko Carstens
2011-11-07 17:10                                               ` Mike Snitzer
2011-11-07 21:44                                                 ` Mike Snitzer
2011-11-09  9:37                                           ` Hannes Reinecke
2011-11-10 16:10                                             ` Heiko Carstens
2011-11-17 16:29                                               ` Mike Snitzer
2011-11-29 12:00                                                 ` Heiko Carstens
2011-11-29 20:18                                                   ` Mike Snitzer
2011-11-30  7:25                                                     ` Hannes Reinecke
2011-11-30  7:25                                                       ` Hannes Reinecke
2011-12-12 12:39                                                     ` Heiko Carstens
2011-12-13 16:50                                                       ` Mike Snitzer
2011-10-31 13:21                                   ` Mike Snitzer
2011-10-31 13:40                                     ` Heiko Carstens
2011-10-31 14:01                                       ` Mike Snitzer

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=4E9BEB68.1050707@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=cascardo@linux.vnet.ibm.com \
    --cc=hare@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=maier@linux.vnet.ibm.com \
    --cc=mputtash@in.ibm.com \
    --cc=seshagiri.ippili@in.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tarak.reddy@in.ibm.com \
    /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.