Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp212485iog; Fri, 24 Jun 2022 02:33:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sMP65tzUSjyxYAIXzsA/3EfY3LBXd/K6ebdsekYNtbuIPbcbIu5DIxPXhWvsdMVuGgTWjv X-Received: by 2002:a05:6402:2419:b0:435:1e2a:19ce with SMTP id t25-20020a056402241900b004351e2a19cemr16275444eda.370.1656063187383; Fri, 24 Jun 2022 02:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656063187; cv=none; d=google.com; s=arc-20160816; b=VD7csU+HPz+OPGmaBVy8GhFJHNrUYH8zZQRxUP/hcXOTH9rMGLD7VT7Hp+oa2cFPBT ipOSwDIFaHM/SjBns8/fG24YIRn+VscN60Tc0xn3LP3hacJuYD5ushqYj2i6Aw7Ud2a3 cJiiOtOYg/IY8iFFzZt0DY+yPZKFxkLUI4R+GwpXopewvaAVnE71YeRvKlaZQNUdPDfX jiHCjBn7MPjjVxeHeEDK7nmfuw/l+8Byku7nSCard1qSUdIKvjTUW9j4TLPrD80JSYfS LzstuO7osxIDi11dWnvgfPn0Fgo2DuAjEKnGN0CjmFtx4QhCYIKPYTPQlJXXFOdxU3m7 IKxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=juJPwPR296pSJZwsH9/Iy+TMiLjsg5L/e3X7qop/D3w=; b=trPUvTHPDnbYXrAX8hbxO5XqE2+RPYkmTzbxHRq4gozfDVFMEJed6aFqO+TJ6wiVhQ QJD4AbKokVq/5/wBYmiKRwMehufpBLcaPsS3/n0WPqXv6csXhoW2r2jt9+nraoRkfkMn 5X5by+DjQ6ZoSlNZ4PfCiBZLXsPFUuVZS32QHqmZHwYPUExbjmvA4U1tiwLxh/eg5z52 t2E9WaP7yR6xZc7a2zaRv30CSmpzQddfWJjav70IypI1twqzjINJc4YlRdsadLLDO7VB xhG5piOiQJnfZfHrDYIwAqnHFnmbj1pvZ3UXNmFNUx8SD9J2eNKNTydAdM8zFjfBaRle 2R8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Yen0y2jH; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020aa7d1cc000000b00434eb492161si2169653edp.330.2022.06.24.02.32.41; Fri, 24 Jun 2022 02:33:07 -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=@google.com header.s=20210112 header.b=Yen0y2jH; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbiFXI2v (ORCPT + 99 others); Fri, 24 Jun 2022 04:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbiFXI2q (ORCPT ); Fri, 24 Jun 2022 04:28:46 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86968248FC for ; Fri, 24 Jun 2022 01:28:45 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-3176b6ed923so17432367b3.11 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=BWprIbY6NwdyU1IMdDaV6uhf5OLJyz55yZ0fcAfsswJecxN38KVogw+2DD4xkzrCOV M3Gppycc1PVAu0UUukrZE0tiIR1PejZMpdnxrmK+3x6gqmZCzIGV1wkcgcjZ48FB3gAZ HQKbF486oQCm1EToy0jSqdkoKmkrUGDuefxOYwl3NmwMHhm4wkn1KKyOCUNeq8x0vWqm GDDXxSHgEm3uaSVY0jNweJuc16b3dzuLUmrqWobULvMQpbNNRFEshBhVxd4okVLoyGk6 w9qi4LaIKxv4zNqtTm1YR5zM1ybNCi3qxQdrxeenmEA8vWR96BX5z9TIYwyWN1o4XAPR FJrw== X-Gm-Message-State: AJIora93s2+rcIcgWmqCIGQQOriprA8Pz7OnqZmWEtmwAZ5ScFOC8dt3 W6XvxZYszMByo0m77EVwSanHUfacoPwl+csQ3Iq/rg== 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" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 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().