From: Jess Frazelle <me@jessfraz.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Marc Zyngier <marc.zyngier@arm.com>,
linux-kernel@vger.kernel.org (open list:IRQ SUBSYSTEM)
Cc: kernel-hardening@lists.openwall.com, Jess Frazelle <me@jessfraz.com>
Subject: [PATCH v2 1/5] irq: set {msi_domain,syscore}_ops as __ro_after_init
Date: Fri, 10 Feb 2017 17:37:54 -0800 [thread overview]
Message-ID: <20170211013758.3288-1-me@jessfraz.com> (raw)
Marked msi_domain_ops structs as __ro_after_init when called only during init.
Marked syscore_ops structs as __ro_after_init when register_syscore_ops was
called only during init. Most of the caller functions were already annotated as
__init.
unregister_syscore_ops() was never called on these syscore_ops.
This protects the data structure from accidental corruption.
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jess Frazelle <me@jessfraz.com>
---
kernel/irq/generic-chip.c | 2 +-
kernel/irq/msi.c | 2 +-
kernel/irq/pm.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index ee32870079c9..cca63dbaabea 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -623,7 +623,7 @@ static void irq_gc_shutdown(void)
}
}
-static struct syscore_ops irq_gc_syscore_ops = {
+static struct syscore_ops irq_gc_syscore_ops __ro_after_init = {
.suspend = irq_gc_suspend,
.resume = irq_gc_resume,
.shutdown = irq_gc_shutdown,
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index ee230063f033..0e5b723f710f 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -217,7 +217,7 @@ static int msi_domain_ops_check(struct irq_domain *domain,
return 0;
}
-static struct msi_domain_ops msi_domain_ops_default = {
+static struct msi_domain_ops msi_domain_ops_default __ro_after_init = {
.get_hwirq = msi_domain_ops_get_hwirq,
.msi_init = msi_domain_ops_init,
.msi_check = msi_domain_ops_check,
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index cea1de0161f1..d6b889bed323 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -185,7 +185,7 @@ static void irq_pm_syscore_resume(void)
resume_irqs(true);
}
-static struct syscore_ops irq_pm_syscore_ops = {
+static struct syscore_ops irq_pm_syscore_ops __ro_after_init = {
.resume = irq_pm_syscore_resume,
};
--
2.11.0
next reply other threads:[~2017-02-11 1:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-11 1:37 Jess Frazelle [this message]
2017-02-11 1:37 ` [PATCH v2 2/5] time: mark syscore_ops as __ro_after_init Jess Frazelle
2017-02-11 2:12 ` John Stultz
2017-02-11 9:23 ` Thomas Gleixner
2017-02-11 1:37 ` [PATCH v2 3/5] pci: set msi_domain_ops " Jess Frazelle
2017-02-12 4:08 ` KY Srinivasan
2017-02-13 18:14 ` Keith Busch
2017-02-15 20:33 ` Bjorn Helgaas
2017-02-15 20:46 ` Kees Cook
2017-02-15 21:16 ` Thomas Gleixner
2017-02-16 14:35 ` Bjorn Helgaas
2017-02-16 14:38 ` Thomas Gleixner
2017-03-07 19:07 ` Bjorn Helgaas
2017-03-14 18:50 ` Jessica Frazelle
2017-03-14 19:24 ` Bjorn Helgaas
2017-02-11 1:37 ` [PATCH v2 4/5] staging: " Jess Frazelle
2017-02-11 1:37 ` [PATCH v2 5/5] x86: " Jess Frazelle
2017-02-11 9:14 ` [PATCH v2 1/5] irq: set {msi_domain,syscore}_ops " Thomas Gleixner
2017-02-11 9:23 ` Thomas Gleixner
2017-02-11 10:48 ` Jess Frazelle
2017-02-11 12:00 ` Thomas Gleixner
2017-02-11 12:17 ` Jessica Frazelle
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=20170211013758.3288-1-me@jessfraz.com \
--to=me@jessfraz.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox