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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FD4FC433F5 for ; Sun, 28 Nov 2021 00:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ljaj3toVhgtW5djHBDHw+ejaJs1UcZO99C1tkiWvMVE=; b=P+oRvlxeNqBhZv r0SSxxPO92aCOWWsojS/0VhkHy377g8wt9I1Wnygw/70LwvBS/LoqaaScBgRUCt/UdMjk2Ak5FPyu gxGbxJi9YdvkYt436WN8wqYuJ/MBLLIiVzOY5tGkJPZ8PC2UInXe6BLgzlyohS4wm8oLGFDCXKfoo 3C/Kvvicu+YNULhtpV5rttVzE+k6Uvvu32FVp/cnmct4RMhp3neUu7HyLi0ySpHFoQQLqYKDIQQEt 2QNWHcP4DLuQAPZM4KlhLI0vByqSxGhcZSYkm7tarx3aV4toJ9klu/Adh3ggkYVHoZ7niKXeIkouI EbtsUYIpmCR8vU6UU5/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mr7vq-00EguN-Bp; Sun, 28 Nov 2021 00:20:38 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mr7vm-00Egtt-6G; Sun, 28 Nov 2021 00:20:35 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 450BC60F4B; Sun, 28 Nov 2021 00:20:31 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B29560524; Sun, 28 Nov 2021 00:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1638058830; bh=CKZ+e8k135ZZUhwVMJEQB8rHyvFCB7GPOLchrJ0D5go=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0AOvXxVGgboRb7eA1NwxoOrMf3dtsAtHRbiyZJL4nEy3F08Oa/ZLj16GfcnXRIJmQ zNZm5UQQ+WtO20dXMQTea3IZT5FwLccbE4YPuMfSs7Jp9bVSU1rj6fTkfWTJcosPWc rf2Z7VW47FypZ3+a0a+W/VfSsCykoRdSyig12/zE= Date: Sat, 27 Nov 2021 16:20:28 -0800 From: Andrew Morton To: Andrey Konovalov Cc: Kuan-Ying Lee , Catalin Marinas , Matthias Brugger , Chinwen Chang (=?UTF-8?Q?=E5=BC=B5=E9=8C=A6=E6=96=87?=) , Nicholas Tang (=?UTF-8?Q?=E9=84=AD=E7=A7=A6?= =?UTF-8?Q?=E8=BC=9D?=) , James Hsu ( =?UTF-8?Q?=E5=BE=90=E6=85=B6=E8=96=B0?=) , Yee Lee (=?UTF-8?Q?=E6=9D=8E=E5=BB=BA=E8=AA=BC?=) , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" , kasan-dev Subject: Re: [PATCH] kmemleak: fix kmemleak false positive report with HW tag-based kasan enable Message-Id: <20211127162028.07d1a9fc392d91e7d234daae@linux-foundation.org> In-Reply-To: References: <20211118054426.4123-1-Kuan-Ying.Lee@mediatek.com> <754511d9a0368065768cc3ad8037184d62c3fbd1.camel@mediatek.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211127_162034_330083_05C45EE0 X-CRM114-Status: GOOD ( 15.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 25 Nov 2021 17:13:36 +0100 Andrey Konovalov wrote: > > > kmemleak_object *object) > > > static struct kmemleak_object *lookup_object(unsigned long ptr, int > > > alias) > > > { > > > struct rb_node *rb = object_tree_root.rb_node; > > > + unsigned long untagged_ptr = (unsigned > > > long)kasan_reset_tag((void *)ptr); > > > > > > while (rb) { > > > struct kmemleak_object *object = > > > rb_entry(rb, struct kmemleak_object, rb_node); > > > - if (ptr < object->pointer) > > > + unsigned long untagged_objp; > > > + > > > + untagged_objp = (unsigned long)kasan_reset_tag((void > > > *)object->pointer); > > The two lines above can be squashed together. That would make a too-long line even longer. In fact I think it's better to go the other way: --- a/mm/kmemleak.c~kmemleak-fix-kmemleak-false-positive-report-with-hw-tag-based-kasan-enable-fix +++ a/mm/kmemleak.c @@ -384,10 +384,10 @@ static struct kmemleak_object *lookup_ob unsigned long untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr); while (rb) { - struct kmemleak_object *object = - rb_entry(rb, struct kmemleak_object, rb_node); + struct kmemleak_object *object; unsigned long untagged_objp; + object = rb_entry(rb, struct kmemleak_object, rb_node); untagged_objp = (unsigned long)kasan_reset_tag((void *)object->pointer); if (untagged_ptr < untagged_objp) _ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel