From patchwork Fri Feb 10 10:09:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9566403 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 3C14C601C3 for ; Fri, 10 Feb 2017 10:09:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28FCE28540 for ; Fri, 10 Feb 2017 10:09:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CBBD28556; Fri, 10 Feb 2017 10:09:51 +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 02F1B28540 for ; Fri, 10 Feb 2017 10:09:49 +0000 (UTC) Received: (qmail 24472 invoked by uid 550); 10 Feb 2017 10:09:44 -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 24368 invoked from network); 10 Feb 2017 10:09:41 -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=W6fwInTK97eK35KiZiTF4UP3r/jA89zVBEtUNS/hYrjZ3Skf1vVF10uyVCXr6yKj2I ofTm57SyfA4TzxdDTZ8XEVBzTrcWnjqAHHj4l0c2LArhcb2CyIX7BIMDHhdaZR/UBf0G me0jdQy9ZCD55Fha3PkEEQcjLF4hiCrg7nEIs= 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=V79LhJnaW7KSNUIyfrGwkldaKTvdmVI5CM1OUWv1BhRd35O9FQe7O5P9BMOWATWvnd HlIEKGjO8wOB8zPJhurU19Kgj71pPq4tyQRxLbg4zOrQoQu9iOU9vfC9A5dyf/dpFXTL gSa/z/I/B+B1p8PakVk1tjQCJU1QCC1fSC1WuSQG1gJMGQ6whaFz9WvnqRgMt3CkTkc8 3Na7YMMYhfLi5InD/WKWYrYrr48d0aL9yGPFyc10tH/m7iRECXdX3MdN2CEt7nfJZOgJ Tgpx9F8fVstbWHlEmnKoKvZ5OD24unEgLNJO/bubM2n2ezRdLafES7s6qRZmC1QeaNIJ QKqQ== X-Gm-Message-State: AMke39mjyoER8NWlbdxmDYnAywA+hfYoH1RgXVj6M9AAK3fN1gHoQTPWEJm23EzikKSdzG0I X-Received: by 10.98.14.84 with SMTP id w81mr9242741pfi.168.1486721369670; Fri, 10 Feb 2017 02:09:29 -0800 (PST) From: Jess Frazelle To: kernel-hardening@lists.openwall.com Cc: Jess Frazelle Date: Fri, 10 Feb 2017 02:09:01 -0800 Message-Id: <20170210100902.11765-4-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210100902.11765-1-me@jessfraz.com> References: <20170210100902.11765-1-me@jessfraz.com> Subject: [kernel-hardening] [PATCH 3/4] 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,