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: 9603983 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 5C7C360453 for ; Sat, 4 Mar 2017 14:32:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D4FF28503 for ; Sat, 4 Mar 2017 14:32:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40FB928589; Sat, 4 Mar 2017 14:32:38 +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 D62E328503 for ; Sat, 4 Mar 2017 14:32:37 +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=eDwPmyguEAlrYfArZMBGKhGG31 iw0INi6KbGNwFNxcW5vxpMUNIcW6WepzSG+rTqMZrxMYsXhmDWYziTklXqElpYelYO+O6FN0uss0G Z1+koU97mcJ/LRpXMAW56ZUKixaLHTHfmgfJRk8K/+4y5fWyvsDynh0F4wJ6sS5yi/DAf4nJHNq5u D8oC39/Gs7bRQwDw5YGBB/3+8+AbAf42fUAnJZA6RTEG8ld4UtuodFTtx6Ao8XOpv2u+htqgCoFi/ HcSTroGL9N1waq9oLXnIkra++OaKFxIXj9uYJixMi1MFwWmKn0zxaQSRINAsDUfEhHebON4vje9oB 6ojPxJKA==; 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 1ckAjd-0002in-Kv; Sat, 04 Mar 2017 14:32:37 +0000 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ckAik-0002Qd-O0 for linux-arm-kernel@lists.infradead.org; Sat, 04 Mar 2017 14:31:44 +0000 Received: by mail-wr0-x22e.google.com with SMTP id u48so90309711wrc.0 for ; Sat, 04 Mar 2017 06:31:22 -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=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=F9i87l39Wa2MIvW4Py5hJV1Qq723js7H6Kqars/kQZeQHRkp0EArcAUg0HFfaLVXzU oO0Rj3vDGD/Skl4lQPq7JGNsF7r3n8TL0+3/3RDZMjhKu8GlJhwvRpq62/hE5AujgjGm lr21K/gjN837w0O4VxtiEpoq98PoCifaF0El+fYVRROgqx9tfKyGozqCus59zPkdpbX1 wlPhJ422tBmpdRdeQCjqFsbNSyGWBDUyrHMOedD754upXJyQhGyo5rTVIJQgsF7xyyup s+yAlbw+zglz3RarS5rD/TvngWXLtx6pR6offRT4e91nFICHw1Zj//6POurAnt5yCbr7 A5OQ== X-Gm-Message-State: AMke39kMGhuAaU2N8qOZjqeQdBWnMqIZvCrxkkRYW3G1EZVgBfu02iPRFL2j0sVDNZ3f3iNh X-Received: by 10.223.136.33 with SMTP id d30mr7650791wrd.117.1488637880732; Sat, 04 Mar 2017 06:31:20 -0800 (PST) Received: from localhost.localdomain ([197.130.214.201]) by smtp.gmail.com with ESMTPSA id c35sm19497267wra.1.2017.03.04.06.31.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); 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 Subject: [PATCH v4 1/6] arm: kvm: move kvm_vgic_global_state out of .text section 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170304_063142_935369_D0212C7B X-CRM114-Status: UNSURE ( 9.83 ) 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: keescook@chromium.org, suzuki.poulose@arm.com, marc.zyngier@arm.com, andre.przywara@arm.com, Ard Biesheuvel , james.morse@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: