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: <a7cbb1f7-1f7f-6bf9-6acf-fd5455aadd82@linux.ibm.com>
Date:   Fri, 9 Oct 2020 16:56:45 +0530
From:   kajoljain <kjain@...ux.ibm.com>
To:     John Garry <john.garry@...wei.com>, peterz@...radead.org,
        mingo@...hat.com, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        namhyung@...nel.org, irogers@...gle.com, yao.jin@...ux.intel.com,
        yeyunfeng@...wei.com
Cc:     linux-kernel@...r.kernel.org, linuxarm@...wei.com,
        =linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] perf jevents: Fix event code for events referencing std
 arch events



On 10/8/20 8:49 PM, John Garry wrote:
> The event code for events referencing std arch events is incorrectly
> evaluated in json_events().
> 
> The issue is that je.event is evaluated properly from try_fixup(), but
> later NULLified from the real_event() call, as "event" may be NULL.
> 
> Fix by setting "event" same je.event in try_fixup().
> 
> Also remove support for overwriting event code for events using std arch
> events, as it is not used.

Patch looks good to me. Not sure if any adding any example with this issue
is helpful.

Reviewed-By: Kajol Jain<kjain@...ux.ibm.com>

Thanks,
Kajol Jain
> 
> Signed-off-by: John Garry <john.garry@...wei.com>
> 
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index 99df41a9543d..e47644cab3fa 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -505,20 +505,15 @@ static char *real_event(const char *name, char *event)
>  }
>  
>  static int
> -try_fixup(const char *fn, char *arch_std, unsigned long long eventcode,
> -	  struct json_event *je)
> +try_fixup(const char *fn, char *arch_std, struct json_event *je, char **event)
>  {
>  	/* try to find matching event from arch standard values */
>  	struct event_struct *es;
>  
>  	list_for_each_entry(es, &arch_std_events, list) {
>  		if (!strcmp(arch_std, es->name)) {
> -			if (!eventcode && es->event) {
> -				/* allow EventCode to be overridden */
> -				free(je->event);
> -				je->event = NULL;
> -			}
>  			FOR_ALL_EVENT_STRUCT_FIELDS(TRY_FIXUP_FIELD);
> +			*event = je->event;
>  			return 0;
>  		}
>  	}
> @@ -678,7 +673,7 @@ static int json_events(const char *fn,
>  			 * An arch standard event is referenced, so try to
>  			 * fixup any unassigned values.
>  			 */
> -			err = try_fixup(fn, arch_std, eventcode, &je);
> +			err = try_fixup(fn, arch_std, &je, &event);
>  			if (err)
>  				goto free_strings;
>  		}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ