From patchwork Sat Feb 11 20:23:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9568147 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 EBE636043D for ; Sat, 11 Feb 2017 20:24:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB0A0284F6 for ; Sat, 11 Feb 2017 20:24:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF96928567; Sat, 11 Feb 2017 20:24:09 +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 D81A728558 for ; Sat, 11 Feb 2017 20:24:08 +0000 (UTC) Received: (qmail 18094 invoked by uid 550); 11 Feb 2017 20:24:07 -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 17882 invoked from network); 11 Feb 2017 20:24:04 -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=pyLtNLyR7v7oag4gBG4DQNilMmYtdrBkIFxzbR6T4d8=; b=dFO77RuNPXuWJN61JyICetFc3SB6oqI/SWNbkwzIVBNhldSla2IEMo+OjYeaTUeMq0 U0CpxaRviKNrrA3qyfSZroIwPnNMaKdSd8uIxur79o7YXzPY0w47uo7I5I3poonxT9OA ysrJVulEPuFJs+dpPKZ55+zwbwZRBM3a7Tym0= 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=pyLtNLyR7v7oag4gBG4DQNilMmYtdrBkIFxzbR6T4d8=; b=ageq8ksMyDexlupf2Y103XeYcjGy6icxGfdBQbf2tg/D3qXepWCCz/Hs5CFM9KUtmn O8knO5xlrgajtCFQmWVjIT/frrsHoEAbxMepVkKfYJZqqXGVnWCr0KEQnXgnapsF98hP Zy+DeO2Ag6ayOaw1wwUskXuTbIYB7tqmE8BWFMGCk8KoNU+cRZMgJ2u8L7X0A0RwAftL kCK/FkdpASRaInJlcbbkbtB3AEbjHxrJeIKqxlWBUqkiAU0qI1zqgKNu09nBXebgXnMg 2TLFjSxc/frosarYufPsxhCN7VFF5VSNgUzdx1b9r76XfSdG1rVxPHz7ylHU0qM9H/Ch Nzkg== X-Gm-Message-State: AMke39kqbZwA6IcAmS8i2VKBm93iJ9Mf1Q2lKnWdHHMayytbhTr4gN4boD34AUGqODU+/DaZ X-Received: by 10.28.141.78 with SMTP id p75mr29920256wmd.114.1486844633457; Sat, 11 Feb 2017 12:23:53 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, 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, andre.przywara@arm.com, Suzuki.Poulose@arm.com, james.morse@arm.com, keescook@chromium.org, kernel-hardening@lists.openwall.com, Ard Biesheuvel Date: Sat, 11 Feb 2017 20:23:02 +0000 Message-Id: <1486844586-26135-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486844586-26135-1-git-send-email-ard.biesheuvel@linaro.org> References: <1486844586-26135-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v2 1/5] 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 Signed-off-by: Ard Biesheuvel Reviewed-by: Mark Rutland Tested-by: Mark Rutland --- 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 6440b56ec90e..2f373455ed4e 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: