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: 12418199 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.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_BASE64_TEXT,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 A4696C4338F for ; Wed, 4 Aug 2021 09:10:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53B9D6105A for ; Wed, 4 Aug 2021 09:10:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 53B9D6105A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id BF7898D0054; Wed, 4 Aug 2021 05:10:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B32AF8D0053; Wed, 4 Aug 2021 05:10:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D2BC8D0052; Wed, 4 Aug 2021 05:10:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 7CEEC8D002D for ; Wed, 4 Aug 2021 05:10:26 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2DFBB182012A2 for ; Wed, 4 Aug 2021 09:10:26 +0000 (UTC) X-FDA: 78436827252.07.FB816C6 Received: from mailgw02.mediatek.com (mailgw02.mediatek.com [216.200.240.185]) by imf24.hostedemail.com (Postfix) with ESMTP id 32332B007DBD for ; Wed, 4 Aug 2021 09:10:25 +0000 (UTC) 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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 32332B007DBD Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=u2U5oeYB; dmarc=pass (policy=none) header.from=mediatek.com; spf=pass (imf24.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com X-Stat-Signature: 7d559jsgkpcg9ntfdib4egkg9spfu87u X-HE-Tag: 1628068225-604127 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: 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(); }