From owner-freebsd-current@freebsd.org Fri Jan 27 23:00:29 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEBA8CC4536 for ; Fri, 27 Jan 2017 23:00:29 +0000 (UTC) (envelope-from janm@transactionware.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id A996BCFC for ; Fri, 27 Jan 2017 23:00:29 +0000 (UTC) (envelope-from janm@transactionware.com) Received: by mailman.ysv.freebsd.org (Postfix) id A5EF4CC4535; Fri, 27 Jan 2017 23:00:29 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A587FCC4534 for ; Fri, 27 Jan 2017 23:00:29 +0000 (UTC) (envelope-from janm@transactionware.com) Received: from mail3.transactionware.com (mail.transactionware.com [203.14.245.7]) by mx1.freebsd.org (Postfix) with SMTP id 0DF90CFB for ; Fri, 27 Jan 2017 23:00:28 +0000 (UTC) (envelope-from janm@transactionware.com) Received: (qmail 53130 invoked by uid 907); 27 Jan 2017 22:53:45 -0000 Received: from eth222.nsw.adsl.internode.on.net (HELO [192.168.1.101]) (150.101.196.221) (smtp-auth username janm, mechanism plain) by mail3.transactionware.com (qpsmtpd/0.84) with (ECDHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPSA; Sat, 28 Jan 2017 09:53:45 +1100 From: Jan Mikkelsen Message-Id: Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: malloc() call somehow calling the rtld malloc() implementaion Date: Sat, 28 Jan 2017 09:53:49 +1100 In-Reply-To: <201701270831.v0R8VUsC018788@gw.catspoiler.org> Cc: current@FreeBSD.org To: Don Lewis References: <201701270831.v0R8VUsC018788@gw.catspoiler.org> X-Mailer: Apple Mail (2.3259) X-Mailman-Approved-At: Fri, 27 Jan 2017 23:02:27 +0000 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 23:00:29 -0000 Hi, Are you being affected by this rtld behaviour: = https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049769.html = https://lists.freebsd.org/pipermail/freebsd-stable/2015-July/082751.html = = (I still find this a bit scary.) Regards, Jan. > On 27 Jan 2017, at 19:31, Don Lewis wrote: >=20 > I've been attempting to get OpenOffice to build properly in a > clang400-import poudriere jail and have run into a mystery. The build > procedure creates a c++ executable "idlc", which is used to build = other > stuff. The new operator has been overrriden to call a custom memory > allocator, which I have configured to call the system version of > malloc(). >=20 > At some point idlc crashes because it has allocated a 16 byte = structure > and the compiler is using "movaps %xmm0,(%rax)" to initialize it, = which > requires 16 byte alignment. Unfortunately this structure is only 8 = byte > aligned, causing a bus error. This shouldn't be happening because our > system malloc() always seems to do the proper alignment. It appears > that intead of calling the version of malloc() in libc, the simple > version of malloc() built into rtld is being called instead. >=20 > GNU gdb 6.1.1 [FreeBSD] > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and = you are > welcome to change it and/or distribute copies of it under certain = conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for = details. > This GDB was configured as "amd64-marcel-freebsd"... > (gdb) break main > Breakpoint 1 at 0x43b1f6: file idlcmain.cxx, line 34. > (gdb) run @/tmp/r > Starting program: = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/bin/idlc @/tmp/r > [New LWP 101304] > [New Thread 802616000 (LWP 101304/idlc)] > [Switching to Thread 802616000 (LWP 101304/idlc)] >=20 > Breakpoint 1, main (argc=3D2, argv=3D0x7fffffffb278) at = idlcmain.cxx:34 > 34 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) > (gdb) break malloc > Breakpoint 2 at 0x8006a5f01: file = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c, = line 163. > (gdb) cont > Continuing. > Trace 12474/1: "Min Prioriy for policy '2' =3D=3D '0' > " > Trace 12474/1: "Max Prioriy for policy '2' =3D=3D '103' > " > = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/bin/idlc: compiling 1 source files ...=20 > Compiling: = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/offapi/com= /sun/star/i18n/KParseTokens.idl >=20 > Breakpoint 2, malloc (nbytes=3D343) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c: No = such file or directory. > in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > Current language: auto; currently minimal > (gdb) cont > Continuing. >=20 > Breakpoint 2, malloc (nbytes=3D32) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. > Trace 13112/2: "ChildStatusProc : starting = '/wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/42= 0/unxfbsdx.pro/bin/ucpp'" > [New Thread 802616500 (LWP 100249/idlc)] > [Switching to Thread 802616500 (LWP 100249/idlc)] >=20 > Breakpoint 2, malloc (nbytes=3D19) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. >=20 > Breakpoint 2, malloc (nbytes=3D34) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. >=20 > Breakpoint 2, malloc (nbytes=3D16) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. >=20 > Breakpoint 2, malloc (nbytes=3D16) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. >=20 > Breakpoint 2, malloc (nbytes=3D16) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. >=20 > Breakpoint 2, malloc (nbytes=3D16) > at = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c:163 > 163 in = /var/poudriere/jails/clang400amd64/usr/src/libexec/rtld-elf/malloc.c > (gdb) cont > Continuing. > sizeof(AstExprValue)=3D16 >=20 > Program received signal SIGBUS, Bus error. > [Switching to Thread 802616000 (LWP 101304/idlc)] > 0x0000000000478cc2 in AstExpression::eval_bit_op (this=3D0x802633dc8,=20= > ek=3DEK_const) at astexpression.cxx:1001 > 1001 std::auto_ptr< AstExprValue > retval(new AstExprValue()); >=20 >=20 > idlc is linked to libc.so: >=20 > = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/bin/idlc: > libreg.so.3 =3D> = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/lib/libreg.so.3 (0x8008b9000) > libuno_sal.so.3 =3D> = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/lib/libuno_sal.so.3 (0x800c00000) > libuno_salhelpergcc3.so.3 =3D> = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/lib/libuno_salhelpergcc3.so.3 (0x801040000) > libm.so.5 =3D> /lib/libm.so.5 (0x801244000) > libc++.so.1 =3D> /usr/lib/libc++.so.1 (0x80146e000) > libcxxrt.so.1 =3D> /lib/libcxxrt.so.1 (0x801735000) > libgcc_s.so.1 =3D> /lib/libgcc_s.so.1 (0x801953000) > libthr.so.3 =3D> /lib/libthr.so.3 (0x801b69000) > libc.so.7 =3D> /lib/libc.so.7 (0x801d91000) > libstore.so.3 =3D> = /wrkdirs/usr/ports/editors/openoffice-devel/work/aoo-4.2.0/main/solver/420= /unxfbsdx.pro/lib/libstore.so.3 (0x802152000) >=20 >=20 > If I create a simple test program that calls malloc() and set a > breakpoint in malloc(), the breakpoint gets set in the rtld version, = but > the the libc version of malloc is what gets called. >=20 > What the heck is going on here, and how can I fix it? >=20 > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to = "freebsd-current-unsubscribe@freebsd.org"