From owner-freebsd-threads@FreeBSD.ORG Mon Jun 13 11:07:14 2011 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBD361065672 for ; Mon, 13 Jun 2011 11:07:14 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 90C888FC12 for ; Mon, 13 Jun 2011 11:07:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p5DB7EXv092221 for ; Mon, 13 Jun 2011 11:07:14 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p5DB7DLa092219 for freebsd-threads@FreeBSD.org; Mon, 13 Jun 2011 11:07:13 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 13 Jun 2011 11:07:13 GMT Message-Id: <201106131107.p5DB7DLa092219@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2011 11:07:14 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o threa/157040 threads [libthr] valgrind detects leaks in libthr.so.3 o threa/154893 threads pthread_sigmask don't work if mask and oldmask are pas o threa/150959 threads [libc] Stub pthread_once in libc should call _libc_onc o threa/149366 threads pthread_cleanup_pop never runs the configured routine o threa/148515 threads Memory / syslog strangeness in FreeBSD 8.x ( possible o threa/141721 threads rtprio(1): (id|rt)prio priority resets when new thread o threa/136345 threads Recursive read rwlocks in thread A cause deadlock with o threa/135673 threads databases/mysql50-server - MySQL query lock-ups on 7.2 o threa/128922 threads threads hang with xorg running o threa/127225 threads bug in lib/libthr/thread/thr_init.c o threa/122923 threads 'nice' does not prevent background process from steali o threa/121336 threads lang/neko threading ok on UP, broken on SMP (FreeBSD 7 o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/101323 threads [patch] fork(2) in threaded programs broken. s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/79683 threads svctcp_create() fails if multiple threads call at the s threa/76694 threads fork cause hang in dup()/close() function in child (-l s threa/76690 threads fork hang in child for -lc_r s threa/69020 threads pthreads library leaks _gc_mutex s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/34536 threads accept() blocks other threads s threa/30464 threads [patch] pthread mutex attributes -- pshared 28 problems total. From owner-freebsd-threads@FreeBSD.ORG Fri Jun 17 01:53:41 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73B8B1065673 for ; Fri, 17 Jun 2011 01:53:41 +0000 (UTC) (envelope-from schumjs@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7DF8FC0A for ; Fri, 17 Jun 2011 01:53:40 +0000 (UTC) Received: by iwr19 with SMTP id 19so1116434iwr.13 for ; Thu, 16 Jun 2011 18:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=Hw7n9mFB3nWh4qQts+mBENr8+rWASc7a8WGEfPQc07U=; b=Sq8d16L0LX6FShBtgzT+q1F8h0W/ScbhXrsfWU2SEtg8Cu/1mX5iQ9ejPGxZNgVPUc 512EMk53iXe+JeU5LeVwdsFXvU9kdZ+zbMLdlJt1/ep4z3Dk8GzTu8oMCu0wrDOVO9Y2 PqwmsJmf/AhxwIxFZVEj1vIY5//H4Ry2T+V+M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=tS5msWJYEt+/Umv9206YaT0O51OlpSEq/X1cBaoMqhTOJ8ogrYKBqbykhFWFMS76za iyX8OWcrOQvoEBiIoD855ORLqllEKsCupcTx+u+CZ0buyxSXxsQVLzKT1NTWT1zAUUHD Rb426/vqbp+qvnAhMvXOqWojdxlpv/cs6END8= MIME-Version: 1.0 Received: by 10.231.63.83 with SMTP id a19mr1339723ibi.104.1308274219690; Thu, 16 Jun 2011 18:30:19 -0700 (PDT) Received: by 10.231.91.199 with HTTP; Thu, 16 Jun 2011 18:30:19 -0700 (PDT) Date: Thu, 16 Jun 2011 20:30:19 -0500 Message-ID: From: John Schumacher To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: ptrace and threads (libthr) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2011 01:53:41 -0000 Does anybody know if FreeBSD allow for ptracing to be done on threads ex. PT_ATTACH, or PT_SUSPEND? I recall this being impossible before, http://lists.freebsd.org/pipermail/freebsd-threads/2004-January/001511.html but maybe this has changed now. Is there a viable alternative to getting around this? if (ptrace (PT_ATTACH, ikipp->ki_tid, 0, 0) != 0) { fprintf (stderr, "Cannot attach to lwp %ld: %s (%d)\n", tid,strerror (errno), errno); fflush (stderr); } if (ptrace (PT_SUSPEND, ikipp->ki_tid, 0, 0) != 0) { fprintf (stderr, "Cannot attach to lwp %ld: %s (%d)\n",tid,strerror (errno), errno); fflush (stderr); } both yield: Cannot suspend lwp 100167: Device busy (16) Cannot attach to lwp 100167: Device busy (16) In my understanding how ptrace works, the thread or process to be traced must be 'stopped'. Is there a way to pause threads to allow an attach to occur(SIGSTOP)? Is thread the correct term in this case? Or is anything the kernel can manipulate via signals and pt_methods technically a light-weight-process or kernel thread 'mapped' to that user-thread (pthread)? This is FreeBSD 8.1 with the libthr library. Thanks ! -- John Schumacher University of Minnesota (TC) Electrical Engineering From owner-freebsd-threads@FreeBSD.ORG Fri Jun 17 21:10:18 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44F56106564A for ; Fri, 17 Jun 2011 21:10:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D7A378FC08 for ; Fri, 17 Jun 2011 21:10:17 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p5HKhgMP095932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Jun 2011 23:43:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p5HKhgrc006889; Fri, 17 Jun 2011 23:43:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p5HKhfj2006887; Fri, 17 Jun 2011 23:43:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Jun 2011 23:43:41 +0300 From: Kostik Belousov To: John Schumacher Message-ID: <20110617204341.GV48734@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pdzG5fwa2AGbKqcK" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-threads@freebsd.org Subject: Re: ptrace and threads (libthr) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2011 21:10:18 -0000 --pdzG5fwa2AGbKqcK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 16, 2011 at 08:30:19PM -0500, John Schumacher wrote: > Does anybody know if FreeBSD allow for ptracing to be done on threads ex. > PT_ATTACH, or PT_SUSPEND? Yes, there are people who know. Then answer is contained in the file sys/kern/sys_process.c. > I recall this being impossible before, > http://lists.freebsd.org/pipermail/freebsd-threads/2004-January/001511.ht= ml > but maybe this has changed now. Is there a viable alternative to getting > around this? >=20 > if (ptrace (PT_ATTACH, ikipp->ki_tid, 0, 0) !=3D 0) > { > fprintf (stderr, "Cannot attach to lwp %ld: %s (%d)\n", tid,strerror > (errno), errno); > fflush (stderr); > } > if (ptrace (PT_SUSPEND, ikipp->ki_tid, 0, 0) !=3D 0) > { > fprintf (stderr, "Cannot attach to lwp %ld: %s (%d)\n",tid,strerror > (errno), errno); > fflush (stderr); > } >=20 > both yield: > Cannot suspend lwp 100167: Device busy (16) > Cannot attach to lwp 100167: Device busy (16) >=20 > In my understanding how ptrace works, the thread or process to be traced > must be 'stopped'. Is there a way to pause threads to allow an attach to > occur(SIGSTOP)? Is thread the correct term in this case? Or is anything t= he > kernel can manipulate via signals and pt_methods technically a > light-weight-process or kernel thread 'mapped' to that user-thread > (pthread)? This is FreeBSD 8.1 with the libthr library. The ptrace(2) requires the debugger to be attached to debuggee. The attachment can only happen at the process level, you cannot attach to thread. After the attachment is done, operations like PT_SUSPEND, PT_CONTINUE, PT_STEP etc operate on the lwps, and not on the process. This is somewhat obscured by two issues. First is the mention of the "pid" in the man page. In fact, pid may be process identifier, in which case the kernel will select some random thread in the target process, or it may be an lwp id, in the later case the exact lwp is acted upon. The namespace of the pid and lwpid do not cross. You can obtain the list of the debugee lwps with PT_GETLWPLIST. Second issue is that for the singlethreaded process, the only random thread the kernel can select is the only process thread. So the man page needs an update to be exact on the scope of the action, either the process or lwp. Anybody volunteer to do this ? >=20 >=20 > Thanks ! >=20 > --=20 > John Schumacher > University of Minnesota (TC) > Electrical Engineering > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" --pdzG5fwa2AGbKqcK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk37vH0ACgkQC3+MBN1Mb4hARwCgp4SOxOrkTc/HMSXeSdVbZULb e2YAniRal+gxy18nKgBQHOA04CdEiat8 =6dWP -----END PGP SIGNATURE----- --pdzG5fwa2AGbKqcK--