From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3482 invoked by alias); 11 Nov 2012 20:50:52 -0000 Received: (qmail 3436 invoked by uid 48); 11 Nov 2012 20:50:38 -0000 From: "bugdal at aerifal dot cx" To: glibc-bugs@sources.redhat.com Subject: [Bug nptl/14830] New: Race conditions with signals and thread priority scheduling Date: Sun, 11 Nov 2012 20:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-11/txt/msg00096.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14830 Bug #: 14830 Summary: Race conditions with signals and thread priority scheduling Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: nptl AssignedTo: unassigned@sourceware.org ReportedBy: bugdal@aerifal.cx CC: drepper.fsp@gmail.com Classification: Unclassified NPTL implements thread priority scheduling for new threads by creating the new thread but blocking its forward progress until pthread_create in the parent can set the new thread's scheduling options. If this fails (e.g. due to EPERM), pthread_create is required to fail. To achieve this result, NPTL has pthread_create send a cancellation request to the new thread. Unfortunately, NPTL fails to block signals during thread creation, so it's possible that a signal handler is already running (at the wrong priority) in the newly created thread by the time the failure to set the priority had been detected. The cancellation request will then cause any cancellation-point function called from the signal handler to act upon cancellation, possibly with disastrous results if the application was not written to use cancellation. I believe the simplest solution to this issue is to block all signals before clone() is called. In the parent, signals can be unblocked immediately as soon as clone returns. In the new thread, signals cannot be unblocked until it's determined that the thread will be allowed to run. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.