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: <20191126091749.GA32367@krava>
Date:   Tue, 26 Nov 2019 10:17:49 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Jin Yao <yao.jin@...ux.intel.com>,
        John Garry <john.garry@...wei.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH] perf tools: avoid segv in pmu_resolve_param_term

On Mon, Nov 25, 2019 at 09:41:35AM -0800, Ian Rogers wrote:
> PE_TERMS may set the config to NULL, avoid dereferencing this in
> pmu_resolve_param_term. Error detected by LLVM's libFuzzer.
> To reproduce the segv run:
> $ perf record -e 'm/event=?,time/' ls
> 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/util/pmu.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index e8d348988026..1a6e36353407 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -988,13 +988,17 @@ static int pmu_resolve_param_term(struct parse_events_term *term,
>  	struct parse_events_term *t;
>  
>  	list_for_each_entry(t, head_terms, list) {
> -		if (t->type_val == PARSE_EVENTS__TERM_TYPE_NUM) {
> -			if (!strcmp(t->config, term->config)) {
> -				t->used = true;
> -				*value = t->val.num;
> -				return 0;
> -			}
> -		}
> +		if (t->type_val != PARSE_EVENTS__TERM_TYPE_NUM)
> +			continue;
> +
> +		if (t->config == NULL && term->config != NULL)
> +			continue;

hum, I might be missing something but should above condition
be more like this?

		if (t->config == NULL || term->config == NULL)
			continue;

jirka

> +		else if (strcmp(t->config, term->config))
> +			continue;
> +
> +		t->used = true;
> +		*value = t->val.num;
> +		return 0;
>  	}
>  
>  	if (verbose > 0)
> -- 
> 2.24.0.432.g9d3f5f5b63-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ