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 X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 64425C433E0 for ; Fri, 8 Jan 2021 16:51:20 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id BABED239FE for ; Fri, 8 Jan 2021 16:51:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BABED239FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 118924B42A; Fri, 8 Jan 2021 11:51:19 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DB+P8Exv4zdC; Fri, 8 Jan 2021 11:51:17 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 225C64B42C; Fri, 8 Jan 2021 11:51:17 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 716CD4B428 for ; Fri, 8 Jan 2021 11:51:16 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HH4rj42Kbvc0 for ; Fri, 8 Jan 2021 11:51:15 -0500 (EST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 40D6A4B36D for ; Fri, 8 Jan 2021 11:51:15 -0500 (EST) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 084A9239FD; Fri, 8 Jan 2021 16:51:14 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kxuyl-0067gk-RL; Fri, 08 Jan 2021 16:51:11 +0000 MIME-Version: 1.0 Date: Fri, 08 Jan 2021 16:51:11 +0000 From: Marc Zyngier To: Steven Price Subject: Re: [PATCH] KVM: arm64: Compute TPIDR_EL2 ignoring MTE tag In-Reply-To: <20210108161254.53674-1-steven.price@arm.com> References: <20210108161254.53674-1-steven.price@arm.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: steven.price@arm.com, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, glider@google.com, akpm@linux-foundation.org, andreyknvl@google.com, vincenzo.frascino@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Catalin Marinas , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andrey Konovalov , Alexander Potapenko , Andrew Morton , Vincenzo Frascino , Will Deacon , kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Steven, On 2021-01-08 16:12, Steven Price wrote: > KASAN in HW_TAGS mode will store MTE tags in the top byte of the > pointer. When computing the offset for TPIDR_EL2 we don't want anything > in the top byte, so remove the tag to ensure the computation is correct > no matter what the tag. > > Fixes: 94ab5b61ee16 ("kasan, arm64: enable CONFIG_KASAN_HW_TAGS") > Signed-off-by: Steven Price > --- > Without this fix I can't boot a config with KASAN_HW_TAGS and KVM on an > MTE enabled host. I'm unsure if this should really be in > this_cpu_ptr_nvhe_sym(). this_cpu_ptr_nvhe_sym() should return something that is valid for the EL1 kernel, so I guess untagging in the helper may not be that useful. However, I'm more concerned by anything at requires us to follow pointers set up by EL1 at EL2. It looks to me that the only reason the whole thing works is because kern_hyp_va() *accidentally* drops tags before applying the EL1/EL2 offset... Or am I getting it wrong? Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 02879C433DB for ; Fri, 8 Jan 2021 16:55:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 AAE0A239FE for ; Fri, 8 Jan 2021 16:55:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAE0A239FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wmyxQJPjDHjrTES12SplZq8VMMnBgwxDd4bi8gt8W1Q=; b=JqixZfTQF1qTw3mEWL0CegLIY 7R3ykJyNcwyta4PslUWjE3pJ94YUpiwEFQD01o8hTXXysTntW9474b5M5cvzOcam/4uWmLIRbzKUa O2ix/OS0Y7Aa84iLJG+2U4iKKIynjoU+Vuy+/4DHu5IKitOMwITP8s3Cab4CM+goSXnwCipVvuAJp N+srH5yPJtN8Ouo4YMUGQh9Hn9delyykZKuku9pkMAR4SrwTjhWbM5zljqsXufK0nOX+orcmB9q4d URqAK7+EolJythbBJp2jWuxPFoV6662qsbD89QOu3xDayL2bm/V2y0DANJcaPi9d/i96ai917nbwQ NwpZVisXQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxuzD-0001iO-0y; Fri, 08 Jan 2021 16:51:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxuyo-0001ht-VC for linux-arm-kernel@lists.infradead.org; Fri, 08 Jan 2021 16:51:15 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 084A9239FD; Fri, 8 Jan 2021 16:51:14 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kxuyl-0067gk-RL; Fri, 08 Jan 2021 16:51:11 +0000 MIME-Version: 1.0 Date: Fri, 08 Jan 2021 16:51:11 +0000 From: Marc Zyngier To: Steven Price Subject: Re: [PATCH] KVM: arm64: Compute TPIDR_EL2 ignoring MTE tag In-Reply-To: <20210108161254.53674-1-steven.price@arm.com> References: <20210108161254.53674-1-steven.price@arm.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: steven.price@arm.com, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, glider@google.com, akpm@linux-foundation.org, andreyknvl@google.com, vincenzo.frascino@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210108_115115_076201_538DB3A7 X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Suzuki K Poulose , Catalin Marinas , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Andrey Konovalov , Alexander Potapenko , Andrew Morton , Vincenzo Frascino , Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Steven, On 2021-01-08 16:12, Steven Price wrote: > KASAN in HW_TAGS mode will store MTE tags in the top byte of the > pointer. When computing the offset for TPIDR_EL2 we don't want anything > in the top byte, so remove the tag to ensure the computation is correct > no matter what the tag. > > Fixes: 94ab5b61ee16 ("kasan, arm64: enable CONFIG_KASAN_HW_TAGS") > Signed-off-by: Steven Price > --- > Without this fix I can't boot a config with KASAN_HW_TAGS and KVM on an > MTE enabled host. I'm unsure if this should really be in > this_cpu_ptr_nvhe_sym(). this_cpu_ptr_nvhe_sym() should return something that is valid for the EL1 kernel, so I guess untagging in the helper may not be that useful. However, I'm more concerned by anything at requires us to follow pointers set up by EL1 at EL2. It looks to me that the only reason the whole thing works is because kern_hyp_va() *accidentally* drops tags before applying the EL1/EL2 offset... Or am I getting it wrong? Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 25E66C433E0 for ; Fri, 8 Jan 2021 16:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3ADF239FD for ; Fri, 8 Jan 2021 16:52:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728091AbhAHQvz (ORCPT ); Fri, 8 Jan 2021 11:51:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:42978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbhAHQvy (ORCPT ); Fri, 8 Jan 2021 11:51:54 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 084A9239FD; Fri, 8 Jan 2021 16:51:14 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kxuyl-0067gk-RL; Fri, 08 Jan 2021 16:51:11 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 08 Jan 2021 16:51:11 +0000 From: Marc Zyngier To: Steven Price Cc: Catalin Marinas , Will Deacon , James Morse , Julien Thierry , Suzuki K Poulose , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Potapenko , Andrew Morton , Andrey Konovalov , Vincenzo Frascino Subject: Re: [PATCH] KVM: arm64: Compute TPIDR_EL2 ignoring MTE tag In-Reply-To: <20210108161254.53674-1-steven.price@arm.com> References: <20210108161254.53674-1-steven.price@arm.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: steven.price@arm.com, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, glider@google.com, akpm@linux-foundation.org, andreyknvl@google.com, vincenzo.frascino@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steven, On 2021-01-08 16:12, Steven Price wrote: > KASAN in HW_TAGS mode will store MTE tags in the top byte of the > pointer. When computing the offset for TPIDR_EL2 we don't want anything > in the top byte, so remove the tag to ensure the computation is correct > no matter what the tag. > > Fixes: 94ab5b61ee16 ("kasan, arm64: enable CONFIG_KASAN_HW_TAGS") > Signed-off-by: Steven Price > --- > Without this fix I can't boot a config with KASAN_HW_TAGS and KVM on an > MTE enabled host. I'm unsure if this should really be in > this_cpu_ptr_nvhe_sym(). this_cpu_ptr_nvhe_sym() should return something that is valid for the EL1 kernel, so I guess untagging in the helper may not be that useful. However, I'm more concerned by anything at requires us to follow pointers set up by EL1 at EL2. It looks to me that the only reason the whole thing works is because kern_hyp_va() *accidentally* drops tags before applying the EL1/EL2 offset... Or am I getting it wrong? Thanks, M. -- Jazz is not dead. It just smells funny...