public inbox for kernel-hardening@lists.openwall.com
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jess Frazelle <me@jessfraz.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	"open list:IRQ SUBSYSTEM" <linux-kernel@vger.kernel.org>,
	kernel-hardening@lists.openwall.com
Subject: [kernel-hardening] Re: [PATCH v2 1/5] irq: set {msi_domain,syscore}_ops as __ro_after_init
Date: Sat, 11 Feb 2017 13:00:16 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1702111222340.3734@nanos> (raw)
In-Reply-To: <DF37E0AB-7310-4D1C-A710-7A7EA60498E7@jessfraz.com>

On Sat, 11 Feb 2017, Jess Frazelle wrote:
> On February 11, 2017 1:14:52 AM PST, Thomas Gleixner <tglx@linutronix.de> wrote:
> >The same is true for cpuhotunplug operations.
> 
> This makes sense. Will remove.

That's true for all other patches touching sysops as well. But instead of
giving up I'd recommend to look into the following:

Go through all callsites which use un/register_syscore_ops() and figure out
how many of them are possibly called post init. From a quick grep I can
only find the KVM module, but there might be more.

Lets assume it's KVM only. So you could do the following:

Put something like this into virt/kvm/kvm_main.c, which is a builtin file

static struct syscore_ops ops __ro_after_init = {
       ....
};

int __init foo()
{
    register_ops(&ops);
}

and because we know that kvm is single instance you can just have:

static struct syscore_ops *kvm_ops;

void kvm_set_sysop(*vmx_ops)
{
	kvm_ops = ops;
}

and then have the kvm_syscore callbacks:

static callback()
{
	if (kvm_ops)
	   kvm_ops->callback()
}

Sanity checks and serialization omitted. Then switch kvm_exit/init over to
it.

After that you can make all syscore_ops __ro_after_init, remove the export
from (un)register_syscore_ops() and make that __init.

Not much of an effort and probably worth the trouble.

Thanks,

	tglx

  reply	other threads:[~2017-02-11 12:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-11  1:37 [kernel-hardening] [PATCH v2 1/5] irq: set {msi_domain,syscore}_ops as __ro_after_init Jess Frazelle
2017-02-11  1:37 ` [kernel-hardening] [PATCH v2 2/5] time: mark syscore_ops " Jess Frazelle
2017-02-11  2:12   ` [kernel-hardening] " John Stultz
2017-02-11  9:23     ` Thomas Gleixner
2017-02-11  1:37 ` [kernel-hardening] [PATCH v2 3/5] pci: set msi_domain_ops " Jess Frazelle
2017-02-12  4:08   ` [kernel-hardening] " KY Srinivasan
2017-02-13 18:14   ` [kernel-hardening] " 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 ` [kernel-hardening] [PATCH v2 4/5] staging: " Jess Frazelle
2017-02-11  1:37 ` [kernel-hardening] [PATCH v2 5/5] x86: " Jess Frazelle
2017-02-11  9:14 ` [kernel-hardening] Re: [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 [this message]
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=alpine.DEB.2.20.1702111222340.3734@nanos \
    --to=tglx@linutronix.de \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=me@jessfraz.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox