Re: [PATCH v2 04/32] kho: allow to drive kho from within kernel

From: Mike Rapoport
Date: Mon Jul 28 2025 - 06:21:01 EST


On Wed, Jul 23, 2025 at 02:46:17PM +0000, Pasha Tatashin wrote:
> Allow to do finalize and abort from kernel modules, so LUO could
> drive the KHO sequence via its own state machine.
>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
> ---
> include/linux/kexec_handover.h | 15 +++++++++
> kernel/kexec_handover.c | 58 ++++++++++++++++++++++++++++++++--
> 2 files changed, 71 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h

...

> -static int kho_finalize(void)
> +int kho_abort(void)
> +{
> + int ret = 0;
> +
> + if (!kho_enable)
> + return -EOPNOTSUPP;
> +
> + mutex_lock(&kho_out.lock);
> +
> + if (!kho_out.finalized) {
> + ret = -ENOENT;
> + goto unlock;
> + }
> +
> + ret = __kho_abort();
> + if (ret)
> + goto unlock;
> +
> + kho_out.finalized = false;
> + ret = kho_out_update_debugfs_fdt();
> +
> +unlock:
> + mutex_unlock(&kho_out.lock);
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(kho_abort);

I don't think a module should be able to drive KHO. Please drop
EXPORT_SYMBOL_GPL here and for kho_finalize().

--
Sincerely yours,
Mike.