Received: by 10.223.185.116 with SMTP id b49csp1089192wrg; Sat, 3 Mar 2018 15:15:35 -0800 (PST) X-Google-Smtp-Source: AG47ELsd+bL3l94QTt9EfHFOs6iMijJfoDFWIT5XGqkBi4XPPzc/Gx9D6XDd/E64g7M7Tt9Z4XhR X-Received: by 10.101.93.138 with SMTP id f10mr8161204pgt.255.1520118935602; Sat, 03 Mar 2018 15:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520118935; cv=none; d=google.com; s=arc-20160816; b=UetrzWtpG19n7jxkRIjJF7Oso5v3xmSTHnl6iTHUYniI0bq25UPaHoL6sGcUTWOkt+ UjMiFVNs9OFwrUMK13YjlgeldhEozcgVXPmlc16RCtij8d8JSCuB6oICaPrHkvaCI3gA xIn80rKI6qumdrtwnLN6d0KA0gmSYYnIRb5IHvxoPzV4dDN8tvR9hN+DK6x/ce72wLzW aJbXE7SaLCoP69tmT4uDVwd5v+xQtbw2wuOhbeieqqYjzLLp5mMHq5YKT4a7tdX8lDkt 4cJc6OQ7mo6I0Y/g1QUT/n347A0uZQDcZNhWgqkstvexJvIJ+dyZQTnj65q4C5K57IZi EVHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=BOZptcs/i+Y6+HtURs84KvyCGAebIb99MWLekZ3oRdk=; b=z5CWKakstiovrJ8lGTuYW6PjPrAhgYvVAQcpZQM8U2NxlhvXmJsSS9ohnkE8zURDjG lxXEJJnjZkQ4uBTJKSZS48Tfto8dDTp8eXiQ2o1pySSXi6o8zP16NL/w8bb1a9+dVRO2 M4gsDMbbIRJ4uK1aCd2IOQhC3Z2uKbKEeRP7nV8lPeIQis+xklipES4zt6RW6Xj258ZL aTEobC8ZE5FP1QQASY8iwQCZOnWFvUxo6qWkMIqnpH0a0b3bJPqQ8FWR/HbDdBIhwndI rfok5AVF5FIQPsip02idweyGI9le8T/mkWUB0wNNplkYbZTjRyJUKfSrdRKhvpIEKffq pQEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=W8HWbm/S; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62si7435252pfl.160.2018.03.03.15.15.21; Sat, 03 Mar 2018 15:15:35 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=W8HWbm/S; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbeCCXOW (ORCPT + 99 others); Sat, 3 Mar 2018 18:14:22 -0500 Received: from mail-by2nam01on0114.outbound.protection.outlook.com ([104.47.34.114]:65056 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935003AbeCCWjH (ORCPT ); Sat, 3 Mar 2018 17:39:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BOZptcs/i+Y6+HtURs84KvyCGAebIb99MWLekZ3oRdk=; b=W8HWbm/Sqr45zvY8pK7qI7fx7hAF8OK0INWPKJHhMfj//LL8GmV/yAjz85LbLAxr+pM3dmRtB9PMPjtRdZmImnFvnZfx0YLdTJUgS8fFHulxRDDKGwumKfI8SOq0YBaE5aOCLiUYxW7oY9DYQr8U2V1+3d07c3tCx9Qd1HGkQTg= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB0938.namprd21.prod.outlook.com (52.132.146.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:39:04 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:39:04 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "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 AUTOSEL for 4.4 037/115] mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative() Thread-Topic: [PATCH AUTOSEL for 4.4 037/115] mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative() Thread-Index: AQHTsz9UcSPKaxf+IEeb+vazptba8Q== Date: Sat, 3 Mar 2018 22:31:10 +0000 Message-ID: <20180303223010.27106-37-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB0938;7:HFtGqMuIq/neb4CKwuRb70OJKfFs9WodpLe5939V0YsNWfp6jUo3b3vNHw9aQ7he0Myla4QVYgyZvzoC2ibMzYmFKRWnvT6vsOC3ZCV9scsBWWPbh9lZZK+OzLrG1FuvrMHYri5kpYYJlKC/K/lm/UjOVLy+tV38xCXxNaL673mLhFuahfxmvLgISKvvXJOpaz1yW/V73zWRE4BkpiOx0TEQHfdpwm/SNDWsrvuEsNWj0ufFlCNOql49yap9xRLa x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 4d58501b-216b-437c-60c7-08d58157913a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB0938; x-ms-traffictypediagnostic: MW2PR2101MB0938: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(42068640409301)(104084551191319)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231220)(944501244)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB0938;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB0938; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(366004)(396003)(346002)(376002)(199004)(189003)(54906003)(4326008)(72206003)(22452003)(478600001)(25786009)(66066001)(966005)(6436002)(6512007)(14454004)(6306002)(53936002)(2906002)(6486002)(105586002)(99286004)(10290500003)(3846002)(106356001)(6116002)(305945005)(5660300001)(7416002)(110136005)(1076002)(36756003)(316002)(2900100001)(2501003)(5250100002)(10090500001)(59450400001)(102836004)(68736007)(2950100002)(26005)(97736004)(186003)(6506007)(8676002)(107886003)(3660700001)(6666003)(7736002)(86362001)(81166006)(86612001)(81156014)(76176011)(8936002)(3280700002)(22906009)(142933001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB0938;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: m+KbNfXhCxkQqkOYkPzYiuT6iPTIGacOJehLZQugNlKE6pw5u6+5tzhLLDyRLnzc7qK3uVwLFC9ez7CT3IovxBVc4UNzDtRpO4WURnXzpxjXOmC3jK+ITJGbPz7KunkzaXfSoS1k8qWS5GMnsO4FOJmGwckM3Y0tFXhUcRd5L0U= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d58501b-216b-437c-60c7-08d58157913a X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:10.5415 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB0938 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.int= el.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- include/linux/pagemap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index fbfadba81c5a..771774e13f10 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -153,7 +153,7 @@ static inline int page_cache_get_speculative(struct pag= e *page) =20 #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_speculative(struct pag= e *page, int count) =20 #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) =3D=3D 0, page); atomic_add(count, &page->_count); --=20 2.14.1