All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jess Frazelle <me@jessfraz.com>
To: kernel-hardening@lists.openwall.com
Cc: Jess Frazelle <me@jessfraz.com>
Subject: [kernel-hardening] [PATCH 3/4] x86: set msi_domain_ops as __ro_after_init
Date: Fri, 10 Feb 2017 02:09:01 -0800	[thread overview]
Message-ID: <20170210100902.11765-4-me@jessfraz.com> (raw)
In-Reply-To: <20170210100902.11765-1-me@jessfraz.com>

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 <keescook@chromium.org>
Signed-off-by: Jess Frazelle <me@jessfraz.com>
---
 arch/x86/kernel/apic/msi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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,
--
2.11.0

  parent reply	other threads:[~2017-02-10 10:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 10:08 [kernel-hardening] [PATCH 0/4] set {msi_domain,syscore}_ops as __ro_after_init Jess Frazelle
2017-02-10 10:08 ` [kernel-hardening] [PATCH 1/4] irq: " Jess Frazelle
2017-02-10 20:26   ` Laura Abbott
2017-02-10 20:34     ` Jessica Frazelle
2017-02-10 21:55   ` Kees Cook
2017-02-10 22:02     ` Jessica Frazelle
2017-02-10 23:15       ` Kees Cook
2017-02-10 10:09 ` [kernel-hardening] [PATCH 2/4] pci: set msi_domain_ops " Jess Frazelle
2017-02-10 10:09 ` Jess Frazelle [this message]
2017-02-10 10:09 ` [kernel-hardening] [PATCH 4/4] time: mark syscore_ops " Jess Frazelle
2017-02-10 13:40   ` Rik van Riel
2017-02-10 10:23 ` [kernel-hardening] [PATCH 0/4] set {msi_domain,syscore}_ops " Anisse Astier
2017-02-10 10:25   ` Jessica Frazelle
2017-02-10 20:27 ` Laura Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170210100902.11765-4-me@jessfraz.com \
    --to=me@jessfraz.com \
    --cc=kernel-hardening@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.