Date: Thu, 15 Feb 2024 12:31:35 +0000 From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 277065] [libthr] reachable memory Message-ID: <bug-277065-13406@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277065 Bug ID: 277065 Summary: [libthr] reachable memory Product: Base System Version: 14.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: threads Assignee: threads@FreeBSD.org Reporter: pjfloyd@wanadoo.fr This is a follow on from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276818 Using the same testcase I see two reachable allocations in Valgrind =3D=3D3215=3D=3D 64 bytes in 1 blocks are still reachable in loss record 2 = of 3 =3D=3D3215=3D=3D at 0x48518C5: calloc (vg_replace_malloc.c:1601) =3D=3D3215=3D=3D by 0x4C7C772: ??? (in /lib/libthr.so.3) =3D=3D3215=3D=3D by 0x4C75385: ??? (in /lib/libthr.so.3) =3D=3D3215=3D=3D by 0x4C743AE: ??? (in /lib/libthr.so.3) =3D=3D3215=3D=3D by 0x400ABFC: ??? (in /libexec/ld-elf.so.1) =3D=3D3215=3D=3D by 0x40098C8: ??? (in /libexec/ld-elf.so.1) =3D=3D3215=3D=3D by 0x4006B88: ??? (in /libexec/ld-elf.so.1) =3D=3D3215=3D=3D=20 =3D=3D3215=3D=3D 1,664 bytes in 1 blocks are still reachable in loss record= 3 of 3 =3D=3D3215=3D=3D at 0x48518C5: calloc (vg_replace_malloc.c:1601) =3D=3D3215=3D=3D by 0x4C75374: ??? (in /lib/libthr.so.3) =3D=3D3215=3D=3D by 0x4C743AE: ??? (in /lib/libthr.so.3) =3D=3D3215=3D=3D by 0x400ABFC: ??? (in /libexec/ld-elf.so.1) =3D=3D3215=3D=3D by 0x40098C8: ??? (in /libexec/ld-elf.so.1) =3D=3D3215=3D=3D by 0x4006B88: ??? (in /libexec/ld-elf.so.1) First problem (for me) is that Valgrind isn't reading debuginfo so I'm not seeing file and line number. In gdb if I put breakpoints on those addresses I see that they are 4 breakpoint keep y 0x0000000004c75374 in _thr_alloc at /usr/src/lib/libthr/thread/thr_list.c:154 5 breakpoint keep y 0x0000000004c7c772 in _sleepq_alloc at /usr/src/lib/libthr/thread/thr_sleepq.c:66 For some reason gdb doesn't stop on the breakpoints. And if gdb can get file and line number then so should Valgrind. The allocations are if (thread =3D=3D NULL) { if (total_threads > MAX_THREADS) return (NULL); atomic_fetchadd_int(&total_threads, 1); thread =3D calloc(1, sizeof(struct pthread)); if (thread =3D=3D NULL) { atomic_fetchadd_int(&total_threads, -1); return (NULL); } if ((thread->sleepqueue =3D _sleepq_alloc()) =3D=3D NULL || (thread->wake_addr =3D _thr_alloc_wake_addr()) =3D=3D N= ULL) { thr_destroy(curthread, thread); atomic_fetchadd_int(&total_threads, -1); return (NULL); } and struct sleepqueue * _sleepq_alloc(void) { struct sleepqueue *sq; sq =3D calloc(1, sizeof(struct sleepqueue)); TAILQ_INIT(&sq->sq_blocked); SLIST_INIT(&sq->sq_freeq); return (sq); } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277065-13406>