From patchwork Fri Mar 22 15:44:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160928 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961902jan; Fri, 22 Mar 2019 08:47:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1CTgZIw/DXTG4Y8tUwQO2TyBxEGOU821h0ROzeUTSGmsilIHmG+m3DAdm9rOVSf0tojyZ X-Received: by 2002:a17:902:290b:: with SMTP id g11mr10228759plb.269.1553269662998; Fri, 22 Mar 2019 08:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269662; cv=none; d=google.com; s=arc-20160816; b=V8GIHveFccea4pc7yjrVvXI/v96rbyTEyserpuYtINEfG4rIKBqHrHENKA2ovrkHce Yx4DEJOhFuT0BLyABtxzGKhJgn4SSufVM0PRikygiOR99eXLGwdNCbWtDpKOM6bIwhlZ 417k3GPvbmKlNejJQNDpWd5pA1CZcTqSTe2pqcqwHk86JqfCzulolfB2jYusyI473XuF 7pIWtzXVXMmBSqg+yW1HkukRXNMFjID0T0/ezwNDpmC4lO45kddkxnq3Mmo1KJcJYsIX kWKRzgdW0yokq8vZKYSwdXuTzA5l+XlTjA/IkRPjaYKDLnz07VFNSgi9YMx+i+uYtpGW 8ULg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IhDNwIOxYiNuMhOLPEts3SuSbShNhJqvzKkXI4ciqCQ=; b=0stdIi8yZPF4XSYqchTnFPP4Pecq6AlZByUACcL67A0b6jfYG6GH9s6V/cWsOGb+Ns SIqtCKhDkd+HWRSCi/sDrrOPH4gYIXgrFOLuKR38LEUw0wrsvSv5tLFG83LuzhSpJeZB vYSnDj4mBfejPRPJMWsTppjqQmcEZdFT6y0M1Smh/O3Elfyneu/PWnf98EKhMU7E0xse uoV/SrrRBIqyGHqgv+cRX6qtetG1DCbKAH9rDDOx2rl9ulYnBOTGYN2XLd2AQ27hh7Ir AtHh7jKekTeT36/kgcKoYm/Woap7zi4cZG8+hap3r/jky6cO+M8QxV9CRpPK5A5PV5UV aggg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si6856099pfn.164.2019.03.22.08.47.42; Fri, 22 Mar 2019 08:47:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbfCVPrm (ORCPT + 14 others); Fri, 22 Mar 2019 11:47:42 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:56459 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPrl (ORCPT ); Fri, 22 Mar 2019 11:47:41 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MPosX-1hKuvq2lZj-00Mtqj; Fri, 22 Mar 2019 16:47:13 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Mike Kravetz , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Naoya Horiguchi , Mike Rapoport , Andrey Ryabinin , Kirill Tkhai , Christian Borntraeger , Hugh Dickins Cc: Konstantin Khlebnikov , Vasily Averin , Vlastimil Babka , Linus Torvalds , Arnd Bergmann , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 12/25] mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON Date: Fri, 22 Mar 2019 16:44:03 +0100 Message-Id: <20190322154425.3852517-13-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:x9JLVby8r9r7TUxGTqLadFU79q0Pp1coCzkDeRV4r6c3+Dj8drW w3wZyzmVLkCOYTZj7d1rl88zJZduSJcyDx7T15j+BD/3ifn1JSCjet7XYnM20CaSy6N1FqD 7oLYAODBmF5j39idn1uZOpAtb5Pka75NOa5OilzhmcKHyWFj6CykM7EbL/824ma//x/PSon oX+qL1Ko/GgJFwkbg64yQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Tc+wj3NMZgw=:RU5Wsg8S3mds99gc6a+cXf 24zk4q6XyhTdtuLlc4ogImJLY4QiG24v/yy09Tl/6LHmXdSKfSSz0YHGE29MfuqrdWegfJOkP HARXOKftZgpOMl+c9zVYH0PEzaM8Tif2m3cTj4zkvf1Y2f8q2ma3eHQ+po2nSuoicrIhb9EJS lp2Pe4Ws18R1OVojCdmuEoK4o8x/lOCAkOF4stpcg4PpCzti1AzmQ0ZB5dEcPdRAAhN19JqBv 2qmULxrOYCuIWVcX5tLf5DMlamm5q1llRTPHC2dZkj1fL42dCF8D+NegqIH4gMhOZdqy3dW1l KfFLyp6JOnY9vbztmz3bqyshvyqyogXFd8yivOCzuTmQkItbHHziDVXUR72l0yepI5FAHT4wE clQHva8klOUopNyxz6rK45XmcYuZXe3BgbEfyVqT8H0F1z+0upYceQcNDsgGo/Pnk0L88JPj/ Q2M3FiuLkzN2pXg9ZshcAprVQytMU19AeN8vxAbJ0rbeESp42ZovYrdku5j+ozGN2tMGaGUXY FOdw5kl+ItdZaAy1Bn1RgeiSc0nKsNTkaxQaYJyyOFfjJnJDqun+X2FYIxzQBKspWyKBjRYZn qLA9ma6JXewR4OR+icxH2Dbq/A78inl8+s0rTxu7gP20oapeMz6R5ZkijTrjybWV8mDLCjzUL EBDekinZo6eUHBS6RGHjAtXh0h5mDJ6BaWPIBuiDTr2iAAMkUf3mcAXwwLWLggKUf5zWJzuFQ BEzDhhnnoHNiCvGc7jkiDMBXH3aSJW+lLtm8aA== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Konstantin Khlebnikov This check effectively catches anon vma hierarchy inconsistence and some vma corruptions. It was effective for catching corner cases in anon vma reusing logic. For now this code seems stable so check could be hidden under CONFIG_DEBUG_VM and replaced with WARN because it's not so fatal. Signed-off-by: Konstantin Khlebnikov Suggested-by: Vasily Averin Acked-by: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit e4c5800a3991f0c6a766983535dfc10d51802cf6) Signed-off-by: Arnd Bergmann --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/mm/rmap.c b/mm/rmap.c index 488dda209431..cf733fab230f 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -408,7 +408,7 @@ void unlink_anon_vmas(struct vm_area_struct *vma) list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { struct anon_vma *anon_vma = avc->anon_vma; - BUG_ON(anon_vma->degree); + VM_WARN_ON(anon_vma->degree); put_anon_vma(anon_vma); list_del(&avc->same_vma);