Received: by 10.223.185.116 with SMTP id b49csp1110617wrg; Sat, 3 Mar 2018 15:53:18 -0800 (PST) X-Google-Smtp-Source: AG47ELuXN9iACMDtPR6s/30DGgKRILKoxM/k1t3mjiyytngOsRvU1LUHLQmdMjx10iyZ+F8q2+kj X-Received: by 2002:a17:902:2845:: with SMTP id e63-v6mr8950333plb.389.1520121198235; Sat, 03 Mar 2018 15:53:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520121198; cv=none; d=google.com; s=arc-20160816; b=wbz0Nat7uQ8T7R0vNxjcq9WThNA0M0YzNUfJIzmoDyfl46wQRK50LPG5WyzL/SJ5nc CxCzsrbWolBBZlW4BxvVCP5OIUY6mfkCbI86yy9bN3O3d1cb9anOs45Pu7oXls78ZPp/ 6gF8iNkk4DPThk5G9QGQaMtflyYxVvxrvaKylli8HYOE1F64C0vr9VMmPIrELbQBJmpz G+Kp6VYKvUqZFCiAjS+sBf5A7LFtJXRw0kFm2qdtp1WbiTeynqiAoySX5o6BugGqUgv2 Fn+FTvefhNK9eHODqd4yBcDIYLlx8MJxPJS8+bV2QnRtPdPJxdFvK9VlYNEOMXa1e8aM 5RTQ== 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=DBMdqybNymyZsuIrueuWQ/dn3uJ8kUUqk6pHyC1IAkw=; b=UHF/1v0Lwopywj13gnqanhOpVBr8O/bb+GDf/5T9WsdkDdI1QxSzdC0ryqdqLRRXgZ 2BeZ5wbyd5B/Q7UcOR7pZgdfXj8ZeD5ycnUbiHPC66iGqmO24U4+NJWtcBhAmzI9HUy/ XAjhnpPhPEIUrchxHC5uhicQYnmJ0VKXJnsAXgLEvbS7EnQPMlAGP4qMRYy1DCI5Tk8/ WM2kYhChWMRrTCFgRSRqSovuIA1ZieyFU1V1veo+CL5uuBZSc19P+4A8//PiH0UO8/+v diu5byPXC0XGlwuCw2ELbhyQNEzukoqMAOts6USkFtBNJUVMT2mPwVneO/nhx0toqx7N G4Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=TJ3D/+0H; 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 c23-v6si389044pli.306.2018.03.03.15.53.04; Sat, 03 Mar 2018 15:53:18 -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=TJ3D/+0H; 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 S934022AbeCCXwH (ORCPT + 99 others); Sat, 3 Mar 2018 18:52:07 -0500 Received: from mail-by2nam01on0133.outbound.protection.outlook.com ([104.47.34.133]:49841 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932735AbeCCWdH (ORCPT ); Sat, 3 Mar 2018 17:33: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=DBMdqybNymyZsuIrueuWQ/dn3uJ8kUUqk6pHyC1IAkw=; b=TJ3D/+0HUtwX/sVMK8iqPttP4+CuZbsHIpqV5ItZ+0+L2bYfthAXTN2mCco5uXa9o14eRMSE/73DWicCz9nrMAL0dKpUloHPhlKLEqdSIvuF2OFCV6P6uo2KE0OY/9MomEjS0hYi4HPEN+aLnDgEFy77nj3HNw2edqtGJg8304k= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1097.namprd21.prod.outlook.com (52.132.149.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Sat, 3 Mar 2018 22:33:00 +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:33:00 +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.9 077/219] mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative() Thread-Topic: [PATCH AUTOSEL for 4.9 077/219] mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative() Thread-Index: AQHTsz770tUXyovYak6V2K2bGhateA== Date: Sat, 3 Mar 2018 22:28:40 +0000 Message-ID: <20180303222716.26640-77-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-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;MW2PR2101MB1097;7:2KcdX/Weevd6puu4+1LJzi/YNriEngos9remfSC1amvdz/60jJ4hAAn+lBCIJGkn+2A2a5sIuWb66NbqbGZ+DdlkV1KB1GEZWl483HHGp8urncXVFq61DcOesKOjrQLQ9BjSvNE3nuPpfEZ7ZBe+9q/ZLJCCjU+abA7b8Gej7oNqu6XogICrn3WPL1arfaZF37IZhrCybIYgoykXjV6zQGDxbWPo50sbGuL4G38vbbQruizYpIYzhOOJ42xhpetU x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a787fefa-1fd6-45bd-b444-08d58156b896 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1097; x-ms-traffictypediagnostic: MW2PR2101MB1097: 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)(10201501046)(3002001)(3231220)(944501244)(52105095)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:MW2PR2101MB1097;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1097; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(39380400002)(396003)(39860400002)(346002)(189003)(199004)(305945005)(105586002)(36756003)(3660700001)(86362001)(6666003)(66066001)(2900100001)(5660300001)(7416002)(8676002)(10090500001)(81166006)(81156014)(8936002)(22452003)(10290500003)(2950100002)(4326008)(25786009)(5250100002)(2501003)(68736007)(7736002)(72206003)(14454004)(966005)(478600001)(186003)(110136005)(26005)(316002)(2906002)(6306002)(97736004)(6512007)(99286004)(107886003)(54906003)(1076002)(6506007)(106356001)(53936002)(59450400001)(6116002)(3846002)(102836004)(6486002)(86612001)(3280700002)(6436002)(76176011)(22906009)(142933001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1097;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: R/DY50UV7dtP3rW9ByjbQAWBKcuo76pzG4KHc19AiOrj4iKp8Y9Rym8jEgB9cFyNLkJp7inBgGMI6mG/Bb8ZMHjf5eH28FZChIFvjAjEWoHOYh5VVC2JuDFDuO9Ykey5nvjgnnN/tv+3plKr9VgKH8etjIdtFX4X/Pgrh3AzXmI= 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: a787fefa-1fd6-45bd-b444-08d58156b896 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:40.7756 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1097 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 7dbe9148b2f8..35f4c4d9c405 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -148,7 +148,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 @@ -186,7 +186,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); page_ref_add(page, count); --=20 2.14.1