From patchwork Sat Mar 4 14:30:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9603971 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 2BA6C60453 for ; Sat, 4 Mar 2017 14:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D19628503 for ; Sat, 4 Mar 2017 14:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 113AA28589; Sat, 4 Mar 2017 14:31:41 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 27D5C28503 for ; Sat, 4 Mar 2017 14:31:39 +0000 (UTC) Received: (qmail 16162 invoked by uid 550); 4 Mar 2017 14:31:38 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 15626 invoked from network); 4 Mar 2017 14:31:32 -0000 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=Y1k1//Y5TDua1AYYvdtj9WAVwtOv73TA3hOSPqi/8ZU=; b=ZToXEnmcBNqm7Av3z06aeC6ApV0F0gAaIaCn754qBDO0IM62/NkCxPDcAo02F4A8Qe TFXHznUEvEjzBDu7cBGozS9Che1ay6bPm0iMM+/iXcQipFhakwBUk7B55S4yqDlmca3H y6uAKlifFpNi6ofibSRowMl/pVJwYVYiWuuhw= 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=Y1k1//Y5TDua1AYYvdtj9WAVwtOv73TA3hOSPqi/8ZU=; b=SsGdreaS3UfjbouiYnpliPQKipDbCf0n/5wO5uxU0AMKXWN8R/c1sOjniuPvqP1BrY O6WblcXTfNgJEwC3/vlsQUb/TrEdnY9DuuxlaXHAFmWfnRRZ6wQnN0JS6TnvUQzIDVVY Myb6CmseZsfpPzlNwbS9JzE/ffB3l+07gBq8Y4MeAzq4ELkRswK1VCdfFCApjJFV34eD MVeX/hxaT7e10YyR3IMnnPp6rrtf8zJwK9URjLVYU72x/cu8rmHjyPcmGyyw58ijNle4 GsZY26t4XB8mJuupFczW0Q2LMeMDQSKAVWzAwNK07SryFauhT/0aymkGqod0psbL8sJH 9g7g== X-Gm-Message-State: AMke39mFP/5ZSuU2/L0EiFnAo8JfDUSBf/NnUw+ZXaq9dYXpwqTP0zm2eREtaszi359V3lac X-Received: by 10.223.136.33 with SMTP id d30mr7650791wrd.117.1488637880732; Sat, 04 Mar 2017 06:31:20 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, labbott@fedoraproject.org Cc: kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, keescook@chromium.org, andre.przywara@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, Ard Biesheuvel Date: Sat, 4 Mar 2017 14:30:43 +0000 Message-Id: <1488637848-13588-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488637848-13588-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488637848-13588-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v4 1/6] arm: kvm: move kvm_vgic_global_state out of .text section X-Virus-Scanned: ClamAV using ClamSMTP The kvm_vgic_global_state struct contains a static key which is written to by jump_label_init() at boot time. So in preparation of making .text regions truly (well, almost truly) read-only, mark kvm_vgic_global_state __ro_after_init so it moves to the .rodata section instead. Acked-by: Marc Zyngier Reviewed-by: Laura Abbott Reviewed-by: Mark Rutland Tested-by: Mark Rutland Signed-off-by: Ard Biesheuvel --- virt/kvm/arm/vgic/vgic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 654dfd40e449..7713d96e85b7 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -29,7 +29,9 @@ #define DEBUG_SPINLOCK_BUG_ON(p) #endif -struct vgic_global __section(.hyp.text) kvm_vgic_global_state = {.gicv3_cpuif = STATIC_KEY_FALSE_INIT,}; +struct vgic_global kvm_vgic_global_state __ro_after_init = { + .gicv3_cpuif = STATIC_KEY_FALSE_INIT, +}; /* * Locking order is always: