From nobody Mon Jan 13 03:49:56 2025 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWdZ64T4Yz5kQ06 for ; Mon, 13 Jan 2025 03:50:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWdZ55Gkdz52tn; Mon, 13 Jan 2025 03:50:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 50D3nvNr094313; Mon, 13 Jan 2025 05:50:00 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 50D3nvNr094313 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 50D3nu8u094312; Mon, 13 Jan 2025 05:49:56 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 13 Jan 2025 05:49:56 +0200 From: Konstantin Belousov To: Yuri Cc: Freebsd hackers list Subject: Re: pthread_mutex_trylock crashes because _get_curthread() returns null Message-ID: References: List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4YWdZ55Gkdz52tn X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Sun, Jan 12, 2025 at 06:27:52PM -0800, Yuri wrote: > With this patch the original crash is gone, but now it crashes in calloc > with this stack: > > > #0  0x0000000003b2b1cc in calloc () > #1  0x000000002fda34e7 in _thr_alloc (curthread=curthread@entry=0x0) at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_list.c:154 > #2  0x000000002fda2522 in _libpthread_init (curthread=curthread@entry=0x0) > at /disk-samsung/freebsd-src/lib/libthr/thread/thr_init.c:336 > #3  0x000000002fda5265 in _thr_check_init () at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_private.h:927 > #4  __Tthr_mutex_trylock (mutex=0x415e440 <_rjem_je_arenas_lock+64>) at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_mutex.c:622 > #5  0x0000000003b29674 in _rjem_je_arena_choose_hard () > #6  0x0000000003b335da in arena_choose () > #7  0x0000000003b2b5b3 in calloc () > #8  0x000000002fda34e7 in _thr_alloc (curthread=curthread@entry=0x0) at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_list.c:154 > #9  0x000000002fda2522 in _libpthread_init (curthread=curthread@entry=0x0) > at /disk-samsung/freebsd-src/lib/libthr/thread/thr_init.c:336 > #10 0x000000002fda5265 in _thr_check_init () at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_private.h:927 > #11 __Tthr_mutex_trylock (mutex=0x415e440 <_rjem_je_arenas_lock+64>) at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_mutex.c:622 > #12 0x0000000003b29674 in _rjem_je_arena_choose_hard () > #13 0x0000000003b335da in arena_choose () > #14 0x0000000003b2b5b3 in calloc () > #15 0x000000002fda34e7 in _thr_alloc (curthread=curthread@entry=0x0) at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_list.c:154 > #16 0x000000002fda2522 in _libpthread_init (curthread=curthread@entry=0x0) > at /disk-samsung/freebsd-src/lib/libthr/thread/thr_init.c:336 > #17 0x000000002fda5265 in _thr_check_init () at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_private.h:927 > #18 __Tthr_mutex_trylock (mutex=0x415e440 <_rjem_je_arenas_lock+64>) at > /disk-samsung/freebsd-src/lib/libthr/thread/thr_mutex.c:622 There must be more frames after #18.