From: Jess Frazelle <me@jessfraz.com>
To: kernel-hardening@lists.openwall.com
Cc: Jess Frazelle <me@jessfraz.com>
Subject: [kernel-hardening] [PATCH 1/4] irq: set {msi_domain,syscore}_ops as __ro_after_init
Date: Fri, 10 Feb 2017 02:08:59 -0800 [thread overview]
Message-ID: <20170210100902.11765-2-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.
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.
This protects the data structure from accidental corruption.
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jess Frazelle <me@jessfraz.com>
---
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
kernel/irq/generic-chip.c | 2 +-
kernel/irq/msi.c | 2 +-
kernel/irq/pm.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 6b1cd574644f..0e2c1b5e13b7 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -51,7 +51,7 @@ static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
}
-static struct msi_domain_ops its_fsl_mc_msi_ops = {
+static struct msi_domain_ops its_fsl_mc_msi_ops __ro_after_init = {
.msi_prepare = its_fsl_mc_msi_prepare,
};
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 prev parent reply other threads:[~2017-02-10 10:08 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 ` Jess Frazelle [this message]
2017-02-10 20:26 ` [kernel-hardening] [PATCH 1/4] irq: " 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 ` [kernel-hardening] [PATCH 3/4] x86: " Jess Frazelle
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-2-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.