Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1291560rwl; Wed, 12 Apr 2023 10:35:42 -0700 (PDT) X-Google-Smtp-Source: AKy350ZeL5Sd3uyO7QBKlLaOrHE42ko85RqXvqxt0KiBUN4TjtY7OA7cX75uuuzrTWBO/1MqEkhD X-Received: by 2002:a17:902:e890:b0:1a1:ce05:9ba with SMTP id w16-20020a170902e89000b001a1ce0509bamr3979134plg.52.1681320942574; Wed, 12 Apr 2023 10:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681320942; cv=none; d=google.com; s=arc-20160816; b=tWXpWB61RN+pH/U7AYYnlnmVN2z+EmrQEoceYqjPSOQxYre5VeGKDONDW/vQaYmjVs jsSLU2F59E28K7Q2NuqPt2lIwPkrWMKFiBI+UpVVXsbnF5AcbzGmTb5iltlePgyExdTL Z06sz7i9xGz4eRdzgIXbc/2qj7APNKx3YKVZwKsxKLv2Fw5WkTQWoWFuSV4JJY2EwrAe LmpUJmeFMf5j+8rIfJGSF/XfNg4LvFyt+2U6NpARZAiyWBEHO+qCK/g3bNb9oYRPfki2 1/aGN3CHruw+J3n6LRu5vjm5o2WwEJE0iJEJycRigMhc27fKrgCKy/rBZU1A56kCLeSc 8org== 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=Lbmzl8WwCNrN7uG9flDV5yRrY/zAN3aalt3cwUBNWBM=; b=DG4UHfx8GGeMQnBrKxR5Jyle/Pq5gqHSfOwkD16NVVHpmmICbQZz3YfK4AkP+fZiv/ hY40oHNHYooWRxJUz9yNVQgNm309HUTXCvS+S9uhraIGlK/DVQ98Ttl9t7Oeso7OEoUA tfTPWgpODH8rWwL+068wzXcAAAaMRGtNPgI/H6p6JRKdQzIieVBY2WplVbvinFjg3iYw ikA7GXNebKccItlc7uB5RIKVYB3fGWnNaGj2Y13eMy01BK7dBlLtNksu2UTjpI+0epgX eJ6wSks3TmZtkblNk3M2MP63hXzmhfO6r+qb2L5AM3+kPN4ke/9d4fQAWNs7wecK6uAB 1XpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=CfrlPENu; 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 e8-20020a170902cf4800b0019b354d0268si14954524plg.280.2023.04.12.10.35.29; Wed, 12 Apr 2023 10:35:42 -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=CfrlPENu; 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 S229963AbjDLRWJ (ORCPT + 99 others); Wed, 12 Apr 2023 13:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbjDLRWI (ORCPT ); Wed, 12 Apr 2023 13:22:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97339F1; Wed, 12 Apr 2023 10:22:07 -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=Lbmzl8WwCNrN7uG9flDV5yRrY/zAN3aalt3cwUBNWBM=; b=CfrlPENuAAV1fSULGrJfIpn2qn jnw65aeYwQRUbNMV0AIxfU958d+zgR1+DL+vbpup86UDO8ISkLwTwXg3wZOaXJ99hUH0EN9CdIY/R uMqyiHYR3q41F1XjkGW4eiMdvtG5Yy4UIim4n43oNsU6U9aj4xav/9gtLgJoEB3GCUqjteojZZ1Ka n7fk4aqJu316YEFbAEQKTmzNy+U5rOncxLvzE2MGyn7ubAu7jpG3fKoKYKecgDqHLjNmjhLZOuERM wTuaWMlRBcSyUTy8LeAWY2EOulzwhxyWUlPpTAGqDHPG1TTm5p9F3gPd18pwiz0Rc48aTuNsug0rz bDKrFEdg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pmeAX-003xWz-2m; Wed, 12 Apr 2023 17:22:05 +0000 Date: Wed, 12 Apr 2023 10:22:05 -0700 From: Luis Chamberlain To: Catalin Marinas Cc: Song Liu , 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=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham 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 Wed, Apr 12, 2023 at 10:53:36AM +0100, Catalin Marinas wrote: > On Tue, Apr 11, 2023 at 04:00:59PM -0700, Luis Chamberlain wrote: > > On Tue, Apr 11, 2023 at 10:07:53AM -0700, Luis Chamberlain wrote: > > > On Tue, Apr 11, 2023 at 04:10:24PM +0100, Catalin Marinas wrote: > > > > On Mon, Apr 03, 2023 at 01:43:58PM -0700, Luis Chamberlain wrote: > > > > > 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: > > > > > > > > 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. > > > > > > > > It's safe to use the 'grey' colour in all cases. For text sections that > > > > don't need scanning, there's a slight chance of increasing the false > > > > negatives, > > > > > > It turns out that there are *tons* of false positives today, unless > > > these are real leaks. > > > > I should clarify: *if* we leave things as-is, we seem to get tons of > > false positives. > > Which makes sense if kmemleak_ignore() is used, such objects would not > be scanned. I'd just replace it with kmemleak_not_leak() irrespective of > the type. OK I'll do that and add a Suggested-by you :) Luis