From owner-freebsd-toolchain@freebsd.org Tue Mar 15 18:52:36 2016 Return-Path: Delivered-To: freebsd-toolchain@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 C7BA8AD2BE3 for ; Tue, 15 Mar 2016 18:52:36 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id B2D1F11A6 for ; Tue, 15 Mar 2016 18:52:36 +0000 (UTC) (envelope-from dimitry@andric.com) Received: by mailman.ysv.freebsd.org (Postfix) id B2235AD2BE2; Tue, 15 Mar 2016 18:52:36 +0000 (UTC) Delivered-To: toolchain@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 B1B9DAD2BE1 for ; Tue, 15 Mar 2016 18:52:36 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60A2E11A5 for ; Tue, 15 Mar 2016 18:52:36 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 8591D2FE6F; Tue, 15 Mar 2016 19:52:32 +0100 (CET) Subject: Re: Crash in ostream < In-Reply-To: <56E7F4DB.2000404@digiware.nl> Date: Tue, 15 Mar 2016 19:52:23 +0100 Cc: toolchain@freebsd.org Message-Id: <53A640CD-4F24-4242-8252-B27225A20071@andric.com> References: <56E7F4DB.2000404@digiware.nl> To: Willem Jan Withagen X-Mailer: Apple Mail (2.3112) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2016 18:52:36 -0000 --Apple-Mail=_48D33D00-7598-4A06-AC2B-D83CCA6237C6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 15 Mar 2016, at 12:41, Willem Jan Withagen wrote: >=20 > While running Ceph tools I get a crash in > fr 10 > #10 0x00000000016d82ca in FileStore::omap_get_values(coll_t const&, = ghobject_t const&, std::__1::set, std::__1::allocator >, = std::__1::less, = std::__1::allocator > >, = std::__1::allocator, std::__1::allocator > > > const&, = std::__1::map, = std::__1::allocator >, ceph::buffer::list, = std::__1::less, = std::__1::allocator > >, = std::__1::allocator, std::__1::allocator > const, = ceph::buffer::list> > >*) () > (gdb) l > 95 int preload_erasure_code() > 96 { > 97 string plugins =3D g_conf->osd_erasure_code_plugins; > 98 stringstream ss; > 99 int r =3D ErasureCodePluginRegistry::instance().preload( > 100 plugins, > 101 g_conf->erasure_code_dir, > 102 &ss); > 103 if (r) > 104 derr << ss.str() << dendl; > (gdb) > 105 else > 106 dout(10) << ss.str() << dendl; > 107 return r; > 108 } > 109 >=20 > All of this seems to be inlined since I'm not able to get at ss or r >=20 >=20 > #8 0x0000000000e16145 in std::__1::char_traits::length = (__s=3D0x0) at /usr/include/c++/v1/string:640 > 640 static inline size_t length(const char_type* __s) {return = strlen(__s);} What happened here is that something attempted to initialize a std::string with a NULL pointer, and that isn't allowed. As you saw in the debugger, the constructor just runs strlen() on the incoming string, and that will segfault. > Looking at the strlen implementation in > /usr/srcs/head/src/lib/libc/string/strlen.c >=20 > shows that strlen does not take 0x0 as pointer, so when we get here = with __s =3D 0x0 all is lost. > So I tried running it through 3.7, but since this is in the libraries = with the bintools/os, I'd expect > both versions to crash on this. >=20 > Now the question I have to solve: > is it the compiler/toolset/libraries > is it a bug in the ceph code. Most likely a bug in the Ceph code. Try figuring out where the NULL pointer originally came from. -Dimitry --Apple-Mail=_48D33D00-7598-4A06-AC2B-D83CCA6237C6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.29 iEYEARECAAYFAlboWe8ACgkQsF6jCi4glqMwbACdGt0cmUbBlB+BqNzj855qKCMS KQ0AoOIsIViuYUEDkMK29sf6COV4NzkL =2ZzA -----END PGP SIGNATURE----- --Apple-Mail=_48D33D00-7598-4A06-AC2B-D83CCA6237C6--