Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2102004rwb; Mon, 7 Nov 2022 09:10:07 -0800 (PST) X-Google-Smtp-Source: AMsMyM4NBrU6kq02WujmLaEvY/siCiNe6FnICrnpbsv6kakkKH6h9KcIbTLzX4VoGxbvZ4kfBpP9 X-Received: by 2002:a17:906:edb9:b0:7ad:a423:dc75 with SMTP id sa25-20020a170906edb900b007ada423dc75mr47430244ejb.213.1667841006966; Mon, 07 Nov 2022 09:10:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667841006; cv=none; d=google.com; s=arc-20160816; b=MXn+tkNtGez5xy0eHb06C5By+SmiUQx1ZN9P0krpbMJId0ZSxTgNq+8rDNWEPYqux3 fCgbzklkhxgkWflfmF2cyxbipK53v3V1b2sUnGCZK6JWhbQ5JRRIYhI9r063gCCT7gUX ZqyEI+czzY31MU4XYEW9d/4ZVf4sjvK7zvk3Au+MxrL8/LPhQ3KhkTWgiHfgPH5UEsga 266Q5Qj3L2RWZsrDPNt36VHXkIRrA3HIIYR3SO4hYH/eS2sDmskvgcQ67UFShQnGCk7B vml3lpw54erwY0DI24KkGLtgx1mdtW70RtqF7YHpLxwlRB3Egx57CtAn0M7k3JxlpbDP ZEsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=eTFs2ZLrMMsrsgkKuWIBmiYw45aE/+Pg6bch7N/FgvI=; b=hbunRZZ15ti3o2QcL14RxmDtqrZvPC1lQdoDrCJVrm+RBPuiTtQv68sb69fUlFr5fQ ShB8JOMvKW3Te0PgBJMTRrFQHCoJY4xtgm6RauJmd4izunTK91bFIXRW4vN6D8sehj1d rT0BxbEqQF/07teuqEoxrHuU2NCgTDk8p7b4IVtKjFw7Ibdp6M/FtEb+yD7+ODf4VH93 tetab1ttZKNfQlYNKEaRsYrcfpwpzUOtsSnlHZhSC5OwNT0KP6KYpudIto18bGUXKNsc 2VvNd3xxcS3y59gxfjfgzG0/5VLT9v8EVIdAOsGxvzCKYCzzNxC08Gt620wHwKn9rgXy xCBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho40-20020a1709070ea800b0078dd12d0a9bsi9708787ejc.875.2022.11.07.09.09.23; Mon, 07 Nov 2022 09:10:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbiKGQrT (ORCPT + 93 others); Mon, 7 Nov 2022 11:47:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231462AbiKGQrS (ORCPT ); Mon, 7 Nov 2022 11:47:18 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0DBB01F2C9 for ; Mon, 7 Nov 2022 08:47:17 -0800 (PST) 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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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