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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Dec 2021 22:08:59 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Stephane Eranian <eranian@...gle.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Ian Rogers <irogers@...gle.com>,
        kernel test robot <lkp@...el.com>,
        Marco Elver <elver@...gle.com>
Subject: Re: [PATCH v2] perf/core: Fix cgroup event list management

On Sun, Dec 12, 2021 at 10:59:36PM -0800, Namhyung Kim wrote:
> The active cgroup events are managed in the per-cpu cgrp_cpuctx_list.
> This list is accessed from current cpu and not protected by any locks.
> But from the commit ef54c1a476ae ("perf: Rework
> perf_event_exit_event()"), this assumption does not hold true anymore.
> 
> In the perf_remove_from_context(), it can remove an event from the
> context without an IPI when the context is not active.  I think it
> assumes task event context, but it's possible for cpu event context

Yes, event_function_call() in general doesn't work, but for cpu events
it does.

> only with cgroup events can be inactive at the moment - and it might
> become active soon.

It can't, we're holding ctx->mutex and ctx->lock, and since it's a cpu
event, that's cpuctx.

But yes, cgrp_cpuctx_list relies on being strictly per-cpu and I can't
come up with a better solution either, doing those IPIs suck but...

But please, put in a comment like:

	/*
	 * Cgroup events are per-CPU events, and must IPI because of
	 * cgrp_cpuctx_list.
	 */
	if (!ctx->is_active || !is_cgroup_event(event)) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ