From patchwork Sun Apr 23 17:09:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9695037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFC6C60245 for ; Sun, 23 Apr 2017 17:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA67626530 for ; Sun, 23 Apr 2017 17:13:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E03E265B9; Sun, 23 Apr 2017 17:13:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51BC926530 for ; Sun, 23 Apr 2017 17:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163082AbdDWRNN (ORCPT ); Sun, 23 Apr 2017 13:13:13 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36824 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163048AbdDWRK6 (ORCPT ); Sun, 23 Apr 2017 13:10:58 -0400 Received: by mail-wm0-f47.google.com with SMTP id u65so7510935wmu.1 for ; Sun, 23 Apr 2017 10:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IU3Slh2m0vyDrTQVJoS1e33nH1cpEn+sRbDJ98FfyCs=; b=JRIwS3mrlXjB9hWtF1RuB/qWbQFayT6MAiFseCn8uuUpbjxyoP2ArDk8m+M01TpdyD eSk5FRQPKwKLgfP1tf8kyJ96RzmClDMaqUhaad6KI+XRU29ZQHXPxeTkRqgMPBXQRfVC +PzdobBD2RF6IDZ9kzFS24CxqM6GEKmKljpEs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IU3Slh2m0vyDrTQVJoS1e33nH1cpEn+sRbDJ98FfyCs=; b=n+++YMQp4mpN1HfBLpHRS+i01FYjpdGVm9l8MV//2i8EPW+G2KQAhuGpxW/asw5mQW qUVXl1zm2y6QqFi5l/rZfURo5qZA893yEgMBmW6i78trj9l4m1K6aKCnfBkay1ASeJ50 xd2A2pCh2PNgU3NZLVDhPoUmGgp2KCQ0KbQmz/Y/0NyJyOJ98ridPI8ey/xigY+tlDJN cx8YH1pte1B9kuRVFLheg6kX7Qu+sdZIeIoOZdbPoTGvbwqrwsMaU9Ha0C2EpPBuw1Wp LMPrNbU/L0V5dLBeE3xWdS3EWuYKq4Tq6Day6LDcK7lnN3tfiG6yyfJocno0SwvLHf8W 9kLg== X-Gm-Message-State: AN3rC/6un//AWsW7RpkkDKXjs7zN9Q/cYmkPeP35APDL+ij5gogrqO7Z zyJ/K+1jkzQxGwyS X-Received: by 10.80.195.24 with SMTP id a24mr120990edb.44.1492967456475; Sun, 23 Apr 2017 10:10:56 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id 58sm2803521edz.2.2017.04.23.10.10.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:55 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Christoffer Dall Subject: [PULL 79/79] ARM: KVM: Fix idmap stub entry when running Thumb-2 code Date: Sun, 23 Apr 2017 19:09:29 +0200 Message-Id: <20170423170929.27334-80-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170423170929.27334-1-cdall@linaro.org> References: <20170423170929.27334-1-cdall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier When entering the hyp stub implemented in the idmap, we try to be mindful of the fact that we could be running a Thumb-2 kernel by adding 1 to the address we compute. Unfortunately, the assembler also knows about this trick, and has already generated an address that has bit 0 set in the litteral pool. Our superfluous correction ends up confusing the CPU entierely, as we now branch to the stub in ARM mode instead of Thumb, and on a possibly unaligned address for good measure. From that point, nothing really good happens. The obvious fix in to remove this stupid target PC correction. Fixes: 6bebcecb6c5b ("ARM: KVM: Allow the main HYP code to use the init hyp stub implementation") Reported-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kvm/hyp/hyp-entry.S | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/kvm/hyp/hyp-entry.S b/arch/arm/kvm/hyp/hyp-entry.S index a35baa8..95a2fae 100644 --- a/arch/arm/kvm/hyp/hyp-entry.S +++ b/arch/arm/kvm/hyp/hyp-entry.S @@ -144,7 +144,6 @@ hyp_hvc: ldr r1, [r1] ldr ip, =__kvm_handle_stub_hvc sub ip, ip, r1 -THUMB( add ip, ip, #1) pop {r1} bx ip