This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/12683] Race conditions in pthread cancellation
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 16 Aug 2013 16:22:05 +0000
- Subject: [Bug nptl/12683] Race conditions in pthread cancellation
- Auto-submitted: auto-generated
- References: <bug-12683-131 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=12683
--- Comment #7 from Rich Felker <bugdal at aerifal dot cx> ---
Glad to hear that. Have you taken a look at musl's cancellation implementation?
The same mechanism could be used in glibc, or I think it could be modified
somewhat to use DWARF2 CFI instead of the asm labels. The basic approach is
that the cancellation signal handler examines the saved program counter
register and determines whether it's in the critical range starting just before
the pre-syscall check of the cancellation flag and the syscall instruction
(based on asm labels for these two endpoints). The kernel then handles the
atomicity of side effects for us: if the signal interrupts the syscall, the
kernel must either complete what it's doing and return (positioning the program
counter just past the address range that would allow cancellation to be acted
upon), or reset the program counter to just before the syscall instruction and
setup the register contents for restarting after the signal handler (in which
case cancellation can be acted upon).
--
You are receiving this mail because:
You are on the CC list for the bug.