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: <878vh4srmh.fsf@sejong.aot.lge.com>
Date:	Mon, 07 May 2012 10:32:22 +0900
From:	Namhyung Kim <namhyung.kim@....com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH] perf top: Fix a race in callchain handling

Hi,

On Sun, 6 May 2012 15:32:12 -0300, Arnaldo Carvalho de Melo wrote:
> Em Sun, May 06, 2012 at 11:25:07AM +0900, Namhyung Kim escreveu:
>> 2012-05-05 (토), 20:53 -0300, Arnaldo Carvalho de Melo:
>> > I'm looking how to get that fixed with Peter concerns addressed.
>> > 
>> 
>> I guess it's gonna be a non-trivial job. As far as I can see, the hists
>> code can handle up to two concurrent threads regardless of the callchain
>> cursor problem. And also guess that other areas of libperf also doesn't
>> support the true concurrency, right?
>
> Right, but making it even less concurrent is something we should avoid
> 8-)
>
> How about this one instead? At least we would be able to, concurrently,
> process multiple, unrelated hists:
>

I thought about it before, but it still cannot protect it from accessing
a hists by multiple concurrent threads. IOW if two threads call the
function to a same hists at the same time, ->callchain_collapse_cursor
would still get the race problem - so crashed.

I guess callchain_cursor should be thread-local, eventually. No need to
make it hist-local IMHO.

Thanks,
Namhyung


>
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index 9f6d630..c5cde92 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -397,8 +397,8 @@ static bool hists__collapse_insert_entry(struct hists *hists,
>  			iter->period += he->period;
>  			iter->nr_events += he->nr_events;
>  			if (symbol_conf.use_callchain) {
> -				callchain_cursor_reset(&hists->callchain_cursor);
> -				callchain_merge(&hists->callchain_cursor, iter->callchain,
> +				callchain_cursor_reset(&hists->callchain_collapse_cursor);
> +				callchain_merge(&hists->callchain_collapse_cursor, iter->callchain,
>  						he->callchain);
>  			}
>  			hist_entry__free(he);
> diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
> index cfc64e2..e04c80b 100644
> --- a/tools/perf/util/hist.h
> +++ b/tools/perf/util/hist.h
> @@ -69,6 +69,7 @@ struct hists {
>  	u16			col_len[HISTC_NR_COLS];
>  	/* Best would be to reuse the session callchain cursor */
>  	struct callchain_cursor	callchain_cursor;
> +	struct callchain_cursor	callchain_collapse_cursor;
>  };
>  
>  struct hist_entry *__hists__add_entry(struct hists *self,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ