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: <7c223b0c-d39a-4d53-8f00-7fbec6b49b6e@bytedance.com>
Date:   Mon, 20 Nov 2023 16:49:23 +0800
From:   Abel Wu <wuyun.abel@...edance.com>
To:     Xuewen Yan <xuewen.yan@...soc.com>, mingo@...hat.com,
        peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com, vschneid@...hat.com
Cc:     linux-kernel@...r.kernel.org, ke.wang@...soc.com,
        xuewen.yan94@...il.com
Subject: Re: [PATCH] sched/eevdf: Avoid NULL in pick_eevdf

Hi Xuewen, the pick part has been re-worked, would you please re-test
with the newest branch?

Thanks,
	Abel

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/?h=sched%2Fcore

On 11/20/23 3:38 PM, Xuewen Yan Wrote:
> Now in pick_eevdf function, add the pick_first_entity to prevent
> picking null when using eevdf, however, the leftmost may be null.
> As a result, it would cause oops because the se is NULL.
> 
> Fix this by compare the curr and left, if the left is null, set
> the se be curr.
> 
> Fixes: 147f3efaa241 ("sched/fair: Implement an EEVDF-like scheduling policy")
> Signed-off-by: Xuewen Yan <xuewen.yan@...soc.com>
> ---
>   kernel/sched/fair.c | 18 +++++++++++++++++-
>   1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d7a3c63a2171..10916f6778ac 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -951,12 +951,28 @@ static struct sched_entity *__pick_eevdf(struct cfs_rq *cfs_rq)
>   	return NULL;
>   }
>   
> +/* Just simply choose the se with the smallest vruntime */
> +static struct sched_entity *__pick_cfs(struct cfs_rq *cfs_rq)
> +{
> +	struct sched_entity *curr = cfs_rq->curr;
> +	struct sched_entity *left = __pick_first_entity(cfs_rq);
> +
> +	/*
> +	 * If curr is set we have to see if its left of the leftmost entity
> +	 * still in the tree, provided there was anything in the tree at all.
> +	 */
> +	if (!left || (curr && entity_before(curr, left)))
> +		left = curr;
> +
> +	return left;
> +}
> +
>   static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
>   {
>   	struct sched_entity *se = __pick_eevdf(cfs_rq);
>   
>   	if (!se) {
> -		struct sched_entity *left = __pick_first_entity(cfs_rq);
> +		struct sched_entity *left = __pick_cfs(cfs_rq);
>   		if (left) {
>   			pr_err("EEVDF scheduling fail, picking leftmost\n");
>   			return left;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ