From patchwork Wed Aug 4 09:09:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3Vhbi1ZaW5nIExlZSAo5p2O5Yag56mOKQ==?= X-Patchwork-Id: 12418235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9CAC4338F for ; Wed, 4 Aug 2021 09:24:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 833B360F14 for ; Wed, 4 Aug 2021 09:24:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 833B360F14 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4/x4W4dHRgC4dKcyRXfwDhtNyCjd8L5n+BfD4v/me7k=; b=VhfzwuUqoD9SuG N0Xq7jB2Dcxv5+5hA6a/oZ9RXF+XbAt9rDBTXRqrzSWwbHEuYfVCf6xMiop32iKGNYFjIEYNgW6In R5xF7eSYIbKcEQwaalFRIId/KTEuY/n2f3bAiFZ/t/ROqK4yYHXyGylOmJXJCzb/l0d4nq3XadJI0 rHaXlpYw5R4IKVOmymiv2MjD1Qq8l+kBe6cv39b7BMWLTIIvaOwpoAaNTafLH+2FmShpO7MMqajvS IS7eFjE5UvokOsCHmGGynJO897Scz7kSUt6mpxUb4XtaZCs17m8gb7dXxrVlarR0tgXIyXkdjng97 HzXHRBYagiUBCDK/2wHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBD6l-005OoW-R2; Wed, 04 Aug 2021 09:22:41 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBCuu-005KVe-5p; Wed, 04 Aug 2021 09:10:25 +0000 X-UUID: 2b751f22f78a4446a4aeacb167e69142-20210804 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=9LDpHozNn7dKIzhq2mSS8+9jqY4udNOKQJbJu5wzkcw=; b=u2U5oeYBiJDk9EpG7p6UJHczFdwhffrJqKAOzlG5TgdUigQkLd2sxGy/yEw/LQrD6C+45bKUSB9oG1uNUescaiJjHvhDqKSQ/We98Bkb4iD3hQxvqr7/HVVwDNXenDZO7hxb4xb6lJAyT9s9JvJsCQGXa2dWLbUR9FlKcq0721w=; X-UUID: 2b751f22f78a4446a4aeacb167e69142-20210804 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2028046496; Wed, 04 Aug 2021 02:10:21 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 02:10:19 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 17:10:18 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 4 Aug 2021 17:10:18 +0800 From: Kuan-Ying Lee To: Nicholas Tang , Andrew Yang , Andrey Konovalov , "Andrey Ryabinin" , Alexander Potapenko , Marco Elver , Catalin Marinas , Chinwen Chang , Andrew Morton CC: , , , , , Kuan-Ying Lee Subject: [PATCH v3 2/2] kasan, slub: reset tag when printing address Date: Wed, 4 Aug 2021 17:09:57 +0800 Message-ID: <20210804090957.12393-3-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210804090957.12393-1-Kuan-Ying.Lee@mediatek.com> References: <20210804090957.12393-1-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210804_021024_277571_08574C83 X-CRM114-Status: GOOD ( 12.54 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The address still includes the tags when it is printed. With hardware tag-based kasan enabled, we will get a false positive KASAN issue when we access metadata. Reset the tag before we access the metadata. Fixes: aa1ef4d7b3f6 ("kasan, mm: reset tags when accessing metadata") Signed-off-by: Kuan-Ying Lee Reviewed-by: Marco Elver Reviewed-by: Andrey Konovalov --- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index b6c5205252eb..f77d8cd79ef7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -576,8 +576,8 @@ static void print_section(char *level, char *text, u8 *addr, unsigned int length) { metadata_access_enable(); - print_hex_dump(level, kasan_reset_tag(text), DUMP_PREFIX_ADDRESS, - 16, 1, addr, length, 1); + print_hex_dump(level, text, DUMP_PREFIX_ADDRESS, + 16, 1, kasan_reset_tag((void *)addr), length, 1); metadata_access_disable(); }