Date: Fri, 31 Jan 2014 21:08:17 GMT From: John Wolfe <jlw@xinuos.com> To: freebsd-gnats-submit@FreeBSD.org Subject: threads/186309: pthread_kill() broken code - signal to current thread sent twice Message-ID: <201401312108.s0VL8Hcc092768@oldred.freebsd.org> Resent-Message-ID: <201401312110.s0VLA0NN091570@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401312108.s0VL8Hcc092768>