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 F3E22EB64D9 for ; Thu, 6 Jul 2023 15:24:10 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iwNSXhoyduSaxcjZHmjYCE98awjxmffT/UOR1cxS1Hg=; b=RO5Cmz/7c89sjF vELk4aVuTgshsS9OmyFNWCb32HO0J4d/uJkdIlYi2h5bp/DeSb6lLLtvYdIfEqLWtItXfxwIFGIOt /yJrnGkLAv0ioiapcjuilFlYhPY88Uim+vLw4OjQ2WZ1wCYIeOrZ7AKt3CKeH4JoZHVgQXC/R/6pF Ntzui7hOG4tQvbh0cRcwturE8Apw/Yj33Pvy3zV+I5nm1oPbjfOvyzMQqtArwkWnTkqH+GgsJB1W4 cNZSSCLM1g2o4qRKA/Qqlz283wNC7iyT1Ewz9Q0YV3Y8nV3T0c08dnkITAJ1yRKtdgqmDUat4IR2+ hDuMInB9Xx89oirMlIQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qHQpb-001znZ-1x; Thu, 06 Jul 2023 15:23:43 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qHQpZ-001zm4-1w for linux-arm-kernel@lists.infradead.org; Thu, 06 Jul 2023 15:23:42 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbd33a1819so111245e9.1 for ; Thu, 06 Jul 2023 08:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688657017; x=1691249017; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Y6qis8CnT+xpm3hc78+sJPYYplKlMZhcwZsxd3FBsB0=; b=bcB9+xfY27xSFVigr4qzoaT1bXwyVfL7cV9cR1lj4nkkq4cj6u6M70kYX6IKLgWfq/ coCkE1TPHHK3J+UbNGZQEAzgG+pYn65TrDOgl7kosOEptK7fiIjPLER17OCXobybXyqH wKAuu72b5U0pogvwL/hTwJMiHrQkbdIAA2PQAGs5gElWRWG9ZNE7nJZIAEoRF1xXaQ7w 0CylC9GSRUIRRHRNStCd8V2o/Uibwsr/2Ll1Kzxk2SvhsginXwiyMLDxZbhhsyEJhqB7 yU9KbngrenPiE+8WiUYymW1F0B2FaJKOF2k3Inq/rBKqMKdmGPknGFq+E8IGafmiUKkB Mqgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688657017; x=1691249017; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y6qis8CnT+xpm3hc78+sJPYYplKlMZhcwZsxd3FBsB0=; b=AeJxUPxpYWej0v1vhUn/tsI4K63X7LizQUfVA2gu+7VGrdsUCEnEvY7UZfPxKRA3SU f5+0lGkCvrT+G9piQJimSRbv5z1qij3UhsVsICynd/Mg2XjaRVGSQOUYAYMLTlsJg8rj 2Ptr1j1t2XsOhVTSxc7ZYdwcxwSn7q69y5RX4iTvvubppkQsyU/wZmVaCzhJJLAJabrD j4+OzOmN2lYxbDJT+MGh2WaSlsc/63JuDCoQSXaNe7xsX64E6MbEgvBJpjwvzQbwzGDc 10Jfmt1IST50NbMmneJLKP02wdGeC2oL0GN9G6Z0Z/McZbo9aS3mrwNU7LeFHvRLWIfb NQGg== X-Gm-Message-State: ABy/qLaATYTXavN+OLA+YT/JedwgMXSr/AS3i+mLzZeSRTvGbxPa2tJk TAmNXoehR1oLzPWdD4eM6dD/Xw== X-Google-Smtp-Source: APBJJlEVZPjavZNR3a4RhEKi5usCLZuBG+o7AGWWWk8qr/QqNNQ1Ew+k2sJlSWVllKPPgSIFvYBf0Q== X-Received: by 2002:a05:600c:45ca:b0:3f6:f4b:d4a6 with SMTP id s10-20020a05600c45ca00b003f60f4bd4a6mr87572wmo.7.1688657017311; Thu, 06 Jul 2023 08:23:37 -0700 (PDT) Received: from google.com (44.232.78.34.bc.googleusercontent.com. [34.78.232.44]) by smtp.gmail.com with ESMTPSA id j14-20020a056000124e00b0031274a184d5sm2110136wrx.109.2023.07.06.08.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 08:23:36 -0700 (PDT) Date: Thu, 6 Jul 2023 15:23:32 +0000 From: Mostafa Saleh To: Marc Zyngier Cc: oliver.upton@linux.dev, Sudeep Holla , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, tabba@google.com, qperret@google.com, will@kernel.org, catalin.marinas@arm.com, yuzenghui@huawei.com, suzuki.poulose@arm.com, james.morse@arm.com, bgardon@google.com, gshan@redhat.com Subject: Re: [PATCH v3] KVM: arm64: Use BTI for nvhe Message-ID: References: <20230530150845.2856828-1-smostafa@google.com> <20230704134136.a5znw4jupt5yp5kg@bogus> <20230704143339.cqrvntq7rmmb2on3@bogus> <20230704192529.d4x2p7ndz2dc4q52@bogus> <873521yv1j.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <873521yv1j.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230706_082341_659044_C9D9BA4E X-CRM114-Status: GOOD ( 30.07 ) 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 On Thu, Jul 06, 2023 at 03:27:36PM +0100, Marc Zyngier wrote: > Hi Mostafa, > > On Thu, 06 Jul 2023 13:49:04 +0100, > Mostafa Saleh wrote: > > > > Hi Marc and Oliver, > > > > I was double checking that nothing else was missed. > > > > I found there is another problem for hw that has BTI and is affected > > by specterv3a. > > > > "br'' instructions are generated at runtime for the vector > > table(__bp_harden_hyp_vecs). These branches would land on vectors > > in __kvm_hyp_vector at offset 8. > > > > As all the macros are defined with valid_vect/invalid_vect, it is > > sufficient to add "bti j" there at the correct offset. > > > > I am not sure if such hardware exists. I tested this with a stubbed > > "has_spectre_v3a" which confirms the issue and the fix. > > Thanks for the heads up. > > Fortunately, there is no such HW as far as I can tell. Only Cortex-A57 > and A72 are affected by this (and the only two CPUs for which we > engage the mitigation), and they are way too old to know about BTI. > > > Please let me know if this fix suitable, I can include it with the other fix in > > "[PATCH] KVM: arm64: Add missing BTI instruction in kvm_host_psci_cpu_entry" > > > > diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S > > index 8f3f93fa119e..175c030379e3 100644 > > --- a/arch/arm64/kvm/hyp/hyp-entry.S > > +++ b/arch/arm64/kvm/hyp/hyp-entry.S > > @@ -154,6 +154,12 @@ SYM_CODE_END(\label) > > esb > > stp x0, x1, [sp, #-16]! > > 662: > > + /* > > + * Specter vectors __bp_harden_hyp_vecs generate br instructions at runtime > > + * that jump at offset 8 at __kvm_hyp_vector. > > + * As hyp .text is guarded section, it needs bti j. > > + */ > > + bti j > > b \target > > > > check_preamble_length 661b, 662b > > @@ -165,6 +171,8 @@ check_preamble_length 661b, 662b > > nop > > stp x0, x1, [sp, #-16]! > > 662: > > + /* Check valid_vect */ > > + bti j > > b \target > > > > check_preamble_length 661b, 662b > > This looks correct to me. > > If you can respin you initial patch (with maybe a slightly more > generic subject) so that Oliver can pick it up as part of the next > batch of fixes, that'd be great. Thanks a lot, I just sent v2. [PATCH v2] KVM: arm64: Add missing BTI instructions > Thanks, > > M. > > -- > Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel