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  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]
Date:	Mon, 3 Feb 2014 11:35:30 -0500
From:	Don Zickus <dzickus@...hat.com>
To:	Cyrill Gorcunov <gorcunov@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86, perf, p4: Counter corruption when using lots of
 perf groups

On Mon, Feb 03, 2014 at 10:19:29AM +0400, Cyrill Gorcunov wrote:
> On Wed, Jan 29, 2014 at 03:17:17PM -0500, Don Zickus wrote:
> > > > I am not entirely sure on the corruption path, but what happens is:
> > > > 
> > > > o perf schedules a group with p4_pmu_schedule_events()
> > > > o inside p4_pmu_schedule_events(), it notices an hwc pointer is being reused
> > > >   but for a different cpu, so it 'swaps' the config bits and returns the
> > > >   updated 'assign' array with a _new_ index.
> > > > o perf schedules another group with p4_pmu_schedule_events()
> > > > o inside p4_pmu_schedule_events(), it notices an hwc pointer is being reused
> > > >   (the same one as above) but for the _same_ cpu [BUG!!], so it updates the
> > > >   'assign' array to use the _old_ (wrong cpu) index because the _new_ index is in
> > > >   an earlier part of the 'assign' array (and hasn't been committed yet).
> > > > o perf commits the transaction using the wrong index and corrupts the other cpu
> > > 
> > > Thanks for the fix Don! I fear I won't be able to look precisely tonight, so
> > > could it wait until tomorrow? (If it's critical sure such fix should do the
> > > trick).
> > 
> > There is no rush.  Early next week is fine too. :-)
> 
> Hi Don, sorry for delay. I thought maybe extending match_prev_assignment()
> would be better (ie to figure out if previous event can run without
> reprogramming the counter) but this makes code only harder (and what
> is worse -- having no physical accees to p4 machine leaves no chance
> to test changes). So eventually I think your patch does the same thing
> as I had in mind but in different way. Thus
> 
> Acked-by: Cyrill Gorcunov <gorcunov@...nvz.org>
> 
> thanks a lot!

thanks!

Cheers,
Don

--
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