From patchwork Thu Mar 9 08:25:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9612647 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 10285602B4 for ; Thu, 9 Mar 2017 08:25:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBF2F28585 for ; Thu, 9 Mar 2017 08:25:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C531A285A5; Thu, 9 Mar 2017 08:25:50 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 73D3428585 for ; Thu, 9 Mar 2017 08:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5hN1v2spXkHJaJrD0UBG3d5l88meHb71emgQI4YE6BY=; b=jPtKHFlqc+1wx+HULK4KvqvtSo 7EMx4lgigauCmLZNSiK6Lsp3XM9SpPS0hex5GQ4ZtT8DGSdCWcE8V4Hv8p9fvFfaZN8xRfCXkMfis WeT1JspAcdfdmi43t+pGHOyWmu+lP5mLBeELoxe1rbD/KdQuhWjYpEGG678TQBNuS0HUCgXW88wcy /BhCtk61QzFbaVRHNdKSMjo0pzsJddGrMC+U3g0HIjb4vszflN3YLphNq+Gs9GtkpQPUCGFO3lP7Z ZIbon0XgvgQouJEnD23qH82o+kv7VV5AwQhuxENE0IxWJXKAB8gMIBnP/1Tqvy0P6g63e32cdJW2/ WmMW4AFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cltOQ-00035f-96; Thu, 09 Mar 2017 08:25:50 +0000 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cltOM-00032R-Bs for linux-arm-kernel@lists.infradead.org; Thu, 09 Mar 2017 08:25:48 +0000 Received: by mail-wr0-x232.google.com with SMTP id g10so39658796wrg.2 for ; Thu, 09 Mar 2017 00:25:25 -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=Y1k1//Y5TDua1AYYvdtj9WAVwtOv73TA3hOSPqi/8ZU=; b=Ppu+0cdjWjY8eEgB2lr+Yu8qga/h4fUThNLSMBpbmmt6j2BBithezsTYmBcgaGFfE/ 1CaoM1zFIxLuohE+yxzzYaaW+uxYdeUbdO8Lo3k7xzt0/ATKH6lT8uyrfkrlyQgqVm9z T61dD4fxk58lFTh5bMUl34jlEZRhQEpokFZAY= 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=q470v1eSdqtEbHlXrI0LRPq9qOqdKtsyizo9CDSDEGMUwgBKgOL+O7Cs/9CkSwMBYS pn8tHQyEHPNq4ou3PFsgl9DKeOwwWlS9oEmih0KJ94vdGJtoYN/jcrzFzTdFc/yG2vNS sdJ22CtpACqOT2eDJNEKwD+FEGZB3hshXE9JhAn4kaTr35aM5cLoZIcK5+HPYlI2Q/bf yTYuiCOIzJXzZxWFvjwnJEELDNLb1GmlhSf8dZeDR4NCGK3/GhATI1WeoJ9MquJGnTwl Xlxyo3nL29jnUB3IIJTbUdXE/xrQBlPTVf/YcST0JR5jww3/c+i0MCoe2RxFJSeAZUxs ocXA== X-Gm-Message-State: AMke39mlqwXE5rrIRJK7gopz0VLQpCxlauWjaocdUS3ZMtuYkfECw8HT0gLcW9rF6ypOAHd1 X-Received: by 10.223.148.230 with SMTP id 93mr10098527wrr.111.1489047924584; Thu, 09 Mar 2017 00:25:24 -0800 (PST) Received: from ards-macbook-pro.c.hoisthospitality.com ([109.74.48.129]) by smtp.gmail.com with ESMTPSA id w207sm7804194wmw.1.2017.03.09.00.25.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 00:25:23 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, keescook@chromium.org, labbott@fedoraproject.org Subject: [PATCH v5 01/10] arm: kvm: move kvm_vgic_global_state out of .text section Date: Thu, 9 Mar 2017 09:25:03 +0100 Message-Id: <1489047912-642-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489047912-642-1-git-send-email-ard.biesheuvel@linaro.org> References: <1489047912-642-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_002546_555329_059C74CD X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , marc.zyngier@arm.com, catalin.marinas@arm.com, kernel-hardening@lists.openwall.com, will.deacon@arm.com, kvmarm@lists.cs.columbia.edu MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: