From 8faa1fc5f98ccb87beb2e71c0ce087278a950dde Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 18 Sep 2009 21:31:06 -0400 Subject: PR10655 part 1: uprobes: track sdt semaphores properly commit 6846cfc8 introduced an unintended side-effect where semaphore tracking was identified with stap_uprobe_specs[] elements, which are normally static/const. This kernel patch catches and panics on this. The cure is to move the variable over to the stap_uprobes[] array. * tapsets.cxx (uprobe emit_module_decls): Add sdt_sem_address to stap_uprobe{} struct, to contain per-process relocated semaphore address. (emit_module_decls,_init): Remove tsk field, restore constness of appropriate locals. Activate uprobe semaphore right around uprobe activation time. Remove semaphore clearing upon process exit, since by then it's gone. (emit_module_exit): Use remembered relocated semaphore address to clean up. Fix "-uprobe" DEBUG_UPROBES message. * runtime.h: #include . * dtrace.in (*_semaphore): Make it an unsigned short - intended 16 bits on all common architectures/multilibs. --- dtrace.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dtrace.in') diff --git a/dtrace.in b/dtrace.in index 98783604..c18f4efd 100755 --- a/dtrace.in +++ b/dtrace.in @@ -37,7 +37,8 @@ class provider: typedefs += (type_name + type_name + "_v;\n") return typedefs def semaphore_def_append(self, this_probe): - self.semaphores_def += "__extension__ long %s_semaphore __attribute__ ((unused)) __attribute__ ((section (\".probes\")));\n" % (this_probe) + # NB: unsigned short is fixed in ABI + self.semaphores_def += "__extension__ unsigned short %s_semaphore __attribute__ ((unused)) __attribute__ ((section (\".probes\")));\n" % (this_probe) def semaphore_def_write(self, file): file.write(self.semaphores_def) def generate(self, provider, header, add_typedefs): @@ -106,7 +107,8 @@ class provider: i += 1 self.h.write ('/* %s (%s) */\n' % (this_probe_canon,args_string)) self.h.write ('#define %s_ENABLED() %s_semaphore\n' % (this_probe_canon,this_probe)) - self.h.write ("__extension__ extern long %s_semaphore __attribute__ ((unused)) __attribute__ ((section (\".probes\")));\n" % (this_probe)) + # NB: unsigned short is fixed in ABI + self.h.write ("__extension__ extern unsigned short %s_semaphore __attribute__ ((unused)) __attribute__ ((section (\".probes\")));\n" % (this_probe)) self.h.write (define_str + ") \\\n") self.h.write (stap_str + ")\n\n") elif (line.find("}") != -1 and have_provider): -- cgit