Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp922930ybh; Wed, 15 Jul 2020 20:32:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIYamYbi6yb3gcqJXRS7T0ODDmj3Pl+x3QPBY9FqRyMpRIKth1rxJy/SkdX/rM2JyqU5ud X-Received: by 2002:a17:906:33c5:: with SMTP id w5mr1841574eja.275.1594870320539; Wed, 15 Jul 2020 20:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594870320; cv=none; d=google.com; s=arc-20160816; b=iXVlVonn7H/1Qq35Sx/R+pyv5bKJa2trMbaGMg5yLkXDqTNN7NXa+P45PQI7WqQplZ xki+prIx44yD3g9zgNR1l6Y9VhbULFM1qQlvctVOdo0d0sZHfQX6ePjTkn9v5tDiB55j BoNxH6aKgywMA9YB6dJoY6KZGi/Yj8x3tchHbRpXyBaWbRwss5vPdOuMi0qVZjInlSgv ufJ4vY8Y7WOdld4+bRwX5CE84G4yfpzdWHHluUACqvonLkCcd7zuvCrzpXW7iAP7Fuy5 Unmg8wUJuFfZLcb0y5o6B6XUA1IA0R41GNv0xyhSXs2sRMY0fn1P2jG1bsjZb5yBKfJ+ mo+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LeQ4H3Epw82A27lxkUbZ/f94rbyCQxgDIBx6zd/ZFsw=; b=RJ4yLQemidvkdQfM4cE96hmVx/i+rO5nGlOVOdZBHsO+YI+3UywTEFTwem1AZ8j4ke vo1A0CizQuqe3nolHF5IULyGWk5vLPiiI1M6krwmPCRCUgY6r3+MXsaFmhuvWZYyi2bn AOfK1EF113S9nEgPUzGu9bezOUGVyXdKh9ARFex/2xMmp0SCngGjS5BS62hrrQYzeg+d D47Dh128EXGhy5XcyBXI0FFurHuxLsgIGakg4OThLEfsp8VZ4CyS1honjM+YDEUIPzXN 1q1/3BmqumWUF5afWygkK3xeuAIUJvptNzKamK2CcTgWCWbWpbU9kwaprv9kBI+4VhZw dWbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ftG/dT0u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp8si3190096ejc.281.2020.07.15.20.31.38; Wed, 15 Jul 2020 20:32:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ftG/dT0u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728105AbgGPDau (ORCPT + 99 others); Wed, 15 Jul 2020 23:30:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:49306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbgGPDau (ORCPT ); Wed, 15 Jul 2020 23:30:50 -0400 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9433220663; Thu, 16 Jul 2020 03:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594870250; bh=ikmPWI8MAxfltvRswHekPbDid18TOw8D1FrTV++qoHM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ftG/dT0uCBDXZCXsbDz6ZLWmgFVO5Hfu9oCpJ2P2Hj7t/8PO1Ihi5lbTIw/yHzMhN Cx7YZn51zJpKNDe8bRLO52+Ejg07its1yEMp+il9Z4IInXDhsqoPlOQVrN1Slv3jfX u5zEiFR3ssQIcAWgDq8v4Kj4oD4wtwQMDxncESco= Date: Wed, 15 Jul 2020 20:30:48 -0700 From: Eric Biggers To: Suren Baghdasaryan Cc: gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com, maco@android.com, joel@joelfernandes.org, christian@brauner.io, hridya@google.com, mhocko@kernel.org, hdanton@sina.com, devel@driverdev.osuosl.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 1/1] staging: android: ashmem: Fix lockdep warning for write operation Message-ID: <20200716033048.GG1167@sol.localdomain> References: <20200716024527.4009170-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200716024527.4009170-1-surenb@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 07:45:27PM -0700, Suren Baghdasaryan wrote: > syzbot report [1] describes a deadlock when write operation against an > ashmem fd executed at the time when ashmem is shrinking its cache results > in the following lock sequence: > > Possible unsafe locking scenario: > > CPU0 CPU1 > ---- ---- > lock(fs_reclaim); > lock(&sb->s_type->i_mutex_key#13); > lock(fs_reclaim); > lock(&sb->s_type->i_mutex_key#13); > > kswapd takes fs_reclaim and then inode_lock while generic_perform_write > takes inode_lock and then fs_reclaim. However ashmem does not support > writing into backing shmem with a write syscall. The only way to change > its content is to mmap it and operate on mapped memory. Therefore the race > that lockdep is warning about is not valid. Resolve this by introducing a > separate lockdep class for the backing shmem inodes. > > [1]: https://lkml.kernel.org/lkml/0000000000000b5f9d059aa2037f@google.com/ > > Signed-off-by: Suren Baghdasaryan Please add proper tags: Reported-by: syzbot+7a0d9d0b26efefe61780@syzkaller.appspotmail.com Fixes: ... Cc: stable@vger.kernel.org The Reported-by tag to use was given in the original syzbot report. - Eric