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: <ZIOB9Kmg+uQ+vgSI@kernel.org>
Date:   Fri, 9 Jun 2023 16:48:04 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>,
        James Clark <james.clark@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        German Gomez <german.gomez@....com>,
        Ali Saidi <alisaidi@...zon.com>,
        Jing Zhang <renyu.zj@...ux.alibaba.com>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        ye xingchen <ye.xingchen@....com.cn>,
        Liam Howlett <liam.howlett@...cle.com>,
        Dmitrii Dolgov <9erthalion6@...il.com>,
        Yang Jihong <yangjihong1@...wei.com>,
        K Prateek Nayak <kprateek.nayak@....com>,
        Changbin Du <changbin.du@...wei.com>,
        Ravi Bangoria <ravi.bangoria@....com>,
        Sean Christopherson <seanjc@...gle.com>,
        Andi Kleen <ak@...ux.intel.com>,
        "Steinar H. Gunderson" <sesse@...gle.com>,
        Yuan Can <yuancan@...wei.com>,
        Brian Robbins <brianrob@...ux.microsoft.com>,
        liuwenyu <liuwenyu7@...wei.com>,
        Ivan Babrou <ivan@...udflare.com>,
        Fangrui Song <maskray@...gle.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, coresight@...ts.linaro.org
Subject: Re: [PATCH v2 06/26] perf addr_location: Add init/exit/copy functions

Em Thu, Jun 08, 2023 at 04:28:03PM -0700, Ian Rogers escreveu:
> +++ b/tools/perf/builtin-kmem.c
> @@ -399,7 +399,9 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
>  	struct addr_location al;
>  	struct machine *machine = &kmem_session->machines.host;
>  	struct callchain_cursor_node *node;
> +	u64 result;
>  
> +	addr_location__init(&al);
>  	if (alloc_func_list == NULL) {
>  		if (build_alloc_func_list() < 0)
>  			goto out;
> @@ -427,16 +429,19 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
>  			else
>  				addr = node->ip;
>  
> -			return addr;
> +			result = addr;
> +			goto out;
>  		} else
>  			pr_debug3("skipping alloc function: %s\n", caller->name);
>  
>  		callchain_cursor_advance(&callchain_cursor);
>  	}
>  
> -out:
>  	pr_debug2("unknown callsite: %"PRIx64 "\n", sample->ip);
> -	return sample->ip;
> +	result = sample->ip;
> +out:
> +	addr_location__exit(&al);
> +	return result;
>  }

I needed this to make sure result is set to something, mostly keeping
the previous logic as build_alloc_func_list() already does
debugging/error prints about what went wrong if it takes the 'goto out'.

- Arnaldo

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index a11f280d20bd3d12..96a6611e4e53f448 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -399,7 +399,7 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
 	struct addr_location al;
 	struct machine *machine = &kmem_session->machines.host;
 	struct callchain_cursor_node *node;
-	u64 result;
+	u64 result = sample->ip;
 
 	addr_location__init(&al);
 	if (alloc_func_list == NULL) {
@@ -438,7 +438,6 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
 	}
 
 	pr_debug2("unknown callsite: %"PRIx64 "\n", sample->ip);
-	result = sample->ip;
 out:
 	addr_location__exit(&al);
 	return result;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ