Received: by 10.213.65.68 with SMTP id h4csp1769110imn; Mon, 19 Mar 2018 12:45:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELuNHveDEYfpgPkhRpMDJdRMypZcS4BxXaFxTeALQ+Jami1Nt8itixkV0CzWKPHOLf7F2KGt X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr6548299plp.142.1521488733842; Mon, 19 Mar 2018 12:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521488733; cv=none; d=google.com; s=arc-20160816; b=Dj9zUU6M/g9vGhYro2Yv17kQFj8c+lAcmvBIkmK+Vf2VLjkKwr1sC8J7SRqTXxtmMV 595MrfqjkH+YuKGnAkxu3JsYl+aCJn/HB8IiEpGSvBY+NOz706R3W6GTUmeLazHPqEPy uvA364lra3Gct6tnvkyNS2M9AnZ11IsEAzl5RTfLX/RX0HhAsmPxZWn/vfn9v6dcpalw Tut0ZBqm84HQ+20nkS0el37R47HnwJtLF2BQn4mvB8hn96ko46vUQSdgYZ3ml+wVAA9N 92Dd2HqiuSfAwyJUL+liRMnB7FWybxWZW4HHPSkFTF4x5K7WcEgM7nB7VbfJ2CGL5gQm tjdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ClribQ9HpJ4xyD4NKlH805/sCH4NzgF3l/7Xx63xebc=; b=iuEKsMGbofZMVAYs87w9DZSp1rUC/4S3avXiMKZtcjC6NN4u5CtZ9FkIwvvLUYMIco li1gy39JUGEPmklZwaqBx3xwKxenTrk8Lo1pctshmdafqVdRldumj06rQDnUIwBjnvbC VW56q3bgprDe8UejFRcvD12/aky8Rsp0OxbeDm/IqLbeek161zP7xnL2JeR9cRvFOWbO JQwt1gfj++jSGUtiih3jRldHNDAdLGIvPK9Fd6GKFgQEf+hI3Qnu+ImxjE/mJ+p7F1CG 1jHuPMBU/zYqkLzvwDy4PS8E46SeUZPzFlBvZm/RKXHzLRzKFWAV4B5nGU1jMMEwEYyA VKhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 n1si225316pgp.285.2018.03.19.12.45.19; Mon, 19 Mar 2018 12:45:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031078AbeCSSVQ (ORCPT + 99 others); Mon, 19 Mar 2018 14:21:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47982 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031048AbeCSSVJ (ORCPT ); Mon, 19 Mar 2018 14:21:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BBC701206; Mon, 19 Mar 2018 18:21:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fengguang Wu , "Kirill A. Shutemov" , Andrew Morton , "Aneesh Kumar K.V" , "Kirill A. Shutemov" , LKP , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , linux-mm@kvack.org, Ingo Molnar , Sasha Levin Subject: [PATCH 4.9 074/241] mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative() Date: Mon, 19 Mar 2018 19:05:39 +0100 Message-Id: <20180319180754.269544891@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Kirill A. Shutemov" [ Upstream commit 591a3d7c09fa08baff48ad86c2347dbd28a52753 ] 0day testing by Fengguang Wu triggered this crash while running Trinity: kernel BUG at include/linux/pagemap.h:151! ... CPU: 0 PID: 458 Comm: trinity-c0 Not tainted 4.11.0-rc2-00251-g2947ba0 #1 ... Call Trace: __get_user_pages_fast() get_user_pages_fast() get_futex_key() futex_requeue() do_futex() SyS_futex() do_syscall_64() entry_SYSCALL64_slow_path() It' VM_BUG_ON() due to false-negative in_atomic(). We call page_cache_get_speculative() with disabled local interrupts. It should be atomic enough. So let's check for disabled interrupts in the VM_BUG_ON() condition too, to resolve this. ( This got triggered by the conversion of the x86 GUP code to the generic GUP code. ) Reported-by: Fengguang Wu Signed-off-by: Kirill A. Shutemov Cc: Andrew Morton Cc: Aneesh Kumar K.V Cc: Kirill A. Shutemov Cc: LKP Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20170324114709.pcytvyb3d6ajux33@black.fi.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- include/linux/pagemap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -148,7 +148,7 @@ static inline int page_cache_get_specula #ifdef CONFIG_TINY_RCU # ifdef CONFIG_PREEMPT_COUNT - VM_BUG_ON(!in_atomic()); + VM_BUG_ON(!in_atomic() && !irqs_disabled()); # endif /* * Preempt must be disabled here - we rely on rcu_read_lock doing @@ -186,7 +186,7 @@ static inline int page_cache_add_specula #if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) # ifdef CONFIG_PREEMPT_COUNT - VM_BUG_ON(!in_atomic()); + VM_BUG_ON(!in_atomic() && !irqs_disabled()); # endif VM_BUG_ON_PAGE(page_count(page) == 0, page); page_ref_add(page, count);