From patchwork Sat May 12 14:59:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 10395931 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 908DC60390 for ; Sat, 12 May 2018 14:59:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7600428F35 for ; Sat, 12 May 2018 14:59:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AA8628F3D; Sat, 12 May 2018 14:59:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B009A28F35 for ; Sat, 12 May 2018 14:59:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750847AbeELO7v (ORCPT ); Sat, 12 May 2018 10:59:51 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:36375 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbeELO7u (ORCPT ); Sat, 12 May 2018 10:59:50 -0400 Received: by mail-oi0-f67.google.com with SMTP id v2-v6so7176749oif.3; Sat, 12 May 2018 07:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=rsSWkyLxSAvIXFpbfhCcWz2iDQhGQOzvAdnna616iWg=; b=hNUGyeoHsINdLgLPIOzMS944K1Rgq03qPVwxqdxIprLid5jbR9h1rfPmlLvKQsZxNT F1WXVGa7fNo5vEIkVqzFVkTKY/nlJigE5LNrD56gGvTCcVMeCVDeqRnH+oFfOPDxAAkT HuDvcCgOAIoQL9ClDHdrn/ORAr3O/bMf5sDzuguRKqQHsqpyeLW99wEmjuIfc9fzx3Gw n1zLcLo1nu2D0HztM06ZJAphdb6j3U4+l8wpm1ibL6Z9aUFwn3PoPtKDUBFb0jzfqK2h tCVS0k414WXbY/YOTyBWF09c5AUWXHAL3tJa5pr6al6/Gg93jws1jcQCm0ucCE7CkMLx 17nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=rsSWkyLxSAvIXFpbfhCcWz2iDQhGQOzvAdnna616iWg=; b=iN/50PDPTFwzPBv9t8ESwRh1ZJ/100Dhdag5dDG4YBBH+KnCTJKa1qXnWjjy2PrtND pgIwB+HeV40O70LaxBnYaFxlzogQGM0AVQ4nB/HuyXsz+zZueeXPoxFUXddTLFftsKM7 LXkgy1a9pnDAC4lN/MpaSqvkNtBWewHTU3EkREGabGLs7IPzVa4VrDvZI2sD4lIWcMhZ jnyUKQ+A+nw0lhrXhWdps9AP/LhTbNBwX8+RIz2UkSut+cxRB0dmdvPbs0VtcR2HNCNL M5l+8dpi21gcXxnA8AX8pkKLOdM1gJKwa1t5pdSWJ0wPcCkOb1Ft6y4tuodkZgqSBht+ Cspg== X-Gm-Message-State: ALKqPwckqiGUSbTyiJqR434aQqQzbHhLuV1P3hfSPuu49ZCOwkLvLN8f /oWucU7tvW+5slpidZQSbEc= X-Google-Smtp-Source: AB8JxZpx8Vb25GFuxZQ7qHUAwWa/CRFfm0Ho5+a8BEEg56jw6/7uyIAkwSM7erpwxR/DMaAt1ulw/w== X-Received: by 2002:aca:6a05:: with SMTP id f5-v6mr2065811oic.357.1526137189339; Sat, 12 May 2018 07:59:49 -0700 (PDT) Received: from Larrylap.localdomain (cpe-24-31-253-228.kc.res.rr.com. [24.31.253.228]) by smtp.gmail.com with ESMTPSA id v45-v6sm3597805otf.75.2018.05.12.07.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 May 2018 07:59:48 -0700 (PDT) From: Larry Finger To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Larry Finger , "Rafael J . Wysocki" , Len Brown , linux-acpi@vger.kernel.org Subject: [RFC] acpi: Declare memory allocations in acpi_ut_create_internal_object_dbg as non-leaks Date: Sat, 12 May 2018 09:59:38 -0500 Message-Id: <20180512145938.7936-1-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.16.3 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In kernel 4.17.0-rcX, kmemleak reports 9 leaks with tracebacks similat to the following: unreferenced object 0xffff880224a077e0 (size 72): comm "swapper/0", pid 1, jiffies 4294892358 (age 1022.636s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 0e 01 01 00 00 00 00 01 ................ 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000004f506615>] acpi_ut_create_internal_object_dbg+0x4d/0x10e [<000000006e7730e3>] acpi_ds_build_internal_object+0xed/0x1cd [<00000000272b7c73>] acpi_ds_build_internal_package_obj+0x245/0x3a2 [<000000000b64c50e>] acpi_ds_eval_data_object_operands+0x17b/0x21b [<00000000589647ac>] acpi_ds_exec_end_op+0x433/0x6c1 [<000000001d69bcbf>] acpi_ps_parse_loop+0x926/0x9be [<000000005d6fa97d>] acpi_ps_parse_aml+0x1a2/0x4af [<00000000c4bef823>] acpi_ps_execute_table+0xbb/0x119 [<00000000fd9632e4>] acpi_ns_execute_table+0x20c/0x260 [<00000000e6ae17ac>] acpi_ns_parse_table+0x7d/0x1b3 [<0000000008e1e148>] acpi_ns_load_table+0x8d/0x1c0 [<000000009fc8346f>] acpi_tb_load_namespace+0x176/0x278 [<0000000073f98b3b>] acpi_load_tables+0x6e/0xfd [<00000000d2ef13d2>] acpi_init+0x8c/0x340 [<000000007da19d8d>] do_one_initcall+0x46/0x1fa [<0000000024681a1d>] kernel_init_freeable+0x1a2/0x237 According to gdb, the offending code is object = acpi_ut_allocate_object_desc_dbg(module_name, line_number, component_id); As it is not possible to unload the acpi code to test that this is a real leak and not a false positive, and that only these 9 appear no matter how long the system is up, a kmemleak_not_leak(object) call is inserted. Cc: Rafael J. Wysocki Cc: Len Brown Cc: linux-acpi@vger.kernel.org Signed-off-by: Larry Finger --- drivers/acpi/acpica/utobject.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 5b78fe08d7d7..ae6d8cc18cec 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c @@ -8,6 +8,7 @@ *****************************************************************************/ #include +#include #include "accommon.h" #include "acnamesp.h" @@ -70,6 +71,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char if (!object) { return_PTR(NULL); } + kmemleak_not_leak(object); switch (type) { case ACPI_TYPE_REGION: