Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp23466pxt; Wed, 4 Aug 2021 05:07:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEBFrAty+94wkWIG6hnW/CapA8e167E1EaipeQ4in6SpL1qfAjvx+kQnOP0atbJMV3XvXW X-Received: by 2002:a17:906:71c4:: with SMTP id i4mr24574735ejk.230.1628078849876; Wed, 04 Aug 2021 05:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628078849; cv=none; d=google.com; s=arc-20160816; b=zmU+sS4Gn+AasvlQtVUsxGesjZjYR7D/HLcgbXr+jUzqgNmt8cECjJhVw+rzg6oa3u VFblXGz2xOw2IUP/TUdCRzZkuEIs9xf7Ep4X6Yewc1YJrKzHx0dSziMt0ksQ7yVSsUc+ K09S+eUB8vEfM1R9OOp6iedldxVO/hq52CCllT8tDTIag3oEV9mMSaKi2qvOpsuLHyDi 2sz483K9x11XTLVnph/K604H/VqAuHSTQde3qBxH028mP6u4N+E05qIu0Wv52tZ3eFOT cqEfggLSK628eoatXT2w/uzIWcS1/5pdMjVlH6yGHWeTkEGfVWLRndb2xuiD4LnLREpu Lcwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=1k9KEHgTww6/GAfefvfTZzdnOImvLWHYJMW8jtdaTqI=; b=cEQFPfX3FL98Fo96ADXzAwbufyzD3xXC2WBRj43MxCbZqNHJGugmb4o3mDoU0w0fiM dxsIgHXC7zA/LuskzuTiwfWUSd1yUtJ86S20sTpM67pmZVRb7KLs3NRCewaX7ETO/I/V AWzDSW5qwMQ9L07vdo7Ho7QhO8/572zyeMsvdMRwGqCSm2uMBG3+yGgqxp/AE2d1Bzad 94VuQvP8j1kw33vkRUuLPRhZZJe2Li4rSLGvpt4qY5rjaBJ9aC8bh7npARg7dWx8/xX9 8TQXKcgmh/HgNICip8Q27MsOm3zUBNWUVsRYpowVITcjIpdHWVg1ZnZ8I5Qo30gp4zFb KGWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si2348138edw.443.2021.08.04.05.07.06; Wed, 04 Aug 2021 05:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237013AbhHDJKi (ORCPT + 99 others); Wed, 4 Aug 2021 05:10:38 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:39872 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S236906AbhHDJKg (ORCPT ); Wed, 4 Aug 2021 05:10:36 -0400 X-UUID: 70d6da78d4a94c559c99d936885b3c4d-20210804 X-UUID: 70d6da78d4a94c559c99d936885b3c4d-20210804 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 954435666; Wed, 04 Aug 2021 17:10:19 +0800 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 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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(); } -- 2.18.0