This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv4] powerpc: Fix write-after-destroy in lock elision
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- Cc: tuliom at linux dot vnet dot ibm dot com (Tulio Magno Quites Machado Filho), triegel at redhat dot com, libc-alpha at sourceware dot org, adhemerval dot zanella at linaro dot org, raji at linux dot vnet dot ibm dot com, munroesj at linux dot vnet dot ibm dot com
- Date: Wed, 11 Jan 2017 17:41:26 +0100
- Subject: Re: [PATCHv4] powerpc: Fix write-after-destroy in lock elision
- Authentication-results: sourceware.org; auth=none
- References: <1483446882-2593-1-git-send-email-tuliom@linux.vnet.ibm.com> <20170111152201.EBA6710BDA8@oc8523832656.ibm.com>
On Jan 11 2017, "Ulrich Weigand" <uweigand@de.ibm.com> wrote:
> Tulio Magno Quites Machado Filho wrote:
>
>> + /* Update adapt_count in the critical section to prevent a
>> + write-after-destroy error as mentioned in BZ 20822. The
>> + following update of adapt_count has to be contained within
>> + the critical region of the fall-back lock in order to not violate
>> + the mutex destruction requirements. */
>> + short __tmp = atomic_load_relaxed (adapt_count);
>> + if (__tmp > 0)
>> + atomic_store_relaxed (adapt_count, __tmp--);
>
> Doesn't this have to be --__tmp to have any effect?
It should be just __tmp - 1.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."