From patchwork Fri Feb 10 17:16:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9567147 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 65A63601EA for ; Fri, 10 Feb 2017 17:17:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5591A27B81 for ; Fri, 10 Feb 2017 17:17:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A03627F9E; Fri, 10 Feb 2017 17:17:11 +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 9463427B81 for ; Fri, 10 Feb 2017 17:17:10 +0000 (UTC) Received: (qmail 7229 invoked by uid 550); 10 Feb 2017 17:17:08 -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 5930 invoked from network); 10 Feb 2017 17:17:06 -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=pRoWT5V1O1r+GTxCJkl8SL/iDXgb728Q2mxxFEQVYHo=; b=fLJZKO+ZZN1Xagp1Lc3M+V6ATF1T5nACcU4ObxIgoPjK80AeZfe0NKCd/JoxpRJO/d KT94c5lM2LJ7O+P5FgZBbSoF8jUNLUXK5jX1U+eDhlTERGkN2+LeK1GGI1hiYethJwEq 6e6amWzPeB6WsGD0juBMkIyv8RPqdE4LfkUFM= 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=pRoWT5V1O1r+GTxCJkl8SL/iDXgb728Q2mxxFEQVYHo=; b=a98o3SUJzjtSa4GWhoUub5pJbd+IeZtfjgiKanmku+CDcqz/OHCRFkigz/cSb1LVeG hYIp/IM3beM81Xq69RuwUoz0pvbGIk8ZLYSHe5qvLOE2pKfJXJGQOAq7TpVs5p7orIUs pno1a24B3GpXHW+/H5tr+GxCX96mwCCcFj5RU8V30CHXaCf+WdDU3mupKQ/VyndHnm15 37wGAFVu/wXsxXGjfJNIHenUny8P585VmYebIeWoFN6/eege1BYqamE1hzxGfeZYI5V5 4HGFnKmx5pxaLdP+5DYSU0/wgG/6oVap5HMZ75GNeWO+pIKvdQ+hMo51azY68HznKT0L dqeg== X-Gm-Message-State: AMke39mOfwXRK4Qi/fg2VrzNT+dXPp/E4LEBhqDD+nS+yntAgG2qDQbCjOHiTuF4x9ea97n7 X-Received: by 10.223.151.138 with SMTP id s10mr8458653wrb.65.1486747013837; Fri, 10 Feb 2017 09:16:53 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, keescook@chromium.org, labbott@fedoraproject.org, james.morse@arm.com Cc: kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, christoffer.dall@linaro.org, kernel-hardening@lists.openwall.com, andre.przywara@arm.com, Ard Biesheuvel Date: Fri, 10 Feb 2017 17:16:42 +0000 Message-Id: <1486747005-15973-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486747005-15973-1-git-send-email-ard.biesheuvel@linaro.org> References: <1486747005-15973-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH 1/4] 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. Signed-off-by: Ard Biesheuvel Acked-by: Marc Zyngier --- 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: