Linux-XFS Archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Xiubo Li <xiubli@redhat.com>,
	linux-xfs@vger.kernel.org, chandan.babu@oracle.com,
	djwong@kernel.org, linux-kernel@vger.kernel.org,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	kasan-dev@googlegroups.com
Subject: Re: xfs : WARNING: possible circular locking dependency detected
Date: Wed, 17 Apr 2024 23:56:08 -0700	[thread overview]
Message-ID: <ZiDECInm854YiSPo@infradead.org> (raw)
In-Reply-To: <ZiCp2ArgSzjGQZql@dread.disaster.area>

Adding the KASAN maintainer so that we actuall have a chane of
fixing this instead of a rant that just gets lost on the xfs list..

On Thu, Apr 18, 2024 at 03:04:24PM +1000, Dave Chinner wrote:
> The only krealloc() in this path is:
> 
> 	new = krealloc(ifp->if_data, new_size,
>                         GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
> 
> And it explicitly uses __GFP_NOLOCKDEP to tell lockdep not to warn
> about this allocation because of this false positive situation.
> 
> Oh. I've seen this before. This is a KASAN bug, and I'm pretty sure
> I've posted a patch to fix it a fair while back that nobody seemed
> to care about enough to review or merge it.
> 
> That is: kasan_save_stack() is doing a fixed GFP_KERNEL allocation
> in an context where GFP_KERNEL allocations are known to generate
> lockdep false positives.  This occurs depsite the XFS and general
> memory allocation code doing exactly the right thing to avoid the
> lockdep false positives (i.e. using and obeying __GFP_NOLOCKDEP).
> 
> The kasan code ends up in stack_depot_save_flags(), which does a
> GFP_KERNEL allocation but filters out __GFP_NOLOCKDEP and does not
> add it back. Hence kasan generates the false positive lockdep
> warnings, not the code doing the original allocation.
> 
> kasan and/or stack_depot_save_flags() needs fixing here.
> 
> -Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
> 
---end quoted text---

  parent reply	other threads:[~2024-04-18  6:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  3:39 xfs : WARNING: possible circular locking dependency detected Xiubo Li
2024-04-18  5:04 ` Dave Chinner
2024-04-18  6:43   ` Xiubo Li
2024-04-18  6:56   ` Christoph Hellwig [this message]
2024-04-18 13:58     ` Andrey Ryabinin
2024-04-18 14:11 ` [PATCH] stackdepot: respect __GFP_NOLOCKDEP allocation flag Andrey Ryabinin
2024-04-19  2:49   ` Xiubo Li
2024-04-19  7:21   ` Xiubo Li

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=ZiDECInm854YiSPo@infradead.org \
    --to=hch@infradead.org \
    --cc=chandan.babu@oracle.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=xiubli@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).