This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Unexpected value-at for NULL'd pointer with pthreads
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Kyle Harper <kylejharper at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 24 Aug 2015 15:48:51 +0100
- Subject: Re: Unexpected value-at for NULL'd pointer with pthreads
- Authentication-results: sourceware.org; auth=none
- References: <CAPcbWWxx3g9Uk9sn5jgG1GgmxSk1fjy5ybHKuRMzdKN3LJqt2Q at mail dot gmail dot com> <CAH8yC8nSNMGkbLWWcToBX6ZP5ygFFVqjKOmjq_pnvvFmfnxqSA at mail dot gmail dot com> <CAH6eHdSw84L3t9AqUjwGkvEU=4knZJvAod+d72OgusP0F5q0pA at mail dot gmail dot com> <CAPcbWWx-CQpJQvKHdHkObJ4wRv=9idRi1PaJuJ0nScMM7o6E_g at mail dot gmail dot com> <55DAD5B7 dot 90604 at redhat dot com> <CAPcbWWw8jv6kayXL-hZKOVhbMCQGoNNbT3e5j0hvYbPfPqfFBA at mail dot gmail dot com> <55DB2DED dot 20507 at redhat dot com>
On 24 August 2015 at 15:45, Andrew Haley wrote:
> On 08/24/2015 03:29 PM, Kyle Harper wrote:
>>>> I'm happy to provide any other code or info, or try other debugging
>>>> tools. I'm getting desperate trying to track this down, so any help
>>>> is appreciated.
>>>
>>> The rule for this is always super-simple:
>>>
>>> Provide a complete example with full instructions about how to
>>> reproduce the problem.
>>>
>>> Andrew.
>>>
>>
>> My apologies if I'm misunderstanding what you mean, but I did provide
>> the full simplified example to demonstrate the issue in the Gist link:
>> https://gist.github.com/KyleJHarper/af89bc1a11a699e14d48#file-grr-c
>
> I did not see that link in any of your emails. It doesn't do
> anything about removing elements from lists.
That's the first time I've seen that link too.
>>
>> Compiled with:
>> gcc -std=gnu99 -pthread -o grr grr.c
>
> You're freeing the same buffer twice. Thus your program crashes.
Any of glibc, valgrind, asan or tsan diagnoses a use-after-free bug in
that code.