From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753635AbdBKMAW (ORCPT ); Sat, 11 Feb 2017 07:00:22 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:35079 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753435AbdBKMAV (ORCPT ); Sat, 11 Feb 2017 07:00:21 -0500 Date: Sat, 11 Feb 2017 13:00:16 +0100 (CET) From: Thomas Gleixner To: Jess Frazelle cc: Marc Zyngier , "open list:IRQ SUBSYSTEM" , kernel-hardening@lists.openwall.com Subject: Re: [PATCH v2 1/5] irq: set {msi_domain,syscore}_ops as __ro_after_init In-Reply-To: Message-ID: References: <20170211013758.3288-1-me@jessfraz.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 11 Feb 2017, Jess Frazelle wrote: > On February 11, 2017 1:14:52 AM PST, Thomas Gleixner 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 11 Feb 2017 13:00:16 +0100 (CET) From: Thomas Gleixner In-Reply-To: Message-ID: References: <20170211013758.3288-1-me@jessfraz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: [kernel-hardening] Re: [PATCH v2 1/5] irq: set {msi_domain,syscore}_ops as __ro_after_init To: Jess Frazelle Cc: Marc Zyngier , "open list:IRQ SUBSYSTEM" , kernel-hardening@lists.openwall.com List-ID: On Sat, 11 Feb 2017, Jess Frazelle wrote: > On February 11, 2017 1:14:52 AM PST, Thomas Gleixner 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