From patchwork Wed Feb 28 03:56:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 129913 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp569931lja; Tue, 27 Feb 2018 20:01:15 -0800 (PST) X-Google-Smtp-Source: AH8x224swO4iao4HUVwJZkPL6A+K4BEk6DNc1jGpNKFV9dvnIM6Cbk6tKlzmBUJZnrbOytqRoOYS X-Received: by 10.99.61.75 with SMTP id k72mr12732477pga.384.1519790475487; Tue, 27 Feb 2018 20:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519790475; cv=none; d=google.com; s=arc-20160816; b=0Z2TIEigeSvXSvXbtNAcBRWi5dRNxtQZuNyY0N7+H7fgSGQTous/aIaBekIoPCcjYt FCg1Rjl3S0TAUhFXAUDRJ5+WJkgETa9uAoNLe04bb9F3D6zK3cMs6M+sNfjM6VLxeJcS ZvG3pSYp6NP0hNtTodZZnkDwe4HrdVhU2uBUVLfQssLquJ7Uxl8td5yI4poym5pFGrW+ o1fMQsy6Wq8iEbF7d3piHBP07SRq5A6kFuK2zE1tjKuGov90Eju+Zwl9SzIH4Ha9i91n DXVEDq80eq8Wr+XoW9GPTMlyfRDjTPnCrvtaDI88az45OkDi6zwDao1Jtbm0ThpWLSHw b57A== 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=bmODirOIrB4Uq31RHiBfVSkaHJATLnMI0vQEAhunKG8=; b=W03fbo2MsOosTqq8OxkWGBU81T9b5IqkNctmuZARUWCqrI5qXjGlBp8oGw84a+pwJJ wD74MLCJhXJkRHzIrFyj2sfns9Gc9Ta1ztMEY+Z2iay0QciwDWFJK1SKnuMK2cAZmNB6 Jc27scO2oBZb2tNgDvjVMtZDsyPeeHENF/lk6mhUnOJ3QZTYADyvCggY1NMs+2WdBWcN exqFhKxIHH3auPS9/N6jclBSKL9s9iVFgRBgCiVcOmzBuQrZQmdBNDr9NX1bciAcW0eT 4gNm65v6hClczDjFqVQGhK6nx3JfEWKFrYjZ3SCjB10GRsWLLWgfUSdguaA9Vvw92eq0 2iqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OFGVOi3h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 c5-v6si604191pll.90.2018.02.27.20.01.15; Tue, 27 Feb 2018 20:01:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=OFGVOi3h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1752461AbeB1EBM (ORCPT + 28 others); Tue, 27 Feb 2018 23:01:12 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:46724 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752235AbeB1EBK (ORCPT ); Tue, 27 Feb 2018 23:01:10 -0500 Received: by mail-pg0-f66.google.com with SMTP id r26so480310pgv.13 for ; Tue, 27 Feb 2018 20:01:10 -0800 (PST) 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=bmODirOIrB4Uq31RHiBfVSkaHJATLnMI0vQEAhunKG8=; b=OFGVOi3he6LzbyCn520fy0htDXYWk4kbNgIkyA8pCCclqXIPvz0RdVaYJZUfuMjKOP pSO0DUNMTxa1Z6BfQfxCctG2TL/hpA87CwrHZKXJUkkuf4bUk1QP9XwypRJWvzYFZEyR waXAonKRxDizWyqDhU4oyjXBQNKTBjUZJQuWI= 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=bmODirOIrB4Uq31RHiBfVSkaHJATLnMI0vQEAhunKG8=; b=binrZ7uEZf1lkmoA3QVNwvA3sjtTKyZO0mkmm2ZwZ6H3LbWRpd2Y4C035EZvDwDl0p ZP8KtPwOVHDtQR7tZmAifFQbkflluoWiGF0102pkQtwniFMuRh8FTgleSC/k0ukFH47j 7e/8VnUOeNV2GkLAN1OcCADI7JgoMhK2myuc1uuBz+Xe1FvGEjB57+/ocKQXJMEFd1uW 6oTjEnFdx/zEdaKampsmif+1fU2lPF4dsQGDleO19BcJy5GJQDHwgCMJamSDo0fAUsV1 +qwnopD9ZNOEB3RSIsmS4v770B0KbF10r44QhqAv6DPF7X6hh5zIzYC8T+VjGiksmPMn 1osw== X-Gm-Message-State: APf1xPCQij4wR393IvaYUidSk2vazIDiKDDZaRauuXqHMEzuh1OBGnhW 82S0jLtS+2wUM6Dv6Y6tsCAXSBAhYh8= X-Received: by 10.98.202.138 with SMTP id y10mr16237682pfk.184.1519790469719; Tue, 27 Feb 2018 20:01:09 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id q17sm739911pgt.7.2018.02.27.20.01.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 20:01:09 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alex Shi Subject: [PATCH 29/29] arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives Date: Wed, 28 Feb 2018 11:56:51 +0800 Message-Id: <1519790211-16582-30-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519790211-16582-1-git-send-email-alex.shi@linaro.org> References: <1519790211-16582-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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.7.4 diff --git a/arch/arm64/kernel/cpu-reset.S b/arch/arm64/kernel/cpu-reset.S index 65f42d2..f736a6f 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 539bebc..fa52817 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 1bec41b..0030d69 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 5c268f5..c07d9cc 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