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] [day] [month] [year] [list]
Message-ID: <20250626131326.GH1613200@noisy.programming.kicks-ass.net>
Date: Thu, 26 Jun 2025 15:13:26 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Luo Gengkun <luogengkun@...weicloud.com>
Cc: linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
	x86@...nel.org
Subject: Re: [tip: perf/urgent] perf/core: Fix WARN in perf_cgroup_switch()

On Thu, Jun 26, 2025 at 09:08:38PM +0800, Luo Gengkun wrote:

> Sorry for the late reply, I found that the link is v2 instead of v3.
> This v3 link is:
> 
> https://lore.kernel.org/all/20250609035316.250557-1-luogengkun@huaweicloud.com/
> 
> v2 attempts to fix a concurrency problem between perf_cgroup_switch
> and perf_cgroup_event_disable. But it does not to move WARN_ON_ONCE
> into lock-protected region, so the warning is still triggered.
> 
> The following patches have been tested and fix this issue.
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 1f746469fda5..a35784d42c66 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -951,8 +951,6 @@ static void perf_cgroup_switch(struct task_struct *task)
>         if (READ_ONCE(cpuctx->cgrp) == NULL)
>                 return;
> 
> -       WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0);
> -
>         cgrp = perf_cgroup_from_task(task, NULL);
>         if (READ_ONCE(cpuctx->cgrp) == cgrp)
>                 return;
> @@ -964,6 +962,8 @@ static void perf_cgroup_switch(struct task_struct *task)
>         if (READ_ONCE(cpuctx->cgrp) == NULL)
>                 return;
> 
> +       WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0);
> +
>         perf_ctx_disable(&cpuctx->ctx, true);
> 
>         ctx_sched_out(&cpuctx->ctx, NULL, EVENT_ALL|EVENT_CGROUP);

Can you send as a full new patch, the thing is already in Linus' tree.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ