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: <aNJVaCvbUoDsMsJJ@gpd4>
Date: Tue, 23 Sep 2025 10:08:08 +0200
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
	linux-kernel@...r.kernel.org, sched-ext@...ts.linux.dev
Subject: Re: [PATCH 5/7] sched_ext: Add SCX_EFLAG_INITIALIZED to indicate
 successful ops.init()

On Sun, Sep 21, 2025 at 03:32:44PM -1000, Tejun Heo wrote:
> ops.exit() may be called even if the loading failed before ops.init()
> finishes successfully. This is because ops.exit() allows rich exit info
> communication. Add SCX_EFLAG_INITIALIZED flag to scx_exit_info.flags to
> indicate whether ops.init() finished successfully.
> 
> This enables BPF schedulers to distinguish between exit scenarios and
> handle cleanup appropriately based on initialization state.
> 
> Signed-off-by: Tejun Heo <tj@...nel.org>

This can be useful, we could update UEI_REPORT() to show the flag, but we
can also do it later in a separate patch.

Acked-by: Andrea Righi <arighi@...dia.com>

> ---
>  kernel/sched/ext.c          |  1 +
>  kernel/sched/ext_internal.h | 13 +++++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 5801ac676d59..d131e98156ac 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -4554,6 +4554,7 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
>  			scx_error(sch, "ops.init() failed (%d)", ret);
>  			goto err_disable;
>  		}
> +		sch->exit_info->flags |= SCX_EFLAG_INITIALIZED;
>  	}
>  
>  	for (i = SCX_OPI_CPU_HOTPLUG_BEGIN; i < SCX_OPI_CPU_HOTPLUG_END; i++)
> diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h
> index 1a80d01b1f0c..b3617abed510 100644
> --- a/kernel/sched/ext_internal.h
> +++ b/kernel/sched/ext_internal.h
> @@ -62,6 +62,16 @@ enum scx_exit_code {
>  	SCX_ECODE_ACT_RESTART	= 1LLU << 48,
>  };
>  
> +enum scx_exit_flags {
> +	/*
> +	 * ops.exit() may be called even if the loading failed before ops.init()
> +	 * finishes successfully. This is because ops.exit() allows rich exit
> +	 * info communication. The following flag indicates whether ops.init()
> +	 * finished successfully.
> +	 */
> +	SCX_EFLAG_INITIALIZED,
> +};
> +
>  /*
>   * scx_exit_info is passed to ops.exit() to describe why the BPF scheduler is
>   * being disabled.
> @@ -73,6 +83,9 @@ struct scx_exit_info {
>  	/* exit code if gracefully exiting */
>  	s64			exit_code;
>  
> +	/* %SCX_EFLAG_* */
> +	u64			flags;
> +
>  	/* textual representation of the above */
>  	const char		*reason;
>  
> -- 
> 2.51.0
> 

Thanks,
-Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ