From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27526 invoked by alias); 12 Jan 2014 18:32:55 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 27479 invoked by uid 48); 12 Jan 2014 18:32:50 -0000 From: "carlos at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug nptl/14744] kill -32 $pid or kill -33 $pid on a process cancels a random thread Date: Sun, 12 Jan 2014 18:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: carlos at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 2.20 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg00215.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=14744 --- Comment #3 from Carlos O'Donell --- (In reply to Rich Felker from comment #2) > Perhaps I was not clear. I (hopefully obviously) did not mean that there > should be some global state "this application has called pthread_cancel" > which causes any thread receiving signal 32 or 33 to get cancelled if it's > set. The intent was that pthread_cancel should set the cancellation state on > its target (in the TCB or thread-local storage), and a thread should never > act upon cancellation unless this state is set. The only sanity checking done today is: /* Safety check. It would be possible to call this function for other signals and send a signal from another process. This is not correct and might even be a security problem. Try to catch as many incorrect invocations as possible. */ if (sig != SIGCANCEL || si->si_pid != pid || si->si_code != SI_TKILL) return; However the implementation comment seems to indicate desiring support for cancellation from another process? /* We are canceled now. When canceled by another thread this flag is already set but if the signal is directly send (internally or from another process) is has to be done here. */ int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK; I can't imagine under what use case you would support cancelling a thread in a process from another process? Comments? -- You are receiving this mail because: You are on the CC list for the bug.