From patchwork Wed Aug 4 08:22:30 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: 12418067 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 3F982C4320A for ; Wed, 4 Aug 2021 08:25:42 +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 F195860F02 for ; Wed, 4 Aug 2021 08:25:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F195860F02 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=2LP7eBHJn/tFs+IQtfsGMzisKPVzv68SEsVREQ6FoDI=; b=4DnNfRfucM0KA4 ZmvWH9XXPtzj2v9lOBpxuEn1rUex3+W7NeLOi9d/AyroaAH0taKR/wnQTnXkT/X3BILinizRgxVBK GEoc0bGaZRKAd63hJIVz1g2QtXla6elVMFy57c0T3bLMwWwqQOqsIxZVX76jhXXiZigEz3zqNaAja I7S+612/zWWgz9SnGnYHbDGGpkiZEwrhijZrJ5DGEDCM416Ks6RD+n6G0TS7VHFytoQ2pqR9yueOJ tuWSiUSnKYSdfSEMgNOTgNP/J/OyAKdiJNNyNSOZTROa7jGK5idQTH5LEViYn0qZoFMBaAexOCEpY aZU9LK+AGfZtn6Ax1yzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBCBo-00585i-Q9; Wed, 04 Aug 2021 08:23:49 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBCBQ-0057yj-0g; Wed, 04 Aug 2021 08:23:25 +0000 X-UUID: a77e7a20622840279a4c7959f5830d40-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=ODXj1Xhk1FGkkQPsDVoXoZ63BMwG+ZKNq0HALJMfPoU=; b=nvljxVzxqu7QivkEUHotWocwK11lhPoPRx2tLG8p9DQt64XTU+JHZgJIMg9rQ0LH+KsOywVL6wlYVVZV4nfp8sgjpvHDC/3EsCP870zBKUH9ElJjQ8YyE/usAJyUSa3ZOeyRQEyHSmFFeY/ya+mXTi2LAZqexaGXjnpzosZc+lU=; X-UUID: a77e7a20622840279a4c7959f5830d40-20210804 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 995490757; Wed, 04 Aug 2021 01:23:16 -0700 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 01:23:14 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 16:23:13 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 4 Aug 2021 16:23:12 +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 v2 2/2] kasan, slub: reset tag when printing address Date: Wed, 4 Aug 2021 16:22:30 +0800 Message-ID: <20210804082230.10837-3-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210804082230.10837-1-Kuan-Ying.Lee@mediatek.com> References: <20210804082230.10837-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_012324_110458_D4552451 X-CRM114-Status: GOOD ( 12.07 ) 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 Suggested-by: Marco Elver Reviewed-by: Marco Elver --- 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(); }