Blame SOURCES/rhbz1808185.patch

0d840a
commit 2303f9f86576fe74790b545bee81960bc73f599c
0d840a
Author: Frank Ch. Eigler <fche@redhat.com>
0d840a
Date:   Tue Feb 18 16:45:04 2020 -0500
0d840a
0d840a
    PR11249 etc.: tweak userspace function blacklist
0d840a
    
0d840a
    Add some uretprobes blacklist entries for 32-on-64 function
0d840a
    __x86.get_pc_thunk.bx and its kin.  Some bug between the kernel
0d840a
    uretprobes implementation and the systemtap runtime causes a SEGV on
0d840a
    the target process if a uretprobe is hit there.  Add retblacklist.exp
0d840a
    to test.
0d840a
0d840a
diff --git a/dwflpp.cxx b/dwflpp.cxx
0d840a
index c3f1c16..83a06d5 100644
0d840a
--- a/dwflpp.cxx
0d840a
+++ b/dwflpp.cxx
0d840a
@@ -4577,11 +4577,13 @@ dwflpp::build_user_blacklist()
0d840a
 
0d840a
   // Non-matching placeholders until we have real things to match
0d840a
   blfn += ".^";
0d840a
+  blfn_ret += ".^";
0d840a
   blfile += ".^";
0d840a
   blsection += ".^";
0d840a
 
0d840a
   // These functions don't use the normal function-entry ABI, so can't be .return probed safely
0d840a
-  blfn_ret += "_start";
0d840a
+  blfn_ret += "|_start";
0d840a
+  blfn_ret += "|__.*\\.get_pc_thunk\\..*"; // PR11249 etc.
0d840a
 
0d840a
   blfn += ")$";
0d840a
   blfn_ret += ")$";
0d840a
diff --git a/testsuite/systemtap.base/retblacklist.c b/testsuite/systemtap.base/retblacklist.c
0d840a
new file mode 100644
0d840a
index 0000000..9d1ecdf
0d840a
--- /dev/null
0d840a
+++ b/testsuite/systemtap.base/retblacklist.c
0d840a
@@ -0,0 +1,10 @@
0d840a
+int f(int x)
0d840a
+{
0d840a
+  return 0;
0d840a
+}
0d840a
+
0d840a
+int main()
0d840a
+{
0d840a
+  f(128);
0d840a
+  return 0;
0d840a
+}
0d840a
diff --git a/testsuite/systemtap.base/retblacklist.exp b/testsuite/systemtap.base/retblacklist.exp
0d840a
new file mode 100644
0d840a
index 0000000..3b90cae
0d840a
--- /dev/null
0d840a
+++ b/testsuite/systemtap.base/retblacklist.exp
0d840a
@@ -0,0 +1,32 @@
0d840a
+set test "retblacklist"
0d840a
+
0d840a
+set res [target_compile $srcdir/$subdir/$test.c $test.exe executable "-g"]
0d840a
+if { $res != "" } {
0d840a
+    verbose "target_compile $test failed: $res" 2
0d840a
+    fail "$test.c compile"
0d840a
+    untested "$test"
0d840a
+    return
0d840a
+} else {
0d840a
+    pass "$test.c compile"
0d840a
+}
0d840a
+
0d840a
+
0d840a
+if {! [installtest_p]} {
0d840a
+    untested "#test"
0d840a
+    return
0d840a
+}
0d840a
+
0d840a
+set ko 0
0d840a
+spawn stap -w $srcdir/$subdir/$test.stp -c ./$test.exe
0d840a
+expect {
0d840a
+    -timeout 20
0d840a
+    "_start" { incr ko; exp_continue }
0d840a
+    "get_pc_thunk" { incr ko; exp_continue }
0d840a
+    eof { }
0d840a
+}
0d840a
+verbose -log "ko=$ko"
0d840a
+
0d840a
+if {$ko == 0} then { pass $test } else { fail $test }
0d840a
+
0d840a
+catch {exec rm -f $test.exe}
0d840a
+
0d840a
diff --git a/testsuite/systemtap.base/retblacklist.stp b/testsuite/systemtap.base/retblacklist.stp
0d840a
new file mode 100644
0d840a
index 0000000..5a2cb3a
0d840a
--- /dev/null
0d840a
+++ b/testsuite/systemtap.base/retblacklist.stp
0d840a
@@ -0,0 +1,3 @@
0d840a
+probe process.function("*").return {
0d840a
+  println(ppfunc(),(@entry($$vars) != "" ? " ok" : " ko"))
0d840a
+}