From nobody Tue Jan 14 20:42:52 2025 X-Original-To: dev-commits-src-all@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 4YXh0K4DYCz5kPPn; Tue, 14 Jan 2025 20:42:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXh0K0cxMz4K6f; Tue, 14 Jan 2025 20:42:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-467a3c85e11so39898081cf.2; Tue, 14 Jan 2025 12:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736887375; x=1737492175; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Dedt2iOdRid8QeXO3wtoStVGyLUekpZE+D2rqVAFzvQ=; b=Vmqi/AtgJZYoZam/NwsG/McaC8JiYHeaUAuxxVU3sNzlNJpeHX8lwUFIUWDTIL9Lrn PeTY59fcpAhk6TvdnPwvdW93HAi9qDwqd4HtASCL4/hkbBEtrmhf8QSLpS6d/sGx/N5T 3aOCUMEhmpl8pArbMKhcNOLJanIF8rlsmjWr96qONHWBophn2s6WFubGCvhN//3zeSK1 T5jQVJzILr8NkoBsXXl2zoct+scnBFa/+ADlE0AdZS+8QJA5/5odJJY313N3V8+4JcAP CTS5zE/PsfCrnP4ngAOY2VYta3HyyPH6qktSUPDJtfKCBrzzkARA1lYy5thd9dRTdJfj la2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736887375; x=1737492175; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dedt2iOdRid8QeXO3wtoStVGyLUekpZE+D2rqVAFzvQ=; b=q6WdO6GZVSbld3aeU/TXp8hh5s5f9n7rdekHIE9nHBIdxuFVmmudfHY2lOr64hEhd1 vhNwQPWmvnAP4USUT4EFNIuNj1OBYMfH+lFoFgaBJVpG7vY7+qCE7L7EaVhjlkoMxxJp lQZbmZMXtKYh9Wbe6xQz7cHKP3p9GG3ntuhfHtoI/+W4lhnccXOX+EiGfLG3Xr4DqWJU 0D6ZiKpcA5MUP7A8q8SJe5qIOqfpXNGZZIAUtk7esLYhqSf//jpC2pT1BENfjgNHqKIP uG1nruMM6SpVkOzVntITkReugXMXmFJZSHSl8n0XespYN4M3V7XpMiM6ZlLfgtRzaNtJ GzxA== X-Forwarded-Encrypted: i=1; AJvYcCWty6ayp3//mwBoFODOJ2kh1aSiGab0q4bgMSn3Vkm1iVZq9sxcOzgnVdG+ercFb7vXW7bon57++VDEqXVWfRLxoXwY8Eg=@freebsd.org, AJvYcCXodiV+kwe+unO9d8iZi2k4/YJKUtOgkseSucK8T5kPqwNISi2Ze5KNyvThNa/uDLYfVcQ+vFnEqMk0CZiLGQrc5w5X@freebsd.org X-Gm-Message-State: AOJu0YwOVzk372G6AHkL6AIyrALEoeMPvCyUmlJu8AiLkzm7bmGF+C7T CzVeZsjE17/OGOAQ+Dj/OBbSOwmA35EUf4dpPl/F+23FpMdJOmlqtXHPoA== X-Gm-Gg: ASbGncvgoejJYgN65RQHpJVmTOd4yk5AzxT/cB2XVps8FIoPV2YujKatmbnj7YEfHBk tTUuGfdTt7yYn0WYdmUd/09t04OCsIZNW2mcq46JWyijYZsEf+hmz1Gps+4nH16/CwW7mXnEeZV l1bHz4IWVu2lD2TMK7f33Q+0p9ewKMrpF5KyTwigrcWE1MrKFmk5A6Tiu8OslIjs44KVTTfuzXm oMyMWuhE+6y0bbLcp5KKzSx/i3uMwDYi41m2nHrfQzhfwJocjmKERiKaCwnud5G/FC78dk= X-Google-Smtp-Source: AGHT+IEwpkokaGMxzMKZU4zTgiwEmzBdKBtA0IGRgRvb96T3VFekfM+tMGILn4Cn7p/U0NeqG7V6Pg== X-Received: by 2002:a05:622a:1314:b0:467:5da6:808f with SMTP id d75a77b69052e-46c7108f485mr385721951cf.22.1736887375338; Tue, 14 Jan 2025 12:42:55 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dfade72b04sm56325036d6.83.2025.01.14.12.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 12:42:54 -0800 (PST) Date: Tue, 14 Jan 2025 15:42:52 -0500 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9a2ae72421cd - main - libthr: switch thread and sleepq memory allocator to crt from libc malloc Message-ID: References: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4YXh0K0cxMz4K6f 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:15169, ipnet:2607:f8b0::/32, country:US] On Tue, Jan 14, 2025 at 05:55:15PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9a2ae72421cd75c741984f63b8c9ee89346a188d > > commit 9a2ae72421cd75c741984f63b8c9ee89346a188d > Author: Konstantin Belousov > AuthorDate: 2025-01-14 09:06:58 +0000 > Commit: Konstantin Belousov > CommitDate: 2025-01-14 17:55:08 +0000 > > libthr: switch thread and sleepq memory allocator to crt from libc malloc > > There are more complex interactions between malloc and libthr > initialization that can happen if libthr functions are called from ELF > object' constructors, before libthr is initialized. Break the > dependencies loop by using the private allocator with controlled init. > > Reported by: yuri > Reviewed by: markj, olce > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D48454 I see some startup deadlock when running the googletest regression tests (/usr/tests/lib/googletest/gmock_main) after this commit. gdb (which itself also hangs due to this bug) shows: (gdb) bt #0 _umtx_op_err () at /home/markj/sb/main/src/lib/libsys/amd64/_umtx_op_err.S:38 #1 0x000015e1ba96fd2c in __thr_umutex_lock (mtx=0x15e1ba974468, id=100113) at /usr/src/lib/libthr/thread/thr_umtx.c:69 #2 0x000015e1ba966a41 in __thr_calloc (num=1, size=17) at /usr/src/lib/libthr/thread/thr_malloc.c:92 #3 0x000015e1ba969213 in mutex_init (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240, mutex_attr=, calloc_cb=) at /usr/src/lib/libthr/thread/thr_mutex.c:291 #4 init_static (thread=0x1dc347e4b008, mutex=mutex@entry=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240) at /usr/src/lib/libthr/thread/thr_mutex.c:307 #5 0x000015e1ba967192 in check_and_init_mutex (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240, m=) at /usr/src/lib/libthr/thread/thr_mutex.c:606 #6 __Tthr_mutex_lock (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240) at /usr/src/lib/libthr/thread/thr_mutex.c:751 #7 0x000015e1bd54e714 in std::__1::__libcpp_mutex_lock[abi:se190105](pthread_mutex**) (__m=0x15e1ba974468) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/__thread/support/pthread.h:95 #8 std::__1::__call_once (flag=@0x15e1bd5c0cf0: 0, arg=0x11, func=0x0) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/call_once.cpp:44 #9 0x000015e1bd58a6a3 in std::__1::call_once[abi:se190105](std::__1::once_flag&, std::__1::locale::id::__get()::$_0&&) ( __flag=..., __func=...) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/__mutex/once_flag.h:131 #10 std::__1::locale::id::__get (this=0x15e1bd5c0cf0 ::id>) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:596 #11 std::__1::locale::__imp::install > (this=0x15e1bd5c0e30 , f=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:153 #12 std::__1::locale::__imp::__imp (this=this@entry=0x15e1bd5c0e30 , refs=refs@entry=1) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:161 #13 0x000015e1bd58c143 in std::__1::__no_destroy::__emplace[abi:se190105](unsigned int&&) ( this=0x15e1bd5c0e30 , __args=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/__utility/no_destroy.h:42 #14 std::__1::locale::classic()::$_0::operator()() const (this=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:502 #15 std::__1::locale::classic () at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:500 #16 0x000015e1bd58ea0b in std::__1::locale::__global () at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:509 #17 std::__1::locale::locale (this=0x15e1bd5c0798) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:523 #18 0x000015e1bd55fcf0 in std::__1::basic_streambuf >::basic_streambuf (this=warning: (Internal error: pc 0x15e1bd5c0790 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0790 in address map, but not in symtab.) 0x15e1bd5c0790) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/streambuf:300 #19 0x000015e1bd56d9b8 in std::__1::__stdinbuf::__stdinbuf (this=warning: (Internal error: pc 0x15e1bd5c0790 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0790 in address map, but not in symtab.) 0x15e1bd5c0790, __fp=0x15e1c095a560, __st=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/std_stream.h:72 #20 std::__1::DoIOSInit::DoIOSInit (this=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/iostream.cpp:131 #21 0x000015e1bd56e06d in std::__1::ios_base::Init::Init (this=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/iostream.cpp:166 #22 0x000015e1bd56eef5 in __cxx_global_var_init () at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/iostream_init.h:2 #23 0x000015e1bd56eef5 in global constructors keyed to 000100 () from /lib/libc++.so.1 #24 0x0000357474de453d in objlist_call_init (list=list@entry=0x15e1b85f0a70, lockstate=lockstate@entry=0x15e1b85f0860) at /home/markj/sb/main/src/libexec/rtld-elf/rtld.c:3110 #25 0x0000357474de3219 in _rtld (sp=, exit_proc=0x15e1b85f0ae0, objp=0x15e1b85f0ae8) at /home/markj/sb/main/src/libexec/rtld-elf/rtld.c:974 #26 0x0000357474de0019 in rtld_start () at /home/markj/sb/main/src/libexec/rtld-elf/amd64/rtld_start.S:40