Re: [Qemu-devel] [PATCH] queue: fix QSLIST_INSERT_HEAD_ATOMIC race

2015-03-12 Thread Stefan Hajnoczi
On Tue, Mar 10, 2015 at 04:45:57PM +0100, Paolo Bonzini wrote: > There is a not-so-subtle race in QSLIST_INSERT_HEAD_ATOMIC. > > Because atomic_cmpxchg returns the old value instead of a success flag, > QSLIST_INSERT_HEAD_ATOMIC was checking for success by comparing against > the second argument t

Re: [Qemu-devel] [PATCH] queue: fix QSLIST_INSERT_HEAD_ATOMIC race

2015-03-12 Thread Stefan Hajnoczi
On Tue, Mar 10, 2015 at 04:45:57PM +0100, Paolo Bonzini wrote: > There is a not-so-subtle race in QSLIST_INSERT_HEAD_ATOMIC. > > Because atomic_cmpxchg returns the old value instead of a success flag, > QSLIST_INSERT_HEAD_ATOMIC was checking for success by comparing against > the second argument t

Re: [Qemu-devel] [PATCH] queue: fix QSLIST_INSERT_HEAD_ATOMIC race

2015-03-10 Thread Christian Borntraeger
Am 10.03.2015 um 16:45 schrieb Paolo Bonzini: [...] > > Moral of the story: I should refrain from writing more clever stuff. > At least it looks like it is not too clever to be undebuggable. > > Reported-by: Christian Borntraeger > Fixes: c740ad92d0d958fa785e5d7aa1b67ecaf30a6a54 > Signed-off-by:

[Qemu-devel] [PATCH] queue: fix QSLIST_INSERT_HEAD_ATOMIC race

2015-03-10 Thread Paolo Bonzini
There is a not-so-subtle race in QSLIST_INSERT_HEAD_ATOMIC. Because atomic_cmpxchg returns the old value instead of a success flag, QSLIST_INSERT_HEAD_ATOMIC was checking for success by comparing against the second argument to atomic_cmpxchg. Unfortunately, this only works if the second argument