From patchwork Mon Oct 30 02:55:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 117435 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2059346qgn; Sun, 29 Oct 2017 19:56:13 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SVsLKUb+3wFun2s9esxXIPUmw7ps/PFR8od3zPV1SqVvaMMqOnIr+ZXs2I7rbtPnKmG+ON X-Received: by 10.99.149.15 with SMTP id p15mr6516023pgd.406.1509332173822; Sun, 29 Oct 2017 19:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509332173; cv=none; d=google.com; s=arc-20160816; b=R9FY2kRJg2Ed7LUiUfkYc7G41DMMoVwV/+MpmIVbNaSalWZDLthotS864Dz930a9wx X9EjeJ6n1GeIrsrOJst6JWuVlAkgXfpICO5uEDVOQnxGlpSMzAbeeDWta/usqV1TWNbK cRGdpYZUephYYigF5ojRSrITO1dQCOj6D7aIa0Tqx2vmFTJS1wXjJ13ciUwIvqJL0TM2 bN2TlIxccywZp1QGkt+qrNGKsAJaeopR+S6nnZBONa0cB3zfIUYbowz8Lj0uD8HaV9fr OoyylYIbF8jEdY926VT8MS0WpB0B1U9jnMUTXOC7egrrfydsM1XedbfNr5SUxYw6lPJG oIEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=q9nmbJxbxPgn0BsGyQlVJTCNZwqTNzJZOiPh1QA6UkM=; b=Dfgr7FdOjvPmfaJoTMCa/VdDd8oWZRvQgK+wx///QPQfCpcAg8PdC7FIzGeXxhuT+h E0oJCYC0LmrRd1jVVAdJdlCJc4dXPhXh5ir+EJ8luWm6KUEymMbbUInUzpuRzog2byFD myUDZoBHAgghUEdoGMlmWk9nMSLgJ2suMJx97pAMyS3xjVQDs/JCaXvz9vA0Uv2xWw3X yloF83T8gyN6qZ3Q7ktDt1hoq1eOy5jTE4htYe+iiB1taNbkauJJBvgP6eC/1s57MVuh mkV5uKvcj8pjXRhimKMlg37wmOAEOh5HHcifKdpvBKruxxLBvC95mmtVC62ejtxxRxS9 8svg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CzOXMe7H; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 85si9736578pfz.417.2017.10.29.19.56.13; Sun, 29 Oct 2017 19:56:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CzOXMe7H; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751909AbdJ3C4L (ORCPT + 9 others); Sun, 29 Oct 2017 22:56:11 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:46885 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750929AbdJ3C4K (ORCPT ); Sun, 29 Oct 2017 22:56:10 -0400 Received: by mail-wm0-f66.google.com with SMTP id m72so12945078wmc.1 for ; Sun, 29 Oct 2017 19:56:10 -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=q9nmbJxbxPgn0BsGyQlVJTCNZwqTNzJZOiPh1QA6UkM=; b=CzOXMe7HM844TST4Es68U/3g0ve3ovv+aAZDB5/vbAq4rO3rxZqfFawXCxf8Fu64xs MZI1GJ/hjZl7F0CNNzxsdJbTMdDd35CU2xXauhDS9OhegB9Q5PDMhKk4asyFgYSrZXZF KEDE5oOtKQmQqG55Rkv253G3LynYY5S4XJBW8= 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=q9nmbJxbxPgn0BsGyQlVJTCNZwqTNzJZOiPh1QA6UkM=; b=queFCGVZgU+9pgp+KyLViE0EOEBWD5+9Y7hKn04IU/Y7iKJ17jYm2HdJYNyqd9bmK1 QSqV0IhLbT1kytZ7ot0Ws81WTmhH1qneRnpOuT00hKfQPqbFcoxHvIuq3phG4CCTmzL0 NjtHIlMRoMT+9iDsu2DmsonmxsjlpfKVXdI7qAfjNPFo9ANbYnAJJcvOExMEqfr6SxyL x1tmoxpWYiQKm6yKjeABsbg4YMzqPysF1qqNfOKGkIUMqsZTK9l2m4BJVjFT1yYRspfI 67U7FmEbIYgCZEAGiF6Z2628uFQd5r3PT2mtMZax0YqXWWqyD2zXMzRou+55+CjJogx/ RmpQ== X-Gm-Message-State: AMCzsaUYYopCS7txiiqgqjZY5DvUYpxsiiGBSpG+rPO/9TOTYK8rpzIm FI7r8CZchCa+rss3pg1NdrUm/w== X-Received: by 10.80.153.48 with SMTP id k45mr10032786edb.208.1509332169614; Sun, 29 Oct 2017 19:56:09 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id u14sm7856415edd.47.2017.10.29.19.56.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Oct 2017 19:56:08 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Christoffer Dall , stable@vger.kernel.org Subject: [PULL 1/8] KVM: arm64: its: Fix missing dynamic allocation check in scan_its_table Date: Mon, 30 Oct 2017 03:55:56 +0100 Message-Id: <20171030025603.23550-2-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171030025603.23550-1-christoffer.dall@linaro.org> References: <20171030025603.23550-1-christoffer.dall@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org We currently allocate an entry dynamically, but we never check if the allocation actually succeeded. We actually don't need a dynamic allocation, because we know the maximum size of an ITS table entry, so we can simply use an allocation on the stack. Cc: Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.14.2 diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index f51c1e1b3f70..77652885a7c1 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -1801,37 +1801,33 @@ typedef int (*entry_fn_t)(struct vgic_its *its, u32 id, void *entry, static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz, int start_id, entry_fn_t fn, void *opaque) { - void *entry = kzalloc(esz, GFP_KERNEL); struct kvm *kvm = its->dev->kvm; unsigned long len = size; int id = start_id; gpa_t gpa = base; + char entry[esz]; int ret; + memset(entry, 0, esz); + while (len > 0) { int next_offset; size_t byte_offset; ret = kvm_read_guest(kvm, gpa, entry, esz); if (ret) - goto out; + return ret; next_offset = fn(its, id, entry, opaque); - if (next_offset <= 0) { - ret = next_offset; - goto out; - } + if (next_offset <= 0) + return next_offset; byte_offset = next_offset * esz; id += next_offset; gpa += byte_offset; len -= byte_offset; } - ret = 1; - -out: - kfree(entry); - return ret; + return 1; } /** From patchwork Mon Oct 30 02:55:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 117436 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2059394qgn; Sun, 29 Oct 2017 19:56:18 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Revaa/3Leg9PNq2KIfg4WRke+R2GF1JSpNachNZSHZtmV5AKfh8YhkSn4Bh2RUhxUVwx4Q X-Received: by 10.84.240.140 with SMTP id z12mr6201224plk.328.1509332178734; Sun, 29 Oct 2017 19:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509332178; cv=none; d=google.com; s=arc-20160816; b=yvzJ4ce+IRgoEFK48hjn0xEpsWqwW/d3IYH6cTBqWK2uWr38y4SpfwOEHETdQC+yLw dCvcn6Y5FRKzVR2/3m/HMkw1y+duoBmAxxfaqMGu1TuSx5NaYlerOJ2N8/n+DNa9an1z gvWYwPrIQwJgU3A8v3ZMPGTJIHszrKglAoVkUvKJZHfIBzMScAbSUovBulGfFIrszvcG m5tMdP9i6pUelJTHjDbxFhPq9h7wLtsTAyLSmtmrl2CicozveG85cLV1gE0l478KVS9y 4dPVAFiQzCA8UFjY8AQlhT/WevmqotvM9vCor343D6+gcyRZjjhYfKuJoey0CRWWC6Ih yhyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=71Jmcj+mbGbn2ljJawr+27UliK9VBI1XKmyZObsJl8g=; b=r+W/Gxwy+y+NfBp8gnGjTboBF2jPvhh+KePbefl2IqnX60w0Z+hn9V1VqiZZuhmbYQ rkmVbDUq6449l6kwLW9sif8NKIK2OuxBWR/WMeH0l57cKF1C7ebhthJRG/YdRb06YWkq lNT3SL15R90MVZ3kHKosn3Vx2C76tuslzG6fIfaknMAJGUMNXT/KYVvQJ5BlV2oOkJ6O k4PKmftqUe0J7Hr0KUFLrJ/sdvcG+DWJmIjorHcX6TeE+3Vx+wEKX1Eo9MwOI+MnxCqI +a+ye8TZrG6Og2lwiwz5PjIgBk6gyOv4UduVslpJc1PKfC8rFTZDcGoLjGLRqhtY6sbI VObQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SdTsI58Q; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 85si9736578pfz.417.2017.10.29.19.56.18; Sun, 29 Oct 2017 19:56:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SdTsI58Q; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752042AbdJ3C4O (ORCPT + 9 others); Sun, 29 Oct 2017 22:56:14 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52337 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbdJ3C4M (ORCPT ); Sun, 29 Oct 2017 22:56:12 -0400 Received: by mail-wm0-f65.google.com with SMTP id t139so13465805wmt.1 for ; Sun, 29 Oct 2017 19:56:11 -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=71Jmcj+mbGbn2ljJawr+27UliK9VBI1XKmyZObsJl8g=; b=SdTsI58QJHLyufGxtD1G/zZna+Hsa5gO9GDwejfYWiL3UMWMASyzzv85CfLO8fEGe8 WdrtkgZ9fHBusEhoZDLf9MFCUYfWSosykKfNsjx6bvAHQ8xMqfZlS/cBIgSgQEVVhGhv 3wUKZSAy3bTWoAvaIuQ3JkbyfTDttfpKh6i8s= 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=71Jmcj+mbGbn2ljJawr+27UliK9VBI1XKmyZObsJl8g=; b=oQ6t2BS3br1LBjWzjUAWid5rPrlxo9isRwdkYueeMcZxbEnlDlTlzdd7c1GvcPZcjy NOHUZYQhL9gCyk22+qUKk6116zwvCxryctA9sRgzbmxozeoEAuRSk7wovIFuIbG5Mg1X 1SdNF6jtqxXvJpzDQX8j5SYnBsVTf+/dL3k9vDsE7FHjilgwNHKBBBXJv3GUsHeX10if buMTVblFwFmqoRoPn+Jcw3WFfcrtSJDJdrOyjtzQJWY+4ZPNafSeynBCl2D6Ke6yyLPk 3rWeONoE5D3S7Sa+jWUuKj18i7gSvLDNdms6gEAMIkDsf03ifhjtOa2Wow6+jP/+fSYd MqFA== X-Gm-Message-State: AMCzsaWIzqszlRKt/0lUrLAzJnvz8uXAboWn6GjeKBfdrk4HewBqI7yg VT098gyYC3arQmmhCJdEuy1fmEFBShE= X-Received: by 10.80.187.44 with SMTP id y41mr9925820ede.154.1509332171089; Sun, 29 Oct 2017 19:56:11 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id u14sm7856415edd.47.2017.10.29.19.56.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Oct 2017 19:56:10 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dongjiu Geng , stable@vger.kernel.org, Christoffer Dall Subject: [PULL 2/8] arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort Date: Mon, 30 Oct 2017 03:55:57 +0100 Message-Id: <20171030025603.23550-3-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171030025603.23550-1-christoffer.dall@linaro.org> References: <20171030025603.23550-1-christoffer.dall@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dongjiu Geng When a exception is trapped to EL2, hardware uses ELR_ELx to hold the current fault instruction address. If KVM wants to inject a abort to 32 bit guest, it needs to set the LR register for the guest to emulate this abort happened in the guest. Because ARM32 architecture is pipelined execution, so the LR value has an offset to the fault instruction address. The offsets applied to Link value for exceptions as shown below, which should be added for the ARM32 link register(LR). Table taken from ARMv8 ARM DDI0487B-B, table G1-10: Exception Offset, for PE state of: A32 T32 Undefined Instruction +4 +2 Prefetch Abort +4 +4 Data Abort +8 +8 IRQ or FIQ +4 +4 [ Removed unused variables in inject_abt to avoid compile warnings. -- Christoffer ] Cc: Signed-off-by: Dongjiu Geng Tested-by: Haibin Zhang Reviewed-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kvm/emulate.c | 6 ++---- arch/arm64/kvm/inject_fault.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) -- 2.14.2 diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c index 0064b86a2c87..30a13647c54c 100644 --- a/arch/arm/kvm/emulate.c +++ b/arch/arm/kvm/emulate.c @@ -227,7 +227,7 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) u32 return_offset = (is_thumb) ? 2 : 4; kvm_update_psr(vcpu, UND_MODE); - *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) - return_offset; + *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset; /* Branch to exception vector */ *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset; @@ -239,10 +239,8 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) */ static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr) { - unsigned long cpsr = *vcpu_cpsr(vcpu); - bool is_thumb = (cpsr & PSR_T_BIT); u32 vect_offset; - u32 return_offset = (is_thumb) ? 4 : 0; + u32 return_offset = (is_pabt) ? 4 : 8; bool is_lpae; kvm_update_psr(vcpu, ABT_MODE); diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c index da6a8cfa54a0..3556715a774e 100644 --- a/arch/arm64/kvm/inject_fault.c +++ b/arch/arm64/kvm/inject_fault.c @@ -33,12 +33,26 @@ #define LOWER_EL_AArch64_VECTOR 0x400 #define LOWER_EL_AArch32_VECTOR 0x600 +/* + * Table taken from ARMv8 ARM DDI0487B-B, table G1-10. + */ +static const u8 return_offsets[8][2] = { + [0] = { 0, 0 }, /* Reset, unused */ + [1] = { 4, 2 }, /* Undefined */ + [2] = { 0, 0 }, /* SVC, unused */ + [3] = { 4, 4 }, /* Prefetch abort */ + [4] = { 8, 8 }, /* Data abort */ + [5] = { 0, 0 }, /* HVC, unused */ + [6] = { 4, 4 }, /* IRQ, unused */ + [7] = { 4, 4 }, /* FIQ, unused */ +}; + static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) { unsigned long cpsr; unsigned long new_spsr_value = *vcpu_cpsr(vcpu); bool is_thumb = (new_spsr_value & COMPAT_PSR_T_BIT); - u32 return_offset = (is_thumb) ? 4 : 0; + u32 return_offset = return_offsets[vect_offset >> 2][is_thumb]; u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR); cpsr = mode | COMPAT_PSR_I_BIT; From patchwork Mon Oct 30 02:55:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 117437 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2059429qgn; Sun, 29 Oct 2017 19:56:22 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QeCTIqvoc0weL8qkEtgT/WdX04woE/2I2qOYyW582ju15fhoCjzGuCOpBie6IA8Q9/eNSu X-Received: by 10.99.114.5 with SMTP id n5mr6304500pgc.296.1509332182055; Sun, 29 Oct 2017 19:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509332182; cv=none; d=google.com; s=arc-20160816; b=CRvmGlDQkdA03gBsm84WM/WcNRw2zIt7zo827pRQXl8YqZOLu2B1H3dwlFyxDnbpb6 ZqcbdbhvNVRx0IglT0xB2Gb4/JM2ClYqJcq7rBNn2GJ02ov/jFXrUPB/z3AlXV3VYgYY pDaVA+dhifbqoXzUwToaJXYzaxIYB6t1+xKv+y5TJy2vASj0TTWt+sTnlyE3CQxij34n bRzw1iC9BNG+IPrliWK7BObfCBLbk61guvgqWLD4s3h/1biDyBuOXoUNW4kOaWI7byVe SQX021u+nzrYuiBid4TIZwYXl/eBsXIn0Jqw94pzqVONvyIc+bgqHW6G8Su4njRMNpvs GqNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=upAAmI4oE5l9hKQz1yeO+Dr6AQ4HS1sput80PIQfJ3k=; b=vVE7iZJZ/PST8V+Ro1B1pxHJWE/ld1hUVGeCYCu6m6V152yY0073PHK3ccyAk2ugac LOA0145cWopnQRGvLUUmbg5ZJ5MM7pjwjEwAfPR75/0XRtFw62rDluJ7Z9CARdgvlLzk +5u0KcGNg5o7Ie0E5rUAbSa3hP61S/BXzMBJq8eA+r7+MsM71Dd5EftYKCb6ZEQtqiar /lzbj3oq+lUmgib1tGNX/cML6V83iIMT7ZtyWpjf6YLsMmn+faAFTix68OHARUwVAswC 3C6QAHYeei4kwPL0NHgQVjPrvemiM4wBOLENN+B/KRtwP9WcIVPwnDmmIwNTeYjNm9JT fFVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FQD+4Sz9; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 85si9736578pfz.417.2017.10.29.19.56.21; Sun, 29 Oct 2017 19:56:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FQD+4Sz9; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbdJ3C4R (ORCPT + 9 others); Sun, 29 Oct 2017 22:56:17 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55083 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbdJ3C4P (ORCPT ); Sun, 29 Oct 2017 22:56:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id r68so13466545wmr.3 for ; Sun, 29 Oct 2017 19:56:14 -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=upAAmI4oE5l9hKQz1yeO+Dr6AQ4HS1sput80PIQfJ3k=; b=FQD+4Sz9A5hrRoOgX3Eo/upz51W7z3Bx5O/guJxe+Huzg6foxhNHf2Pi+s+4iL81Jf Pv+XgQ23NnT0tV+DT4v/9zqpVfP3ytHspXyqccKootX8REH8NUVP6uE5Uq0YbZmkx6Hh qLYqCpgVbqSQW8MTyOsdgz4AUMbKHUUVwFj+s= 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=upAAmI4oE5l9hKQz1yeO+Dr6AQ4HS1sput80PIQfJ3k=; b=dlVpHjtZ5z1up5CBwL53lDE96PPZN7piRciRVZlGxRAYvtGG8tTYZj9mLsYW72GZRl iIdxIF6sT5IYsBvZrygk0945Ki0IXiFMa9lV6O+0n5C6g+bcJMAFdtAYcOAbA5v/97Ry rlh7kanhL/8pfQjZg/UOo9Hyp0qoXwiMRj8sdk1SI5GQlMbiaTDulBMMVV53QOy+qggt rpqM/y8F5hB4mqyJCX9dcopdvIHdytglnD+pTZnp/F9kOj8kiSpzikD9jHdTTg4ic2SY vko/qtExxiEyp0x/05OhtXwjDga1xOFo5bPmIQ58F0Tkibf+Mwz2JOdfDltwx/UcDp37 8EWQ== X-Gm-Message-State: AMCzsaVgMwtgwuHwnwDJzxN+t2k38/WwnaT0Fl347HAWz3UqF/QZ47Vc TPRKX+xJ1/yvMZIOrk4DH2MgfA== X-Received: by 10.80.182.35 with SMTP id b32mr10095826ede.205.1509332174142; Sun, 29 Oct 2017 19:56:14 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id u14sm7856415edd.47.2017.10.29.19.56.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Oct 2017 19:56:13 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Julien Thierry , Christoffer Dall , Catalin Marinas , Will Deacon , Russell King , stable@vger.kernel.org Subject: [PULL 4/8] arm/arm64: kvm: Disable branch profiling in HYP code Date: Mon, 30 Oct 2017 03:55:59 +0100 Message-Id: <20171030025603.23550-5-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171030025603.23550-1-christoffer.dall@linaro.org> References: <20171030025603.23550-1-christoffer.dall@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Julien Thierry When HYP code runs into branch profiling code, it attempts to jump to unmapped memory, causing a HYP Panic. Disable the branch profiling for code designed to run at HYP mode. Signed-off-by: Julien Thierry Acked-by: Marc Zyngier Cc: Christoffer Dall Cc: Catalin Marinas Cc: Will Deacon Cc: Russell King Cc: Signed-off-by: Christoffer Dall --- arch/arm/kvm/hyp/Makefile | 2 +- arch/arm64/kvm/hyp/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.14.2 diff --git a/arch/arm/kvm/hyp/Makefile b/arch/arm/kvm/hyp/Makefile index 8679405b0b2b..92eab1d51785 100644 --- a/arch/arm/kvm/hyp/Makefile +++ b/arch/arm/kvm/hyp/Makefile @@ -2,7 +2,7 @@ # Makefile for Kernel-based Virtual Machine module, HYP part # -ccflags-y += -fno-stack-protector +ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING KVM=../../../../virt/kvm diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile index 14c4e3b14bcb..48b03547a969 100644 --- a/arch/arm64/kvm/hyp/Makefile +++ b/arch/arm64/kvm/hyp/Makefile @@ -2,7 +2,7 @@ # Makefile for Kernel-based Virtual Machine module, HYP part # -ccflags-y += -fno-stack-protector +ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING KVM=../../../../virt/kvm