From: Stan Cox Date: Fri, 15 Jan 2010 20:06:35 +0000 (-0500) Subject: Relax sdt address check for attach to running process case. X-Git-Tag: release-1.2~218^2~2 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=77694f530954dfeaf76662ebaae67ac39239a24b;p=systemtap.git Relax sdt address check for attach to running process case. * uprobes-common.c (stap_uprobe_change_plus): Relax VM_EXEC check. --- diff --git a/runtime/uprobes-common.c b/runtime/uprobes-common.c index 58e3a05f8..17ed69fc4 100644 --- a/runtime/uprobes-common.c +++ b/runtime/uprobes-common.c @@ -37,7 +37,7 @@ static int stap_uprobe_change_plus (struct task_struct *tsk, unsigned long reloc if (likely(sups->tfi != tfi)) continue; /* skip probes with an address beyond this map event; should not happen unless a shlib/exec got mmapped in weirdly piecemeal */ - if (likely((vm_flags & VM_EXEC) && ((sups->address >= length) || (sups->sdt_sem_offset >= length)))) continue; + if (likely((vm_flags & VM_EXEC) && sups->address >= length)) continue; /* Found a uprobe_spec for this stap_uprobe_tf. Need to lock the stap_uprobes[] array to allocate a free spot, but then we can @@ -159,7 +159,7 @@ static int stap_uprobe_change_semaphore_plus (struct task_struct *tsk, unsigned _stp_dbug(__FUNCTION__,__LINE__, "+semaphore %#x @ %#lx spec %d idx %d task %d\n", sdt_semaphore, sup->sdt_sem_address, sup->spec_index, i, tsk->tgid); } #endif - rc = put_user (sdt_semaphore, (unsigned short __user*) sup->sdt_sem_address); + rc = put_user (sdt_semaphore, (unsigned short __user*) sup->sdt_sem_address); /* XXX: need to analyze possibility of race condition */ } } diff --git a/testsuite/systemtap.base/sdt_misc.exp b/testsuite/systemtap.base/sdt_misc.exp index 74ebdc4e7..3ba38c457 100644 --- a/testsuite/systemtap.base/sdt_misc.exp +++ b/testsuite/systemtap.base/sdt_misc.exp @@ -74,13 +74,13 @@ int main () { #ifdef LOOP + #include + signal (SIGINT, &int_handler); + signal (SIGALRM, &alrm_handler); alarm (30); while (!loop_check()) { } - #include - signal (SIGINT, &int_handler); - signal (SIGALRM, &alrm_handler); #endif bar(2); baz(3,(char*)\"abc\"); @@ -379,6 +379,11 @@ if {$ok == 5} { # 5. Test attaching to a running process with markers in a shared object if { $pbtype_mssg != "kprobe" } { +set loop_flags "additional_flags=-I$srcdir/../includes/sys" +set loop_flags "$loop_flags additional_flags=-I$sdtdir" +set loop_flags "$loop_flags additional_flags=-g" +set loop_flags "$loop_flags additional_flags=-I. $pbtype_flag" +set loop_flags "$loop_flags additional_flags=-DLOOP" set loop_flags "$loop_flags additional_flags=-DONLY_MAIN" set loop_flags "$loop_flags additional_flags=-Wl,-rpath,[pwd]" set loop_flags "$loop_flags additional_flags=-L[pwd] additional_flags=-lsdt-$pbtype_mssg"