Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2951981imu; Mon, 19 Nov 2018 08:32:10 -0800 (PST) X-Google-Smtp-Source: AJdET5cHJ70Ms4jHWQ8FPznYIMvdleGwZ6uMvrstaDzD+GfFtTByBvl8GHC4DAgWTECLhLGySMMf X-Received: by 2002:aa7:8497:: with SMTP id u23mr19216830pfn.220.1542645130356; Mon, 19 Nov 2018 08:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645130; cv=none; d=google.com; s=arc-20160816; b=djRKCuwu6d3J+LPkWSUrbeODf6bO02cZ/bgOdEedtzTrqJEvXkURlePH3CYlY5RWTO O0X81jF+XB1typ9vf+bBPeXzXPbZ8X4Y9nfXMApUF5RV00j8N1dJn8yBlivnBGNcSfcd uJivYguJ7En+qfuMXNfSL3vvCaXL941tJ83GrWYJkAcWc5w4MzGR/+KwzCho2DbDrrOp 6MfmfEijO+P6ppbZqyQCBJ8oaSzUp0AYIR17FGqAU4/oW1cbUj9pcrs+cYC6YAegJ4qQ 4mIqsCPOUMdp9knNqn+TOs6jNYFqsGNt5fg61TiwtTavC3To/sD2XLIUlh+Bm+81EIgJ eatg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H9m/VBsfn8cV0InE01yrY3Yc/5Cz0zzQN88Oc61sQDU=; b=RVjZ5jqDlhZV72syVoM/EdJS0Vas9p6xc1Zn3/CdHTZn2Sk9mJ+7MGzsq2YRnNJNAt Uq85DYymb/MPeWOaUd7PzCeEAPF+l+FJjHYEW16Z5zP/s8e/xVlS99r4qS9AIVcYGUEA uJ4x4D84NzI23Wg/6CuityBJfzNr16zWyFcUZ4404qK3XsmSQCuGiW2ju4iBoM28DlIM XFzsr1FoSCJX9DE8oz9BgoBzfmvbledYyXQlvPWgMQ5NssLywIHsyqIoqiJ0B7FTf3r9 gB6zW1odl5dnFPLowHGmn6nySsNvIVHqvndb1Laf9adhC2APhdIuRLLR+CqC6ckp0kyn tvqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jNaOhJ/R"; 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 u23si39842833pgb.66.2018.11.19.08.31.54; Mon, 19 Nov 2018 08:32:10 -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=@kernel.org header.s=default header.b="jNaOhJ/R"; 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 S1730224AbeKTCy7 (ORCPT + 99 others); Mon, 19 Nov 2018 21:54:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:52428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730199AbeKTCy7 (ORCPT ); Mon, 19 Nov 2018 21:54:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B92AC20831; Mon, 19 Nov 2018 16:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645052; bh=ibH6A1vYJiM7pedXCdhIFIfNqVYhX8Wlub+ShC3C0ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jNaOhJ/Rs41JAypjvAc+HItLuj5aBMkq/GRHfWBqQe5w7/jihLZOLISt1d6bmmnDs EJUJV6ahJ0jS5U8Wyx345x5B5n4wQiasdO6uzhUnG6oCKWkjdxP0d2oICx4H9726NU Felvim0aUkvAMmVBSh8t3Lhbcbk/Z8zvYyzqzuiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 018/205] powerpc/mm: Dont report hugepage tables as memory leaks when using kmemleak Date: Mon, 19 Nov 2018 17:25:25 +0100 Message-Id: <20181119162620.535838148@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe Leroy [ Upstream commit 803d690e68f0c5230183f1a42c7d50a41d16e380 ] When a process allocates a hugepage, the following leak is reported by kmemleak. This is a false positive which is due to the pointer to the table being stored in the PGD as physical memory address and not virtual memory pointer. unreferenced object 0xc30f8200 (size 512): comm "mmap", pid 374, jiffies 4872494 (age 627.630s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [] huge_pte_alloc+0xdc/0x1f8 [<9e0df1e1>] hugetlb_fault+0x560/0x8f8 [<7938ec6c>] follow_hugetlb_page+0x14c/0x44c [] __get_user_pages+0x1c4/0x3dc [] __mm_populate+0xac/0x140 [<3215421e>] vm_mmap_pgoff+0xb4/0xb8 [] ksys_mmap_pgoff+0xcc/0x1fc [<4fcd760f>] ret_from_syscall+0x0/0x38 See commit a984506c542e2 ("powerpc/mm: Don't report PUDs as memory leaks when using kmemleak") for detailed explanation. To fix that, this patch tells kmemleak to ignore the allocated hugepage table. Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/mm/hugetlbpage.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,8 @@ static int __hugepte_alloc(struct mm_str for (i = i - 1 ; i >= 0; i--, hpdp--) *hpdp = __hugepd(0); kmem_cache_free(cachep, new); + } else { + kmemleak_ignore(new); } spin_unlock(ptl); return 0;