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 88ADAC43217 for ; Mon, 7 Nov 2022 16:48:32 +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:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GB9xdICyAuK507OV+0GKSOOvw0MtrTBpnhJzJ3+cOgg=; b=rJgL4z3+/6vdT/ 3v1NlUUo56Pi4A8y4nPybDIilYdBswk8UEH8gXuy2wPUv7RinV8DAeIfw9NoS4fSylsFD73NDv313 U+mrVbfbzkG0wuXua5facgKdJN5drReUa9/EES5rvF8qnkGaqYPBSyn2EIzVonjPpHtSSX7gOPddh vtniTPJCfzybfT3zZmja55Qkt84Dlxd2u0/uAmLNgiyzvD9z7boTGTgXSGYiCvqLj/smpoj7swjrS LPNKcEfwcUEaZolmvuRvMwCWuVTlT8jfL9VUa8idjPbHsVQtPkBLz3mFpDx2LmFfj+BzIfP8dv/Uf WxJz+h/Nbt7Le7crfFQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1os5HT-00GMNX-RM; Mon, 07 Nov 2022 16:47:28 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1os5HL-00GMKP-Gx for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2022 16:47:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0A191FB; Mon, 7 Nov 2022 08:47:22 -0800 (PST) Received: from [10.57.36.248] (unknown [10.57.36.248]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 132AA3F534; Mon, 7 Nov 2022 08:47:15 -0800 (PST) Message-ID: Date: Mon, 7 Nov 2022 16:47:14 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v2] mte: Initialize tag storage to KASAN_TAG_INVALID Content-Language: en-US To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Catalin Marinas References: <20220907110015.11489-1-vincenzo.frascino@arm.com> <20221107151929.GB21002@willie-the-truck> From: Vincenzo Frascino In-Reply-To: <20221107151929.GB21002@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221107_084719_661728_D657761E X-CRM114-Status: GOOD ( 24.61 ) 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 Hi Will, On 11/7/22 15:19, Will Deacon wrote: > On Wed, Sep 07, 2022 at 12:00:15PM +0100, Vincenzo Frascino wrote: >> When the kernel is entered on aarch64, the MTE allocation tags are in an >> UNKNOWN state. >> >> With MTE enabled, the tags are initialized: >> - When a page is allocated and the user maps it with PROT_MTE. >> - On allocation, with in-kernel MTE enabled (HW_TAGS KASAN). >> >> If the tag pool is zeroed by the hardware at reset, it makes it >> difficult to track potential places where the initialization of the >> tags was missed. >> >> This can be observed under QEMU for aarch64, which initializes the MTE >> allocation tags to zero. >> >> Initialize to tag storage to KASAN_TAG_INVALID to catch potential >> places where the initialization of the tags was missed. >> >> This is done introducing a new kernel command line parameter >> "mte.tags_init" that enables the debug option. >> >> Note: The proposed solution should be considered a debug option because >> it might have performance impact on large machines at boot. >> >> Cc: Catalin Marinas >> Cc: Will Deacon >> Signed-off-by: Vincenzo Frascino >> --- >> arch/arm64/kernel/mte.c | 47 +++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 47 insertions(+) > > I don't really see the point in this change -- who is going to use this > option? > I think this option can be useful to someone who is trying to debug a problem that is related to a missed tag initialization and it is doing it on QEMU. QEMU by default would mask this class of problems because it initializes to zero the tags at "reset" (which is a valid UNKNOWN STATE according to the architecture). I noticed this behavior because I was trying to debug a similar issue which I was able to reproduce only on FVP. Said that, I originally posted this patch as RFC back in April this year to find out if someone else would find it useful, in fact my idea was to keep it locally. Please let me know what do you want to do. > Will -- Regards, Vincenzo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel