Received: by 10.213.65.68 with SMTP id h4csp1794616imn; Mon, 19 Mar 2018 13:27:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELspq1uyvVQt0/ylfTXat2bGysmRVMbtlzXtJVKF3b/Ov1NFCftGbYrynG+io4IDhBwihWUD X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr6657265plp.142.1521491272849; Mon, 19 Mar 2018 13:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521491272; cv=none; d=google.com; s=arc-20160816; b=POoRvqHmxJlHG4ULdpQ4YyftL72Uidnr0DwL2ih+o8RM3WuAlJfi0OYd5pgrocbxuZ cemWmK+eQMViKV0KrJl1FFQLzOJ1T3Ra8FTcuokKna4kyECcx0fGIzXjPQZRuCQezHMN bP/WS9anqUGnqaOfP4hS3hZT5RQBneY4PqT+Q7SKCekLL91etv1WDHd5yOQCoYr1sLXH gPkz6Ea6a5+pGX/2GdA3heO3r2emwcaLbjtuMclmqmtDI2lF0tAqCmcLLxhxlr9hqPaT ZC4JDg8SIGhxUvcWFALZaJCeuP60QtPOObl4pQ3D2qFGH85h15f+OBRe6IPyBEfBCzN4 GHow== 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=icx4Ovhar9CbCPaEa7Q3oVqzldNQIP4OTrqlbq3tMTs=; b=V7HRKTwt0Ws88kEmUh4FEt2mSyH69LfUTjlwkeQFDNL0L8jqUBZUvPNTiFKRs84s1J AOVTTRudGEtptGHAoJWmk5t4JYTu+YBARtUPUsfQY1SIv1sNIvJASieoIVyBIZWiuhcH UY/TsGzrmUVVFPGeSCdPrzsQAKRgBUaHM7gYD4U2Qz+a4N/lu2+XZgUE+zlTcDkqbDP/ C+Fizlqb85gyFs62a2zz8jfBtquCP+tf77+kGInOcisBi6VODw0P9YKr29Y5bkz0vOlL eLeNKtlKppVBKcGu7kDfwW8E7HIllkVprpuHIXzi4ZKGTCcnr5eFKfF5Fy7P2/ZXzKiu 4bQA== 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 b10-v6si44614pla.260.2018.03.19.13.27.38; Mon, 19 Mar 2018 13:27:52 -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 S1030596AbeCSSNx (ORCPT + 99 others); Mon, 19 Mar 2018 14:13:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43808 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968775AbeCSSNk (ORCPT ); Mon, 19 Mar 2018 14:13:40 -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 8A1F0E3D; Mon, 19 Mar 2018 18:13:39 +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.4 036/134] mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative() Date: Mon, 19 Mar 2018 19:05:19 +0100 Message-Id: <20180319171854.521145165@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@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.4-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 @@ -153,7 +153,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 @@ -191,7 +191,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); atomic_add(count, &page->_count);