Received: by 2002:a17:90a:bc8d:0:0:0:0 with SMTP id x13csp1480551pjr; Mon, 18 May 2020 14:15:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweOdbVvdd6dNxv1aImcAzceFStbfBLU0Y6siXvXkZPvq6VbsbbeSICVo4JifiVgOOh/2pq X-Received: by 2002:a17:906:b843:: with SMTP id ga3mr13636837ejb.340.1589836530960; Mon, 18 May 2020 14:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589836530; cv=none; d=google.com; s=arc-20160816; b=VFdsY4vHV9Dn9Imf5b4tDHo03cZ96zId2psuKe9tlh5sNmdzW3+mhEdD1v6nT4zmP1 x+Y6vLVU4UjIMl7I9yOhwr7dl3Ml8qPz6SpH0VGrj83cBfptAeZZtjXnyZtnrI98iBcp OwLU4zSk1izGjm0X2KRoVQWzhuaxYS6ErW8uheRDMpHcAMb309V/DdXuYwdKjQJQOu1u QZZU0Xjye4LvS+UXe3kXKCB4ZyjPcODOzAjMBC9QSKPSVrjDYsgwdzFU4LtuasIRvfZv PfCppl1S3ytLWpPXbxez/gSDU4Jmyn5It13SH1OD3B2DybOX79cUIRDeunpuMCtbQDHN GXeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tx+Qx/2bvyo5Y93Yr25FeMZob/Y7mIyfZ8hAOzxBubQ=; b=vT5L+v+FFObz+N2YnJMLDDnBnAXWexmT9XNlWhDKnFO9HtznYxVu1Ms3uTUWwgb1L0 pFl7TEpLFHucaaXJjiS3SYyVL62ahS4PAOS6vezrQfo8SbV6ZJn5vqj35iV/SB66oT28 RZq5pwODqfeml+A/5OdFaIdQ9XK1I5gdsjmZNYeSkaC2gwfoL1+olQFM026wATjKI6Cr +dR1ZEIh/v+gagK2rrHM6yEVqyLEqt2V6atZT7XR2sOd9LeevcLE7YG4J5KW5G8n+/7X liTiSW19YA1iwAOB1kccQoMNMyfQDasFvo6yvVPevmO5hnrnEu36ar16Xuc2ZSybDfiH Zw9Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si2481364ejj.264.2020.05.18.14.15.07; Mon, 18 May 2020 14:15:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726502AbgERVNd (ORCPT + 99 others); Mon, 18 May 2020 17:13:33 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:39506 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgERVNd (ORCPT ); Mon, 18 May 2020 17:13:33 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 8B42D1C025E; Mon, 18 May 2020 23:13:31 +0200 (CEST) Date: Mon, 18 May 2020 23:13:30 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+c8a8197c8852f566b9d9@syzkaller.appspotmail.com, syzbot+40b71e145e73f78f81ad@syzkaller.appspotmail.com, Hugh Dickins , Andrew Morton , Yang Shi , Linus Torvalds , Sasha Levin Subject: Re: [PATCH 4.19 02/80] shmem: fix possible deadlocks on shmlock_user_lock Message-ID: <20200518211330.GA25576@amd> References: <20200518173450.097837707@linuxfoundation.org> <20200518173450.633393924@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline In-Reply-To: <20200518173450.633393924@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > This may not risk an actual deadlock, since shmem inodes do not take > part in writeback accounting, but there are several easy ways to avoid > it. =2E.. > Take info->lock out of the chain and the possibility of deadlock or > lockdep warning goes away. It is unclear to me if actual possibility of deadlock exists or not, but anyway: > int retval =3D -ENOMEM; > =20 > - spin_lock_irq(&info->lock); > + /* > + * What serializes the accesses to info->flags? > + * ipc_lock_object() when called from shmctl_do_lock(), > + * no serialization needed when called from shm_destroy(). > + */ > if (lock && !(info->flags & VM_LOCKED)) { > if (!user_shm_lock(inode->i_size, user)) > goto out_nomem; Should we have READ_ONCE() here? If it is okay, are concurency sanitizers smart enough to realize that it is okay? Replacing warning with different one would not be exactly a win... Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --8t9RHnE3ZwKMSgU+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl7C+noACgkQMOfwapXb+vIp4QCeOHGsBJ1v5LOYIQ5B6hvE0DCT 6KEAn02mxYUIBMKxf6gx/Zb4s1ygGl9Z =HaBo -----END PGP SIGNATURE----- --8t9RHnE3ZwKMSgU+--