From patchwork Sat Feb 11 01:37:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9567707 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 39DC460572 for ; Sat, 11 Feb 2017 01:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 285FB285C1 for ; Sat, 11 Feb 2017 01:39:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D320285DA; Sat, 11 Feb 2017 01:39:03 +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 49CEE285C1 for ; Sat, 11 Feb 2017 01:39:02 +0000 (UTC) Received: (qmail 26606 invoked by uid 550); 11 Feb 2017 01:39:00 -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 26585 invoked from network); 11 Feb 2017 01:39:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jessfraz.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DnJzPc4/fGNZL2MBo09bEWJ/47Hcr+Ase3NFBZZHewA=; b=QFb2RSJdLj6zRainhxpAj1gmy3EhQMQJm/AoaNmmYQtIeGt0amdkuICfNQcFSFudCH /NomXSLbgbZT3nCYA7rs2c5kNOXm8dYdVztsGgodrjsBLLjWwH6c59gWdeyi7PGHakUI XzFH/lNk+kQzh+8LYBQbzsfmoZElqUCHUhj1Q= 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=DnJzPc4/fGNZL2MBo09bEWJ/47Hcr+Ase3NFBZZHewA=; b=EgCLFQ4ZlsrOoikKF5etboUrJkrNFcGPdIx1V15j+OY/2qDjlUNtq4sTt9jezUb/iw MiwTFTf1latwLirjmEATU08/PAWzMYLCmZZn3Zjh9nlAujXYBsv1VelE1rKwB8/3KzbJ XKFuAm8jdFldOrtul+GW5iEojTOaTY91dNRC0LWOjhAd9bQx0J7QP9BouMcNQNoFs2Ln mCOH/3z2aBMp1zgXSy6VhM4iOk8+o4NdJ1/fCd7DUPhNSgRlrseWvJUEa/wZCayZW6Gl Okb9PEhAUsxLKhWOEau6wgqq4UlPZTexYDVrdFYHzz4DTRsD4R13dBNCz+ANSbBpvKOw KGHw== X-Gm-Message-State: AMke39lFFGJceg9fJiW2UHrIr4VbQxA3SW7nDP6FqO7wslAA/SwYzGTYEPQythedmPg75x+D X-Received: by 10.99.100.3 with SMTP id y3mr14238704pgb.36.1486777128509; Fri, 10 Feb 2017 17:38:48 -0800 (PST) From: Jess Frazelle To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Jess Frazelle , Kees Cook , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Cc: kernel-hardening@lists.openwall.com Date: Fri, 10 Feb 2017 17:37:58 -0800 Message-Id: <20170211013758.3288-5-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170211013758.3288-1-me@jessfraz.com> References: <20170211013758.3288-1-me@jessfraz.com> Subject: [kernel-hardening] [PATCH v2 5/5] x86: set msi_domain_ops as __ro_after_init X-Virus-Scanned: ClamAV using ClamSMTP Marked msi_domain_ops structs as __ro_after_init when called only during init. This protects the data structure from accidental corruption. Suggested-by: Kees Cook Signed-off-by: Jess Frazelle --- arch/x86/kernel/apic/msi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 015bbf30e3e3..27783a1e7166 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -121,7 +121,7 @@ void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) } EXPORT_SYMBOL_GPL(pci_msi_set_desc); -static struct msi_domain_ops pci_msi_domain_ops = { +static struct msi_domain_ops pci_msi_domain_ops __ro_after_init = { .get_hwirq = pci_msi_get_hwirq, .msi_prepare = pci_msi_prepare, .set_desc = pci_msi_set_desc, @@ -207,7 +207,7 @@ static int dmar_msi_init(struct irq_domain *domain, return 0; } -static struct msi_domain_ops dmar_msi_domain_ops = { +static struct msi_domain_ops dmar_msi_domain_ops __ro_after_init = { .get_hwirq = dmar_msi_get_hwirq, .msi_init = dmar_msi_init, }; @@ -304,7 +304,7 @@ static void hpet_msi_free(struct irq_domain *domain, irq_clear_status_flags(virq, IRQ_MOVE_PCNTXT); } -static struct msi_domain_ops hpet_msi_domain_ops = { +static struct msi_domain_ops hpet_msi_domain_ops __ro_after_init = { .get_hwirq = hpet_msi_get_hwirq, .msi_init = hpet_msi_init, .msi_free = hpet_msi_free,