Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1116982lqb; Wed, 17 Apr 2024 23:56:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAOFCDWAoeZcKJNJOAhm1lXRRRvUTBpPciD22+Vf6jbApjw6ZCSQUDhdDb8qqQHZdGivkWQ/WFdp3jYOLIGc3w8SgR71+1Kr0Wc8dO1w== X-Google-Smtp-Source: AGHT+IEbrd9p40INEN65YEk8a/MSb80FjqJpRAr8mttkVIknDVSIyxNgYDjw5f13Rqrs9G7HxRgW X-Received: by 2002:a05:6870:8914:b0:22e:9792:97e5 with SMTP id i20-20020a056870891400b0022e979297e5mr2239171oao.30.1713423377313; Wed, 17 Apr 2024 23:56:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713423377; cv=pass; d=google.com; s=arc-20160816; b=lPPEpx+JW9Alg9m+GkF96CKMbeTAz9aWsXoPUvDym98Tu2mLd/+jfM1q0dc+BiaeG2 7C8UetWXVF3zP40aQeoEQVUNZS54hyOqQoCZpwFuBP8y97h1pIsI/qwL8KCmwKo8CZ6P dICuTyGHRv9gZDZLzI4yJsfm9GUHZotDz7OuHSrcb1435TsOBFnSyyavBh13H05AVXyF iqM29xL43l4DS1/j+2TmFhccsqKM3eG966cHga/A1uCdxKREQcDPmO+stuF6EpZ19yag B6JSEpJ9kQSSL4nthQJLmpsU/Y48018t2ksM3Pqo97v4cQDERputO8PMs9YYVC+Ht2HJ VCeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=rf7iH3kMuOmRA9x6ghFFTvcsrJ/ISQqGDxDhjq51q04=; fh=XT7nj5sD5mLZnMVsazD67CBpRFsUam35XF5zYGaGZrE=; b=UvM0d82iNGRiINt0jJFNKBj8rhkQGEnB6JbPxT0+1HPR1hY//4nzgPQppUfxNDZ9Dp 59uzgo5i0FKThzmrmlaKJo9mGoHLNfdA8tI0qxk0NAyquhUeHiy2+hCOkoqmww92fejg nxSFdDXWSlCVypxozZonfzzJXuONWdHj6x9hkTcI/0nw+s1nhYj8mqKMgfAlePIVvIeN WIKJu437CfSec5PdqYGyHMxaiz9xR4gvks/rlwptSV0vENGy/FuTEJ1ekIzX2ybvrzkQ 61LQ1sacG6yNOYx8sa8smBES6UqZkGJRU7CuVuk+tKdKn1jw87wn+9o2KiY/eK0fFKL5 dWEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=rf4a6dBH; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-149622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149622-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k6-20020a636f06000000b005f77a64dfc5si844244pgc.33.2024.04.17.23.56.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 23:56:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=rf4a6dBH; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-149622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149622-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF7FF281DC5 for ; Thu, 18 Apr 2024 06:56:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60203381CC; Thu, 18 Apr 2024 06:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="rf4a6dBH" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FD85F9E9; Thu, 18 Apr 2024 06:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713423370; cv=none; b=lUhV6dk3QvMVvWeEkrLPPJTwyfJ/+ATO/jNTkH1Dl+65bR48ccPZ7Z3RivSVnDjd1ANNxYd6z1+v2BSbkAdN1fNM02aIMHuIK6FGfom1az+q56sRj4efJtEHNhgbn6mCIzkOXEi3+vipEoJJtBfetwuV5YbAd3jsgfgqy2sePss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713423370; c=relaxed/simple; bh=IsExlcz2Xfug/BF9nxQEE7UvsLNy9ys/X476DRWYKxw=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=uuu0QG68bNfC0r53zMTkRNads6a8gaPZZL/72LabiQHR5U3CbwHGBWI00rIMeUs+3si6K7JOrT8PSTKCkCII5fhuE7OeyesadWO6FxFYfxiJCjUwZW7rmIBvp4KTEkUMkSkMwnf7rDZEBj9AqtYvqw/RYhH0Xmd+XHvKQoBZnyE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=rf4a6dBH; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding :Content-ID:Content-Description:References; bh=rf7iH3kMuOmRA9x6ghFFTvcsrJ/ISQqGDxDhjq51q04=; b=rf4a6dBHA2GobREdG26szefzxA HSdTSboPz51McD1ZaykaePmvtrK+wfJ3fJtYeQ+ygTaEGUMwhjlX8/2o9MIqjv3jY8jiJxazjH/YB 0xLiJgo4KxO2X85TbAjbjW+KherNdx8wK9ZuWOaN0f+PkW9bvtnMqFcjgAflHBIdZK8BtKJX/Tie6 sinLcqdj0XCZ8mNS2kgNb8rGaqrFLcEj6UPXn2j2q3PjaCuEO3K3VmBBH7/RdSCT53J5EF2r/VdSQ IrMHyg0G6SzcYdf0iPM3kHeQmSSmF1UQTGYLeOhJ9fX4otg1XYoU4vbVzZpsA43QLRxuW0A8RYEJz pKdaUvMQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxLgm-00000001Bod-2kwO; Thu, 18 Apr 2024 06:56:08 +0000 Date: Wed, 17 Apr 2024 23:56:08 -0700 From: Christoph Hellwig To: Dave Chinner Cc: Xiubo Li , linux-xfs@vger.kernel.org, chandan.babu@oracle.com, djwong@kernel.org, linux-kernel@vger.kernel.org, Andrey Ryabinin , kasan-dev@googlegroups.com Subject: Re: xfs : WARNING: possible circular locking dependency detected Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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---