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]
Date:   Tue, 24 Jan 2023 19:16:22 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Wander Lairson Costa <wander@...hat.com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Stafford Horne <shorne@...il.com>, Guo Ren <guoren@...nel.org>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        Oleg Nesterov <oleg@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Andy Lutomirski <luto@...nel.org>,
        "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Andrei Vagin <avagin@...il.com>,
        linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH v2 3/4] sched/rt: use put_task_struct_atomic_safe() to
 avoid potential splat

On Fri, 20 Jan 2023 12:02:41 -0300
Wander Lairson Costa <wander@...hat.com> wrote:

> rto_push_irq_work_func() is called in hardirq context, and it calls
> push_rt_task(), which calls put_task_struct().
> 
> If the kernel is compiled with PREEMPT_RT and put_task_struct() reaches
> zero usage count, it triggers a splat because __put_task_struct()
> indirectly acquires sleeping locks.
> 
> The put_task_struct() call pairs with an earlier get_task_struct(),
> which makes the probability of the usage count reaches zero pretty
> low. In any case, let's play safe and use the atomic safe version.
> 
> Signed-off-by: Wander Lairson Costa <wander@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> ---
>  kernel/sched/rt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

For what it's worth:

Reviewed-by: Steven Rostedt (Google) <rostedt@...dmis.org>

-- Steve

> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index ed2a47e4ddae..30a4e9607bec 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -2147,7 +2147,7 @@ static int push_rt_task(struct rq *rq, bool pull)
>  		/*
>  		 * Something has shifted, try again.
>  		 */
> -		put_task_struct(next_task);
> +		put_task_struct_atomic_safe(next_task);
>  		next_task = task;
>  		goto retry;
>  	}
> @@ -2160,7 +2160,7 @@ static int push_rt_task(struct rq *rq, bool pull)
>  
>  	double_unlock_balance(rq, lowest_rq);
>  out:
> -	put_task_struct(next_task);
> +	put_task_struct_atomic_safe(next_task);
>  
>  	return ret;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ