From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11482 Path: news.gmane.org!.POSTED!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: valgrind memcheck + drd error on alpine 3.6 container Date: Thu, 15 Jun 2017 08:28:41 +0300 Message-ID: <20170615082841.7c0e9c0e@vostro> References: <20170615001626.GM1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1497504538 6675 195.159.176.226 (15 Jun 2017 05:28:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Jun 2017 05:28:58 +0000 (UTC) Cc: musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-11495-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jun 15 07:28:53 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 1dLNKu-0001V0-Lp for gllmg-musl@m.gmane.org; Thu, 15 Jun 2017 07:28:52 +0200 Original-Received: (qmail 4022 invoked by uid 550); 15 Jun 2017 05:28:55 -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 4004 invoked from network); 15 Jun 2017 05:28:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1VDtY0kaUKKNntSI+Ak6LiUuillPIgTrYEoMvgAI5B4=; b=aa5H4MZP09+XOMyfH7vT8dRRMKygIGK2Iv5y/GQrfgBUaQXrDUz9iGOn6veKFV7FdZ GYNDReCNiTzwkS6ci87kelWqK9cJlZCnFHUBsNpD5ByIU6vQ4YjaYMC5al5COJa+2dEN pR0F967YCGTG+1J6WuXw1zu9RqMD2WIqdiKW+CsOvxmOMCurErFOGDIP9YtlY93pTJ+B l63PRlxg+9NDlmktGtYVZpxjICGivTi07t3515HxMf8kL4qiBw0OrP7znc9D1o/sRlc/ ppFpJWKV1SDLBcnNA7P/jCX1W2QJsC1uelds7UzDkfvwxyKeZ8k5nsrs/WRVAMAhUCwG 2Ktg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1VDtY0kaUKKNntSI+Ak6LiUuillPIgTrYEoMvgAI5B4=; b=ZXCLIpMCzchhAZOP5G2W+iRMwocPeR5oytJ6yzfrV4xUifvQY81D8/93leUiTk2Ell 8LDEDG37GnEnwEs9JcsbUWCZ68nf6+3VbeM339VUIjTRP01mSqiU0Qyn1KY2B2OUhIEr FpKlNFNUnB51bHWhQIB+QkHp4FhVtwOLD1LW1GKD/JyDV/DUi7dJtoUsRiho+lcWvpaS 7jPXx/qClwbFUlyzwHTM6kMBe21WgZr/WFrZA/6tEhM4plqRdo7MJ9AFVIanT71WG7Do WX94LD3JFvTlvzzKzggkm3DSYXtS9gIbDMU/fNAdYIGeVgP3pn0Rg2DY1tDyApQD2iDp 3Lcg== X-Gm-Message-State: AKS2vOyAQpi7zsGqHB+Qm7Od9lWo8uQKXz3LDtuXNF/k2LQpGvHukYy3 nklKgeTMisEmC9lN X-Received: by 10.46.32.157 with SMTP id g29mr1064891lji.110.1497504523877; Wed, 14 Jun 2017 22:28:43 -0700 (PDT) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <20170615001626.GM1627@brightrain.aerifal.cx> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-alpine-linux-musl) Xref: news.gmane.org gmane.linux.lib.musl.general:11482 Archived-At: 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). > >=20 > > drd refuses to even run main, and give me this error: > >=20 > > =3D=3D24=3D=3D drd, a thread error detector > > =3D=3D24=3D=3D Copyright (C) 2006-2015, and GNU GPL'd, by Bart Van Assc= he. > > =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 > >=20 > > drd: drd_malloc_wrappers.c:115 (handle_free): Assertion 'success' > > failed. > >=20 > > 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:48= 5) > > =3D=3D24=3D=3D by 0x38057635: handle_free (drd_malloc_wrappers.c:115) > > =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) > >=20 > > sched status: > > running_tid=3D1 > >=20 > > 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) > >=20 > > 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: > >=20 > > =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 alloca= ted > > =3D=3D163=3D=3D > > =3D=3D163=3D=3D 404 bytes in 1 blocks are still reachable in loss recor= d 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 > >=20 > > 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? >=20 > 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 ?