From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11483 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Eugenio_P=C3=A9rez?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: valgrind memcheck + drd error on alpine 3.6 container Date: Thu, 15 Jun 2017 09:55:20 +0200 Message-ID: References: <20170615001626.GM1627@brightrain.aerifal.cx> <20170615082841.7c0e9c0e@vostro> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c05d866b40bde0551fafe04" X-Trace: blaine.gmane.org 1497513355 21706 195.159.176.226 (15 Jun 2017 07:55:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Jun 2017 07:55:55 +0000 (UTC) Cc: Rich Felker To: musl@lists.openwall.com Original-X-From: musl-return-11496-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jun 15 09:55:51 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dLPd8-0005O7-DO for gllmg-musl@m.gmane.org; Thu, 15 Jun 2017 09:55:50 +0200 Original-Received: (qmail 22454 invoked by uid 550); 15 Jun 2017 07:55:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 22427 invoked from network); 15 Jun 2017 07:55:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=iuL4tcPLDeuEFu7E22T3dib7AfbsNUkFfec9FBdNL7M=; b=g7A8n7m9BbEBU0hwAJ2PvQk34IiWtWHRyjKgsWkYRndqd0z1jHeLNcVTIEhFqBKCbm 698wfRemZIzfbJfy4uqcnPDYO9MkOWosHRqV+Z/Uu7bSWVpBKgMKU5dWjMDEVc8P22xB 9JJ/HVbhhvwvnaixbWsBFgmrey61QypCfK4T/BYSTSGpvlKJxcYDRtm7WOjrh8A0M4Ps 4gfAiwXyvgYIq1aQKjdqKHqu1u6RdOBYJXsoygxi0D7Lel/m6SIjwPfHtTEvDr1yeAET bHw+lULXqL1XMb6jA+rkR7nO0SBN5ZKHpRXA0n6JKLqXViF3qRhhJHxQ5uyCiOBK3//6 3Rhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=iuL4tcPLDeuEFu7E22T3dib7AfbsNUkFfec9FBdNL7M=; b=nMzVCu58dQ4lW3clSjTxeqKomhVcdYKksP4Mc2KVsly4Wbr6Ex8u3A18p4UXc70UpM 4bcrqBg8GY8YoI659+JGB13mu7XpGzMhQr/48QkNhTOA3UFrm8VuRzALAU3emTRXw/6u 1cQTlJ3UtDjEpZuk58YZTMEKWRv1VTUUvLsHgEzY63sA5OxxG94qYEGGqeTgZB8pHntY 6gtkzZsaO+X9EXEqq71x4rojVHy5m5zd3bckH5HpP1gEsSZTrCW/DmgXktk3fDW1pvgp 7lT+qV8IYHaveqAbc22Ya5ItBktsg/qkSn1DGdKMz1qpo73p7Z0XsW2H29YreQOUu56r WH8w== X-Gm-Message-State: AKS2vOzueS35aQhWrzO93VCRkSQ9MrWNxtBWNnmetiqfuSNNJtXMgrhI +rkLELWSjAnaS4pzfARj4lcjEX5oX+qcTcE= X-Received: by 10.107.141.215 with SMTP id p206mr3841687iod.43.1497513340435; Thu, 15 Jun 2017 00:55:40 -0700 (PDT) In-Reply-To: <20170615082841.7c0e9c0e@vostro> Xref: news.gmane.org gmane.linux.lib.musl.general:11483 Archived-At: --94eb2c05d866b40bde0551fafe04 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable El 15/6/2017 7:28, "Timo Teras" escribi=C3=B3: > On Wed, 14 Jun 2017 20:16:26 -0400 > Rich Felker wrote: > > > On Wed, Jun 14, 2017 at 07:51:30PM +0200, Eugenio P=C3=A9rez wrote: > > > I'm having an issue trying to use valgrind drd in the simplest > > > musl-linked program (just return 0). > > > > > > drd refuses to even run main, and give me this error: > > > > > > =3D=3D24=3D=3D drd, a thread error detector > > > =3D=3D24=3D=3D Copyright (C) 2006-2015, and GNU GPL'd, by Bart Van As= sche. > > > =3D=3D24=3D=3D Using Valgrind-3.12.0 and LibVEX; rerun with -h for > > > copyright info =3D=3D24=3D=3D Command: ./f2k > > > =3D=3D24=3D=3D > > > > > > drd: drd_malloc_wrappers.c:115 (handle_free): Assertion 'success' > > > failed. > > > > > > host stacktrace: > > > =3D=3D24=3D=3D at 0x3805EF1D: show_sched_status_wrk (m_libcassert.= c:343) > > > =3D=3D24=3D=3D by 0x3805F208: report_and_quit (m_libcassert.c:419) > > > =3D=3D24=3D=3D by 0x3805F3E9: vgPlain_assert_fail (m_libcassert.c:= 485) > > > =3D=3D24=3D=3D by 0x38057635: handle_free (drd_malloc_wrappers.c:1= 15) > > > =3D=3D24=3D=3D by 0x380A51B9: do_client_request (scheduler.c:1861) > > > =3D=3D24=3D=3D by 0x380A51B9: vgPlain_scheduler (scheduler.c:1425) > > > =3D=3D24=3D=3D by 0x380B25DA: thread_wrapper (syswrap-linux.c:103) > > > =3D=3D24=3D=3D by 0x380B25DA: run_a_thread_NORETURN (syswrap-linux= .c:156) > > > > > > sched status: > > > running_tid=3D1 > > > > > > Thread 1: status =3D VgTs_Runnable (lwpid 24) > > > =3D=3D24=3D=3D at 0x4C96951: free (vg_replace_malloc.c:530) > > > =3D=3D24=3D=3D by 0x4057A19: ??? (in /lib/ld-musl-x86_64.so.1) > > > > > > I would like to compare it with glibc, but I'm unable to use it in > > > alpine linux properly. If it helps, memcheck gives me this error: > > > > > > =3D=3D163=3D=3D Invalid free() / delete / delete[] / realloc() > > > =3D=3D163=3D=3D at 0x4C939EA: free (vg_replace_malloc.c:530) > > > =3D=3D163=3D=3D by 0x4057A19: ??? (in /lib/ld-musl-x86_64.so.1) > > > =3D=3D163=3D=3D Address 0x4e9b180 is in a rw- mapped file > > > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so segment > > > =3D=3D163=3D=3D > > > =3D=3D163=3D=3D > > > =3D=3D163=3D=3D HEAP SUMMARY: > > > =3D=3D163=3D=3D in use at exit: 404 bytes in 1 blocks > > > =3D=3D163=3D=3D total heap usage: 1 allocs, 1 frees, 404 bytes allo= cated > > > =3D=3D163=3D=3D > > > =3D=3D163=3D=3D 404 bytes in 1 blocks are still reachable in loss rec= ord 1 > > > of 1 =3D=3D163=3D=3D at 0x4C9461F: calloc (vg_replace_malloc.c:711= ) > > > =3D=3D163=3D=3D by 0x4058B45: ??? (in /lib/ld-musl-x86_64.so.1) > > > =3D=3D163=3D=3D by 0x4059774: __dls3 (in /lib/ld-musl-x86_64.so.1) > > > =3D=3D163=3D=3D by 0xFFF000CB7: ??? > > > =3D=3D163=3D=3D by 0xFFF000D27: ??? > > > =3D=3D163=3D=3D > > > =3D=3D163=3D=3D LEAK SUMMARY: > > > =3D=3D163=3D=3D definitely lost: 0 bytes in 0 blocks > > > =3D=3D163=3D=3D indirectly lost: 0 bytes in 0 blocks > > > =3D=3D163=3D=3D possibly lost: 0 bytes in 0 blocks > > > =3D=3D163=3D=3D still reachable: 404 bytes in 1 blocks > > > =3D=3D163=3D=3D suppressed: 0 bytes in 0 blocks > > > > > > And that is before even reach main() function! However, memchecks > > > continue after error; drd does not. =C2=BFWhat could I do to keep > > > diagnosing this error? > > > > It's not an error, just lack of a suppressions file. You can ignore it > > or figure out how to write the suppressions file, or get one from > > somewhere (maybe a distro) that's already done it for musl. > > Could you please re-consider applying the patch that moves the "donate > memory" part to malloc.c, and stops misusing free() like this. It > really helps readability, maintainability and modularity to not > hardcode malloc internals in dynlink.c. I think I had sent a patch for > this in IRC, but could not found it immediately. > > Timo > > PS. What is the status of > http://www.openwall.com/lists/musl/2017/01/06/1 ? > Hi Rich! Thanks for your response! I can't even generate suppression file! it doesn't generate a suppression for an assert that is in valgrind code (drd_malloc_wrappers.c:115 is a valgrind file, not mine). Thanks for your response, Timo! Should apply that patch solve the issue? I'm starting with musl and I don't know how to link to it static in my program --94eb2c05d866b40bde0551fafe04 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

El 15/6/2017 7:28, "Timo Teras" <timo.teras@iki.fi> escribi=C3=B3:
On = Wed, 14 Jun 2017 20:16:26 -0400
Rich Felker <dalias@libc.org> = wrote:

> On Wed, Jun 14, 2017 at 07:51:30PM +0200, Eugenio P=C3=A9rez wrote: > > I'm having an issue trying to use valgrind drd in the simples= t
> > musl-linked program (just return 0).
> >
> > drd refuses to even run main, and give me this error:
> >
> > =3D=3D24=3D=3D drd, a thread error detector
> > =3D=3D24=3D=3D Copyright (C) 2006-2015, and GNU GPL'd, by Bar= t Van Assche.
> > =3D=3D24=3D=3D Using Valgrind-3.12.0 and LibVEX; rerun with -h fo= r
> > copyright info =3D=3D24=3D=3D Command: ./f2k
> > =3D=3D24=3D=3D
> >
> > drd: drd_malloc_wrappers.c:115 (handle_free): Assertion 'succ= ess'
> > failed.
> >
> > host stacktrace:
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 at 0x3805EF1D: show_sched_status_wrk = (m_libcassert.c:343)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x3805F208: report_and_quit (m_lib= cassert.c:419)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x3805F3E9: vgPlain_assert_fail (m= _libcassert.c:485)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x38057635: handle_free (drd_mallo= c_wrappers.c:115)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x380A51B9: do_client_request (sch= eduler.c:1861)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x380A51B9: vgPlain_scheduler (sch= eduler.c:1425)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x380B25DA: thread_wrapper (syswra= p-linux.c:103)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x380B25DA: run_a_thread_NORETURN = (syswrap-linux.c:156)
> >
> > sched status:
> >=C2=A0 =C2=A0running_tid=3D1
> >
> > Thread 1: status =3D VgTs_Runnable (lwpid 24)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 at 0x4C96951: free (vg_replace_malloc= .c:530)
> > =3D=3D24=3D=3D=C2=A0 =C2=A0 by 0x4057A19: ??? (in /lib/ld-musl-x8= 6_64.so.1)
> >
> > I would like to compare it with glibc, but I'm unable to use = it in
> > alpine linux properly. If it helps, memcheck gives me=C2=A0 this = error:
> >
> > =3D=3D163=3D=3D Invalid free() / delete / delete[] / realloc() > > =3D=3D163=3D=3D=C2=A0 =C2=A0 at 0x4C939EA: free (vg_replace_mallo= c.c:530)
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 by 0x4057A19: ??? (in /lib/ld-musl-x= 86_64.so.1)
> > =3D=3D163=3D=3D=C2=A0 Address 0x4e9b180 is in a rw- mapped file > > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so segment<= br> > > =3D=3D163=3D=3D
> > =3D=3D163=3D=3D
> > =3D=3D163=3D=3D HEAP SUMMARY:
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 =C2=A0in use at exit: 404 bytes in 1= blocks
> > =3D=3D163=3D=3D=C2=A0 =C2=A0total heap usage: 1 allocs, 1 frees, = 404 bytes allocated
> > =3D=3D163=3D=3D
> > =3D=3D163=3D=3D 404 bytes in 1 blocks are still reachable in loss= record 1
> > of 1 =3D=3D163=3D=3D=C2=A0 =C2=A0 at 0x4C9461F: calloc (vg_replac= e_malloc.c:711)
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 by 0x4058B45: ??? (in /lib/ld-musl-x= 86_64.so.1)
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 by 0x4059774: __dls3 (in /lib/ld-mus= l-x86_64.so.1)
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 by 0xFFF000CB7: ???
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 by 0xFFF000D27: ???
> > =3D=3D163=3D=3D
> > =3D=3D163=3D=3D LEAK SUMMARY:
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 definitely lost: 0 bytes in 0 blocks=
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 indirectly lost: 0 bytes in 0 blocks=
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 =C2=A0 possibly lost: 0 bytes in 0 b= locks
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 still reachable: 404 bytes in 1 bloc= ks
> > =3D=3D163=3D=3D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0suppressed: 0 by= tes in 0 blocks
> >
> > And that is before even reach main() function! However, memchecks=
> > continue after error; drd does not. =C2=BFWhat could I do to keep=
> > diagnosing this error?
>
> It's not an error, just lack of a suppressions file. You can ignor= e it
> or figure out how to write the suppressions file, or get one from
> somewhere (maybe a distro) that's already done it for musl.

Could you please re-consider applying the patch that moves the "donate=
memory" part to malloc.c, and stops misusing free() like this. It
really helps readability, maintainability and modularity to not
hardcode malloc internals in dynlink.c. I think I had sent a patch for
this in IRC, but could not found it immediately.

Timo

PS. What is the status of
http://www.openwall.com/lists/musl/2017/01/06/1 ?

Hi Rich! Thanks for your response!

I can't even generate suppression file! it doesn't generate a sup= pression for an assert that is in valgrind code (drd_malloc_wrappers.c:115 = is a valgrind file, not mine).

Thanks for your response, = Timo! Should apply that patch solve the issue? I'm starting with musl a= nd I don't know how to link to it static in my program
<= /div> --94eb2c05d866b40bde0551fafe04--