From owner-freebsd-threads@FreeBSD.ORG Fri Jan 31 21:10:00 2014 Return-Path: Delivered-To: freebsd-threads@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3931E5D for ; Fri, 31 Jan 2014 21:10:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7E4C8195C for ; Fri, 31 Jan 2014 21:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s0VLA0mP091571 for ; Fri, 31 Jan 2014 21:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s0VLA0NN091570; Fri, 31 Jan 2014 21:10:00 GMT (envelope-from gnats) Resent-Date: Fri, 31 Jan 2014 21:10:00 GMT Resent-Message-Id: <201401312110.s0VLA0NN091570@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-threads@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, John Wolfe Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D755E3A for ; Fri, 31 Jan 2014 21:08:18 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 396981948 for ; Fri, 31 Jan 2014 21:08:18 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0VL8HCq092777 for ; Fri, 31 Jan 2014 21:08:17 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0VL8Hcc092768; Fri, 31 Jan 2014 21:08:17 GMT (envelope-from nobody) Message-Id: <201401312108.s0VL8Hcc092768@oldred.freebsd.org> Date: Fri, 31 Jan 2014 21:08:17 GMT From: John Wolfe To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: threads/186309: pthread_kill() broken code - signal to current thread sent twice X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2014 21:10:00 -0000 >Number: 186309 >Category: threads >Synopsis: pthread_kill() broken code - signal to current thread sent twice >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 31 21:10:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: John Wolfe >Release: FreeBSD (PC-BSD) 9.2 & FreeBSD 10.0 RELEASE >Organization: Xinuos, Inc. >Environment: FreeBSD sapphire.nj.sco.com 9.2-RELEASE-p12 FreeBSD 9.2-RELEASE-p12 #0: Thu Jan 16 21:12:30 UTC 2014 root@amd64-builder.pcbsd.org:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Regression tests for llvm/LLDB debugger on FreeBSD 9 and FreeBSD 10 fail those tests that expect a specific number of SIGUSR1 signals to be caught by the debugger. See FreeBSD lldb problem report: http://llvm.org/bugs/show_bug.cgi?id=18065 Exactly twice the expected signals are caught. This is because the "if - else if -else if" code in lib/libthr/thread/thr_kill.c pthread_kill () is missing the obviously intended "else" before the last "if" statement. >How-To-Repeat: See above mentioned LLDB problem report. >Fix: A proposed unified diff patch is attached. Patch attached with submission follows: --- /usr/src/lib/libthr/thread/thr_kill.c.orig 2013-11-07 17:27:57.642970341 -0500 +++ /usr/src/lib/libthr/thread/thr_kill.c 2014-01-31 15:17:29.345215938 -0500 @@ -58,7 +58,8 @@ if (sig > 0) _thr_send_sig(pthread, sig); ret = 0; - } if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) + } + else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) == 0) { if (sig > 0) _thr_send_sig(pthread, sig); >Release-Note: >Audit-Trail: >Unformatted: