From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEC1C433EF for ; Fri, 24 Jun 2022 08:30:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13B558E0200; Fri, 24 Jun 2022 04:30:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E9658E01F6; Fri, 24 Jun 2022 04:30:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1C0D8E0200; Fri, 24 Jun 2022 04:30:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E26CD8E01F6 for ; Fri, 24 Jun 2022 04:30:22 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id BD1B080AF0 for ; Fri, 24 Jun 2022 08:30:22 +0000 (UTC) X-FDA: 79612457484.22.AA4D057 Received: from mailgw01.mediatek.com (mailgw01.mediatek.com [216.200.240.184]) by imf06.hostedemail.com (Postfix) with ESMTP id CE57B180012 for ; Fri, 24 Jun 2022 08:30:18 +0000 (UTC) X-UUID: 368aabeac5a84446bfb2843bbfde6f29-20220624 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.6,REQID:85889f6a-d1ce-4ae5-9e4b-5d763c3bf50b,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:b14ad71,CLOUDID:c9206aea-f7af-4e69-92ee-0fd74a0c286c,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:nil,BEC:nil,COL:0 X-UUID: 368aabeac5a84446bfb2843bbfde6f29-20220624 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1155874340; Fri, 24 Jun 2022 01:30:09 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 24 Jun 2022 01:20:21 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 24 Jun 2022 16:20:20 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Fri, 24 Jun 2022 16:20:20 +0800 Message-ID: Subject: Re: [PATCH 1/1] mm: kfence: skip kmemleak alloc in kfence_pool From: Yee Lee To: Marco Elver CC: , Alexander Potapenko , Dmitry Vyukov , Andrew Morton , Matthias Brugger , "open list:KFENCE" , "open list:MEMORY MANAGEMENT" , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" Date: Fri, 24 Jun 2022 16:20:20 +0800 In-Reply-To: References: <20220623111937.6491-1-yee.lee@mediatek.com> <20220623111937.6491-2-yee.lee@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656059422; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j6K6WxpqWr5yM3SzDPZ6o5KXpJQczgte2Sli127Axro=; b=m85HJWSAL+KViu1vVMbF/TGTmIv0lRhyLLkRDbvgu6RUsdpvseTKiUaoctnvjA1JD1Tjk7 l1TBv/geWNwUKpAMNkMdvaDbrW2KrOl6hp3idYu2ok0RhqWXYM+1PtUx6D8BUBI+PLaSQA a0F0XdS/EUo2UY06yfv/rex4SQcYyVQ= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf06.hostedemail.com: domain of yee.lee@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=yee.lee@mediatek.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656059422; a=rsa-sha256; cv=none; b=LLEhd1vmoHVy9rdzxo56wdLedHTjn2DAJbI40YtH2j7x2qmeOosZuCwFDh772/qC2MXg/r vjeemLTECiHM76uqrh32/peYLiUEtswVhXABmUO5v7EyXnUAUYhfoWmlNwuJIwDqntMWqt IJaO8VdiUC80hopKldLiijdfaJYYxfE= X-Rspamd-Queue-Id: CE57B180012 Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf06.hostedemail.com: domain of yee.lee@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=yee.lee@mediatek.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: srzmfpffot9ccfpjroh8mko4w8hktccy X-HE-Tag: 1656059418-657598 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000034, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 2022-06-23 at 13:59 +0200, Marco Elver wrote: > On Thu, 23 Jun 2022 at 13:20, yee.lee via kasan-dev > wrote: > > > > From: Yee Lee > > > > Use MEMBLOCK_ALLOC_NOLEAKTRACE to skip kmemleak registration when > > the kfence pool is allocated from memblock. And the kmemleak_free > > later can be removed too. > > Is this purely meant to be a cleanup and non-functional change? > > > Signed-off-by: Yee Lee > > > > --- > > mm/kfence/core.c | 18 ++++++++---------- > > 1 file changed, 8 insertions(+), 10 deletions(-) > > > > diff --git a/mm/kfence/core.c b/mm/kfence/core.c > > index 4e7cd4c8e687..0d33d83f5244 100644 > > --- a/mm/kfence/core.c > > +++ b/mm/kfence/core.c > > @@ -600,14 +600,6 @@ static unsigned long kfence_init_pool(void) > > addr += 2 * PAGE_SIZE; > > } > > > > - /* > > - * The pool is live and will never be deallocated from this > > point on. > > - * Remove the pool object from the kmemleak object tree, as > > it would > > - * otherwise overlap with allocations returned by > > kfence_alloc(), which > > - * are registered with kmemleak through the slab post-alloc > > hook. > > - */ > > - kmemleak_free(__kfence_pool); > > This appears to only be a non-functional change if the pool is > allocated early. If the pool is allocated late using page-alloc, then > there'll not be a kmemleak_free() on that memory and we'll have the > same problem. Do you mean the kzalloc(slab_is_available) in memblock_allc()? That implies that MEMBLOCK_ALLOC_NOLEAKTRACE has no guarantee skipping kmemleak_alloc from this. (Maybe add it?) If so, we cannot identify later the block is stored in the phys tree(memblock) or the virt tree(page_alloc).