From patchwork Tue Apr 3 11:09:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 132733 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3666574ljb; Tue, 3 Apr 2018 04:10:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+hODj9fP3v9yQu9UuHyRjowcbGmYaWqydfJ2ozy0Gr+mtOJwtmB/Xx4och0z/4DA9wi6ou X-Received: by 10.98.204.12 with SMTP id a12mr10248007pfg.3.1522753843581; Tue, 03 Apr 2018 04:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522753843; cv=none; d=google.com; s=arc-20160816; b=TktPC2DGxMAozeacYxNS/GjZPzMWLDPzc2H3skN2E9M4emjtkYJfWQ+129Y9V6yBXw 7xgt0qYVR+d9V7DVirtnAMvcLe7phJNxSA4PiTyryHyxsjzKhaI9dJjcyN5OkRGRXqk8 VPKu2iMgaNDhUyfCSj4nlT41zqv9J5arku5T57+Z70qtMei2DI35DkpEijhyTzaXzgJg uqQa1QhL73SXpRiQxSu8SgU2yaWHLaqlZBELZO5Cu9G0oSL5uMWH8xR6tG+ZfEY9lCEM pA8EuQ9aipaT0i0GzyakyHzzVXVSo96K9kHukoQ46ur9ob7AMqa361DXBtKj1xP0v/+d jZlA== 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:arc-authentication-results; bh=f/tI2dYzkiSlxD+EVxQqHQPi9ilezdvGnes4ReF8T64=; b=ZTn76l7Qd+HpKXDmAPaYdh77+uxEY0P32uNEAiODizgYJn7APiPPGWxRBk3rokS2ST Y0j25msn7+y77D6LQF8Q7W+XXapvi+DDV86wVXizAjKS3dtXiKOKdhZxtk0CwkxkcnbW i5QBpfHsPULtCgq6boCjcKWTAZe4lbrisGnEslQe9VpQFBNdCzUZuEYye03Gy8SpuVz/ FpMqy6dxy/D/CK5xnrr2aKctt6Oobe3aBThbavn43lnUOfIrGoJXgr33pTWj9fZBjAc9 78agSFu7tz8WbUb9Tl1sBTC8xmikVm2ulK7TBnjwvevGTIP8kgS2rgYg9V5up1drkQzP jrrQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9-v6si295691plr.273.2018.04.03.04.10.43; Tue, 03 Apr 2018 04:10:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755270AbeDCLKl (ORCPT + 11 others); Tue, 3 Apr 2018 07:10:41 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59438 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755516AbeDCLKj (ORCPT ); Tue, 3 Apr 2018 07:10:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 040B81435; Tue, 3 Apr 2018 04:10:39 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C7B013F587; Tue, 3 Apr 2018 04:10:37 -0700 (PDT) From: Mark Rutland To: stable@vger.kernel.org Cc: mark.brown@linaro.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com Subject: [PATCH v4.9.y 27/27] arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives Date: Tue, 3 Apr 2018 12:09:23 +0100 Message-Id: <20180403110923.43575-28-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180403110923.43575-1-mark.rutland@arm.com> References: <20180403110923.43575-1-mark.rutland@arm.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon commit 439e70e27a51 upstream. The identity map is mapped as both writeable and executable by the SWAPPER_MM_MMUFLAGS and this is relied upon by the kpti code to manage a synchronisation flag. Update the .pushsection flags to reflect the actual mapping attributes. Reported-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Alex Shi [v4.9 backport] Signed-off-by: Mark Rutland [v4.9 backport] --- arch/arm64/kernel/cpu-reset.S | 2 +- arch/arm64/kernel/head.S | 2 +- arch/arm64/kernel/sleep.S | 2 +- arch/arm64/mm/proc.S | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) -- 2.11.0 diff --git a/arch/arm64/kernel/cpu-reset.S b/arch/arm64/kernel/cpu-reset.S index 65f42d257414..f736a6f81ecd 100644 --- a/arch/arm64/kernel/cpu-reset.S +++ b/arch/arm64/kernel/cpu-reset.S @@ -16,7 +16,7 @@ #include .text -.pushsection .idmap.text, "ax" +.pushsection .idmap.text, "awx" /* * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 539bebc1222f..fa52817d84c5 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -473,7 +473,7 @@ ENDPROC(__primary_switched) * end early head section, begin head code that is also used for * hotplug and needs to have the same protections as the text region */ - .section ".idmap.text","ax" + .section ".idmap.text","awx" ENTRY(kimage_vaddr) .quad _text - TEXT_OFFSET diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S index 1bec41b5fda3..0030d6964e65 100644 --- a/arch/arm64/kernel/sleep.S +++ b/arch/arm64/kernel/sleep.S @@ -95,7 +95,7 @@ ENTRY(__cpu_suspend_enter) ret ENDPROC(__cpu_suspend_enter) - .pushsection ".idmap.text", "ax" + .pushsection ".idmap.text", "awx" ENTRY(cpu_resume) bl el2_setup // if in EL2 drop to EL1 cleanly bl __cpu_setup diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 5c268f5767b4..c07d9cc057e6 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -83,7 +83,7 @@ ENDPROC(cpu_do_suspend) * * x0: Address of context pointer */ - .pushsection ".idmap.text", "ax" + .pushsection ".idmap.text", "awx" ENTRY(cpu_do_resume) ldp x2, x3, [x0] ldp x4, x5, [x0, #16] @@ -147,7 +147,7 @@ alternative_else_nop_endif ret ENDPROC(cpu_do_switch_mm) - .pushsection ".idmap.text", "ax" + .pushsection ".idmap.text", "awx" .macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2 adrp \tmp1, empty_zero_page @@ -180,7 +180,7 @@ ENDPROC(idmap_cpu_replace_ttbr1) .popsection #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 - .pushsection ".idmap.text", "ax" + .pushsection ".idmap.text", "awx" .macro __idmap_kpti_get_pgtable_ent, type dc cvac, cur_\()\type\()p // Ensure any existing dirty @@ -368,7 +368,7 @@ ENDPROC(idmap_kpti_install_ng_mappings) * Initialise the processor for turning the MMU on. Return in x0 the * value of the SCTLR_EL1 register. */ - .pushsection ".idmap.text", "ax" + .pushsection ".idmap.text", "awx" ENTRY(__cpu_setup) tlbi vmalle1 // Invalidate local TLB dsb nsh