lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a2209d8e-2c5c-4ace-b184-de585999f9d0@intel.com>
Date: Fri, 9 Jan 2026 14:16:01 -0800
From: "Chang S. Bae" <chang.seok.bae@...el.com>
To: David Kaplan <david.kaplan@....com>, Thomas Gleixner <tglx@...utronix.de>,
	Borislav Petkov <bp@...en8.de>, Peter Zijlstra <peterz@...radead.org>, "Josh
 Poimboeuf" <jpoimboe@...nel.org>, Pawan Gupta
	<pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>, "Dave
 Hansen" <dave.hansen@...ux.intel.com>, <x86@...nel.org>, "H . Peter Anvin"
	<hpa@...or.com>
CC: Alexander Graf <graf@...zon.com>, Boris Ostrovsky
	<boris.ostrovsky@...cle.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 28/56] stop_machine: Add stop_machine_nmi()

On 10/13/2025 7:34 AM, David Kaplan wrote:
>   
> +/**
> + * stop_machine_nmi: freeze the machine and run this function in NMI context
> + * @fn: the function to run
> + * @data: the data ptr for the @fn()
> + * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
> + *
> + * Like stop_machine() but runs the function in NMI context to avoid any risk of
> + * interruption due to NMIs.
> + *
> + * Protects against CPU hotplug.
> + */
> +int stop_machine_nmi(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);
> +
> +/**
> + * stop_machine_cpuslocked_nmi: freeze and run this function in NMI context
> + * @fn: the function to run
> + * @data: the data ptr for the @fn()
> + * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
> + *
> + * Same as above. Must be called from within a cpus_read_lock() protected
> + * region. Avoids nested calls to cpus_read_lock().
> + */
> +int stop_machine_cpuslocked_nmi(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);

<snip>

> +int stop_machine_cpuslocked_nmi(cpu_stop_fn_t fn, void *data,
> +				const struct cpumask *cpus)
> +{
> +	return __stop_machine_cpuslocked(fn, data, cpus, true);
> +}
> +

It looks like this is readily missing the static key switching which is 
handled below. I think the body could be something like:
   ...
   static_branch_enable_cpuslocked(&stop_machine_nmi_handler_enable);
   ret = __stop_machine_cpuslocked(fn, data, cpus, true);
   static_branch_disable_cpuslocked(&stop_machine_nmi_handler_enable);
   ...

> +int stop_machine_nmi(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus)
> +{
> +	int ret;
> +
> +	cpus_read_lock();
> +	static_branch_enable_cpuslocked(&stop_machine_nmi_handler_enable);
> +	ret = stop_machine_cpuslocked_nmi(fn, data, cpus);
> +	static_branch_disable_cpuslocked(&stop_machine_nmi_handler_enable);
> +	cpus_read_unlock();
> +	return ret;
> +}

With that, here __stop_machine_cpuslocked() can be invoked instead.

Thanks,
Chang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ