From owner-freebsd-stable@FreeBSD.ORG Wed Jun 3 14:58:47 2015 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B6761FD6 for ; Wed, 3 Jun 2015 14:58:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C0591C2B for ; Wed, 3 Jun 2015 14:58:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t53EwcdX097627 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 3 Jun 2015 17:58:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t53EwcdX097627 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t53EwcHp097626; Wed, 3 Jun 2015 17:58:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 3 Jun 2015 17:58:38 +0300 From: Konstantin Belousov To: Andre Meiser Cc: freebsd-stable@freebsd.org Subject: Re: Many core dumps in pthread_getspecific. Message-ID: <20150603145838.GX2499@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 14:58:47 -0000 On Wed, Jun 03, 2015 at 01:34:04PM +0200, Andre Meiser wrote: > Hi, > > I'm new to FreeBSD and I'm running into a lot of core dumps (mainly from Xorg, but also from vim, firefox, ...). > That's why I asked on freebsd-questions: > > https://lists.freebsd.org/pipermail/freebsd-questions/2015-June/266138.html > https://lists.freebsd.org/pipermail/freebsd-questions/2015-June/266141.html > > The last Xorg crash was less than 2h ago. :( > > It looks like that there is a missing check for NULL in lib/libkse/thread/thr_spec.c (line 211-214): > > pthread = _get_curthread(); > > /* Check if there is specific data: */ > if (pthread->specific != NULL && (unsigned int)key < PTHREAD_KEYS_MAX) { > > If pthread is NULL it will core dump. So maybe something like this would help: > > if (pthread != NULL && pthread->specific != NULL && (unsigned int)key < PTHREAD_KEYS_MAX) { > > But as I'm said, I'm new to FreeBSD I can't evaluate it yet. > > I'm running the most recent stable: > > % uname -a > FreeBSD andre 10.1-RELEASE-p10 FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 06:54:13 UTC 2015 > > I haven't compiled the base system so far. Maybe a more experienced FreeBSD guy can verify this and decide if it makes any sense or if I have to dig any deeper into it. The backtraces you posted do not make any sense, e.g. pthread_mutex_unlock() does not call pthread_getspecific(), and pthread_getspecific() is not recursive. You should recompile both libc and libthr with debugging symbols, like cd /usr/src (cd lib/libc && make all install DEBUG_FLAGS=-g) (cd lib/libthr && make all install DEBUG_FLAGS=-g) then obtain the core dump and post backtraces.