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: <20191204154424.GA2810@hirez.programming.kicks-ass.net>
Date:   Wed, 4 Dec 2019 16:44:24 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Meelis Roos <mroos@...ux.ee>, LKML <linux-kernel@...r.kernel.org>,
        x86@...nel.org, Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>
Subject: Re: UBSAN: Undefined behaviour in arch/x86/events/intel/p6.c:116:29

On Wed, Dec 04, 2019 at 04:24:44PM +0100, Jiri Olsa wrote:

> > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> > index 9a89d98c55bd..f17417644665 100644
> > --- a/arch/x86/events/core.c
> > +++ b/arch/x86/events/core.c
> > @@ -1642,9 +1643,12 @@ static struct attribute_group x86_pmu_format_group __ro_after_init = {
> >  
> >  ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, char *page)
> >  {
> > -	struct perf_pmu_events_attr *pmu_attr = \
> > +	struct perf_pmu_events_attr *pmu_attr =
> 
> ugh, did this do something weird? ;-)

No, but it's weird to explicitly concat the line outside of a macro, so
if 'fixed' it.

> >  		container_of(attr, struct perf_pmu_events_attr, attr);
> > -	u64 config = x86_pmu.event_map(pmu_attr->id);
> > +	u64 config = 0;
> > +
> > +	if (pmu_attr->id < x86_pmu.max_events)
> > +		x86_pmu.event_map(pmu_attr->id);
> 
> hum, should this be assigned to config?
> 
> 		config = x86_pmu.event_map(pmu_attr->id);

D'oh... Yes.

> >  
> >  	/* string trumps id */
> >  	if (pmu_attr->event_str)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ