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 ECFAFC43334 for ; Fri, 24 Jun 2022 08:28:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5591B8E01FF; Fri, 24 Jun 2022 04:28:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E2DC8E01F6; Fri, 24 Jun 2022 04:28:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35A028E01FF; Fri, 24 Jun 2022 04:28:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1F3A78E01F6 for ; Fri, 24 Jun 2022 04:28:46 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DD86D20B00 for ; Fri, 24 Jun 2022 08:28:45 +0000 (UTC) X-FDA: 79612453410.29.7F10355 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf24.hostedemail.com (Postfix) with ESMTP id 7340E180035 for ; Fri, 24 Jun 2022 08:28:45 +0000 (UTC) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-3178acf2a92so17685037b3.6 for ; Fri, 24 Jun 2022 01:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=juJPwPR296pSJZwsH9/Iy+TMiLjsg5L/e3X7qop/D3w=; b=Yen0y2jHteguKUwEE6qaiTm+lhM9bjOuVD5af9lqIfB669iZhRqRU+TC8W6kj0hI3M YG3d6JOmMQ5+s1J+K+s4D6C8jualhWVv70vHc3EkNIE2cpKal4D48l0vJAiqwcX0p2CG F9tUhwi2kPg0X5cHoKyCGOO5FHxcxGuBLhgT0QoAI2A/xvHiRMrTQNktW6/o3SyyOGSK pe7IfdAY1PfZmHSU+A1FKLxfXQUSfCB1OwSiEcWDkbmxneFZUS5YCvsT9jJQ2M4ERlt8 kPX6xhEblEjJUoujRI3ab/ZUqtI7zEGzWjZOQNFJU6vWPcfzfjwowpBy4gWsCdzgdpcr dpQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=juJPwPR296pSJZwsH9/Iy+TMiLjsg5L/e3X7qop/D3w=; b=mxeirhwA2jjv1bMzBoPXoZPHOClNb7afz1uuGBe1Qm6nJf+YTSgu0Aq1MC6sy07JB9 0sDsrubT7mDfGc/EO+WWwD6yjZwm/CdABGInwPbA0nOHHGd2LEL7+vZyUmeJA3y4QWyL KYaRW4THAhAjQHq3zHiKmhZq10DpNYy6bE5yIl9ciFrTtlFBDSy3txt+J7xVHVTp9PSc s3IY6G9dVkbwjcsPYB5HhPanPRURr7f2sno6YhpMglakRqnULJAkpn1VUGQD6Uv4I3ZH KfQYiedqVVkFJO0UWB7HF8pABYAiEYqbB4KgSVRly9KcvPKOdqFVUkA3IAUo5ERLg79E 8B5w== X-Gm-Message-State: AJIora938E4d/xwT90F06rjE0ueKSYTkFv6G43Dqz1FlvYA7L1kvCJPf WGTIZqSwyXtIXdCLVJNcFgQCT6UVsFH+CcqwwQXAmA== X-Google-Smtp-Source: AGRyM1vpXuHX/b68bS4ayavud0a5eakM5MhbMfcsLJodMJUZ4whj1SvXh17eHSaMDiWAQlCGApLgvLq0yCqBlwuOVj0= X-Received: by 2002:a81:3a12:0:b0:314:6097:b801 with SMTP id h18-20020a813a12000000b003146097b801mr15576175ywa.512.1656059324577; Fri, 24 Jun 2022 01:28:44 -0700 (PDT) MIME-Version: 1.0 References: <20220623111937.6491-1-yee.lee@mediatek.com> <20220623111937.6491-2-yee.lee@mediatek.com> In-Reply-To: From: Marco Elver Date: Fri, 24 Jun 2022 10:28:08 +0200 Message-ID: Subject: Re: [PATCH 1/1] mm: kfence: skip kmemleak alloc in kfence_pool To: Yee Lee Cc: linux-kernel@vger.kernel.org, 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" Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656059325; a=rsa-sha256; cv=none; b=TeLmVE67TJoXwFSSgdAKparDi6snRN9Qdjp0IpKZlaFZwV/bR2AQ9qgZUHTTVCcuLmGs4k +17PdozTsQxSV3SPa0vQIXIPJGf6Ye/A11KiZYhv9gXKLCgsgAsF0Jr7MM/Xf7YM48UrBp H6jDaVUR09eWK97v5VKokN4Ez1pG3r8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656059325; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=juJPwPR296pSJZwsH9/Iy+TMiLjsg5L/e3X7qop/D3w=; b=ZsrNExWEOmfqIQo5VD0On3sPBlHW00w50Wu8ickmvXC2h2eULoDXvE4sUmUUXYHdKej28f geOKoXDvAYmkbExbOBKY34mk5PFLKYx62viPLnvfHji8v2CCdCIJjouOOtFr0qx0I7jjDu uYvgBxTqxqgqiJQWcRoMVn00LLRWy24= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Yen0y2jH; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of elver@google.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=elver@google.com X-Stat-Signature: sewiadesdo6buwpkxstqg76pe4p6enjg X-Rspamd-Queue-Id: 7340E180035 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Yen0y2jH; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of elver@google.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=elver@google.com X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1656059325-434060 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 24 Jun 2022 at 10:20, 'Yee Lee' via kasan-dev wrote: > > 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?) No, if KFENCE is initialized through kfence_init_late() -> kfence_init_pool_late() -> kfence_init_pool().