mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pradeep Pragallapati (QUIC)" <quic_pragalla@quicinc.com>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Yu Kuai <yukuai1@huaweicloud.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"yukuai (C)" <yukuai3@huawei.com>,
	Christoph Hellwig <hch@infradead.org>
Subject: RE: [PATCH V1] block: Fix null pointer dereference issue on struct io_cq
Date: Thu, 18 May 2023 09:25:52 +0000	[thread overview]
Message-ID: <7e32c001d222483394327c5802a6c985@quicinc.com> (raw)
In-Reply-To: <344bfde9-5f7e-80a2-038f-3bfc387ea678@kernel.org>

Hi,

-----Original Message-----
From: Damien Le Moal <dlemoal@kernel.org> 
Sent: Wednesday, May 17, 2023 3:02 PM
To: Christoph Hellwig <hch@infradead.org>
Cc: Yu Kuai <yukuai1@huaweicloud.com>; Pradeep Pragallapati (QUIC) <quic_pragalla@quicinc.com>; axboe@kernel.dk; linux-block@vger.kernel.org; linux-kernel@vger.kernel.org; yukuai (C) <yukuai3@huawei.com>
Subject: Re: [PATCH V1] block: Fix null pointer dereference issue on struct io_cq

On 5/17/23 18:21, Christoph Hellwig wrote:
> On Wed, May 17, 2023 at 06:20:19PM +0900, Damien Le Moal wrote:
>> twice for the same icq. The missing rcu lock in ioc_exit_icqs() 
>> already was in itself a bug, and the missing flag check is another.
> 
> spinlocks imply a rcu critical section, no need to duplicate it.

Right. And I misread the code. As Yu said, given that ioc_exit_icqs() iterates the list of icqs under ioc->lock and the ioc is removed from that list under the same lock, ioc_exit_icqs() should never see an icq that went through ioc_destroy_icq()...
Very weird.

This weird can be possible 
1. updating icq_hint which is annotated as __rcu type without RCU-protected context in ioc_destroy_icq().
Moreover, this was taken care in else part of ioc_release_fn() by rcu_read_lock/unlock() but missed in if statement which can lead to this weird.

2. extracting icq from hlist/list elements are done using rcu locks protected in ioc_clear_queue() but same was not at ioc_exit_icqs().

So, far we have seen 10+ instances of this crash on 6.1 kernel during stability testing (Involves IO, reboots, device suspend/resume, and few more).
With the V1 patch, we didn't observe the issue for at least 48hrs+ of stability testing.


--
Damien Le Moal
Western Digital Research


  reply	other threads:[~2023-05-18  9:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17  8:44 Pradeep P V K
2023-05-17  8:55 ` Chaitanya Kulkarni
2023-05-17  8:58 ` Yu Kuai
2023-05-17  9:20   ` Damien Le Moal
2023-05-17  9:21     ` Christoph Hellwig
2023-05-17  9:31       ` Damien Le Moal
2023-05-18  9:25         ` Pradeep Pragallapati (QUIC) [this message]
2023-05-18 12:16   ` Yu Kuai
2023-05-18 12:44     ` Yu Kuai
2023-05-22  6:19       ` Pradeep Pragallapati
2023-05-30 13:15         ` Pradeep Pragallapati
2023-05-30 13:24           ` Yu Kuai

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=7e32c001d222483394327c5802a6c985@quicinc.com \
    --to=quic_pragalla@quicinc.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®