From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Aug 21 15:50:56 2014 Return-Path: Delivered-To: freebsd-ports-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CED77D8 for ; Thu, 21 Aug 2014 15:50:56 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD9CC35D5 for ; Thu, 21 Aug 2014 15:50:55 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id s7LFotWC091555 for ; Thu, 21 Aug 2014 15:50:55 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 192890] New: [MAINTAINER] devel/gdb thread support fix on i386 FreeBSD 9.x Date: Thu, 21 Aug 2014 15:50:55 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports Tree X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: luca.pizzamiglio@gmail.com X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-ports-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2014 15:50:56 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192890 Bug ID: 192890 Summary: [MAINTAINER] devel/gdb thread support fix on i386 FreeBSD 9.x Product: Ports Tree Version: Latest Hardware: i386 OS: Any Status: Needs Triage Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: freebsd-ports-bugs@FreeBSD.org Reporter: luca.pizzamiglio@gmail.com Attachment #146116 maintainer_approval+ Flags: Created attachment 146116 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=146116&action=edit Patch to fix the problem On FreeBSD 9.x i386 systems, debugging applications with threads causes a crash of gdb. Analysing the problem, I discovered a potential dangerous thread support initialization, causing the crash on this specific configuration. However it's conceptually wrong. When the libthr is loaded by gdb, the thread support want to add FreeBSD specific information to the current thread. Doing this, it cleans the thread list and re-add the current thread with the updated information (actually, the LWP id). This operation call a free of the struct thread_info (clean/init the thread list) and a malloc of the same struct (add the current thread). The problem is that a pointer to the struct thread_info is stored in another struct (about the execution context) and it's not updatable. On FreeBSD 9.x i386 systems, the malloc return a new pointer; then the execution context contains a broken pointer. On all other platform, the malloc return the same pointer and the execution context stays coherent. This patch avoids to clean the thread list and to re-add the thread; it just update thread information of the current thread. Tested on FreeBSD 9.3 on i386 and amd64 and FreeBSD 10 on i386. -- You are receiving this mail because: You are the assignee for the bug.