Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5073675rwl; Mon, 3 Apr 2023 14:02:49 -0700 (PDT) X-Google-Smtp-Source: AKy350YKn+amlylR7dfYkxNeiBmgej8URrXGLwBWjRtJxGzsIZdvpmhCOrCEuk8Z0h/LhN2Qgnap X-Received: by 2002:a05:6a20:4d92:b0:db:81b:94be with SMTP id gj18-20020a056a204d9200b000db081b94bemr21420pzb.49.1680555769685; Mon, 03 Apr 2023 14:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680555769; cv=none; d=google.com; s=arc-20160816; b=wLYnKZK1WQT6Pjm+4MxVOfJjIhB+BrkvUIVLNjW3xjDzNacIPjYls0puxwT0ubqTG+ a5zkGVz3oGQTc4km/dTjG/iRhirt/dKoSgExHZzNJphCocuRNY6vGVdWSRP/gLuQFKKi GNlMZ97UzkqLkFI9MVKRGF5dN726UlkAxPsH+6f7L4yfnMY3+C+KFc3YPZruIpv5NXZJ SzaNk6lC3c9eaIx/QqGehwouFgfpdrlkPqbPUIFHGYkCcjYbFhKwYEA89DWWnvvO94Fk ytDhYoGcNrJGzSiyQ3nLDF6ZGXiTfhdzrz6aLfiB0fBedE6Or5Q4zWuSbjjXza1vTruk 0wmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6qyEuD0xFDbKlhpCP+K3Vg2WfeKEXiheWnpkOWpngBk=; b=WxobVODnNObzIfreA9aTtDkRe6PdcySaxSlJhMQLZvCZMEpD8vOmaV+ecc0TPCbb6F 7Jylzq5Y8zc+LakCwMDFDB864rgwiTjUMBbH1J+GYXx+afrdUpwx4hqlwIshNQubvDyd ofS0s/+QEHdNBM3q88KpRIIBjIh+BSQGtAQJd5YSDp4L+fQXI52EEQCRPkiqCgKfyq/4 Z8sZS40jv0y1ypAkUD3usY0jMZBgEQW7S/rgzpIQMUPA1chIpY1Gh7Mn+meZykUViYR8 xFj6kCEBOTiUqvn+p+sU5bHOnpw9EyWP3SKhcitbcGLUmLCqY/MxvfL+usGHxmHUslpB DARg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Kvanm6zH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020aa79d06000000b0062e14211e54si2816854pfp.240.2023.04.03.14.02.36; Mon, 03 Apr 2023 14:02:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Kvanm6zH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233481AbjDCUoC (ORCPT + 99 others); Mon, 3 Apr 2023 16:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232647AbjDCUoB (ORCPT ); Mon, 3 Apr 2023 16:44:01 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D731E7D; Mon, 3 Apr 2023 13:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=6qyEuD0xFDbKlhpCP+K3Vg2WfeKEXiheWnpkOWpngBk=; b=Kvanm6zHyoXgdkODNgNvtnkB0K D2Oh+XMoXo8xXJbCd1qw1hUewBUB63RSeXzSu39wdWk4u0RJmCbEn524AokJY5kQ/sLm4HJV2nQPY yajOmmKKbIaYCH08L72k7V17JeXV5xSvDL1L6udlr/Pc0UJtmnFcmaO6lTTtEDyftgXm2865uiWK/ eIUlwO4GWoPEBbn+PSh4thN08EMfX2sSI9dSqc+HNFOSwjVvoxAc+To0TnYYabzHaCAiurvHkkRSi 8/VV2yguC4ngkJERZI+gJQqRAyxgJrRn0flgFGWV25nJl+CFDffm0QvJDebcU0YwcmE5ZIvwCWX/w jeUL+1Nw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pjR1y-00GiMj-24; Mon, 03 Apr 2023 20:43:58 +0000 Date: Mon, 3 Apr 2023 13:43:58 -0700 From: Luis Chamberlain To: Song Liu , Catalin Marinas Cc: jim.cromie@gmail.com, linux-modules@vger.kernel.org, LKML , Jason Baron , Greg KH Subject: Re: kmemleaks on ac3b43283923 ("module: replace module_layout with module_memory") Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 31, 2023 at 05:27:04PM -0700, Song Liu wrote: > On Fri, Mar 31, 2023 at 12:00 AM Luis Chamberlain wrote: > > > > On Thu, Mar 30, 2023 at 04:45:43PM -0600, jim.cromie@gmail.com wrote: > > > hi Luis, etal > > > > > > kmemleak is reporting 19 leaks during boot > > > > > > because the hexdumps appeared to have module-names, > > > and Ive been hacking nearby, and see the same names > > > every time I boot my test-vm, I needed a clearer picture > > > Jason corroborated and bisected. > > > > > > the 19 leaks split into 2 groups, > > > 9 with names of builtin modules in the hexdump, > > > all with the same backtrace > > > 9 without module-names (with a shared backtrace) > > > +1 wo name-ish and a separate backtrace > > > > Song, please take a look. > > I will look into this next week. I'm thinking this may be it, at least this gets us to what we used to do as per original Catalinas' 4f2294b6dc88d ("kmemleak: Add modules support") and right before Song's patch. diff --git a/kernel/module/main.c b/kernel/module/main.c index 6b6da80f363f..3b9c71fa6096 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2240,7 +2240,10 @@ static int move_module(struct module *mod, struct load_info *info) * which is inside the block. Just mark it as not being a * leak. */ - kmemleak_ignore(ptr); + if (type == MOD_INIT_TEXT) + kmemleak_ignore(ptr); + else + kmemleak_not_leak(ptr); if (!ptr) { t = type; goto out_enomem; We used to use the grey area for the TEXT but the original commit doesn't explain too well why we grey out init but not the others. Ie why kmemleak_ignore() on init and kmemleak_not_leak() on the others. Catalinas, any thoughts / suggestions? Should we just stick to kmemleak_not_leak() for both now? Luis