Home Home > GIT Browse > SLE12-SP5-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2019-09-04 16:24:31 +0200
committerMiroslav Benes <mbenes@suse.cz>2019-09-05 13:09:12 +0200
commitb0a7e900346397a74c6cf82097edcb0c5ca794f0 (patch)
treeede14fd98f6866e5d06159e20247883efa8bd1e7
parent62b79910d8b20dab4f3345f5d3d58e45d47565e5 (diff)
ftrace: Check for empty hash and comment the race with
registering probes (bsc#1149418).
-rw-r--r--patches.suse/ftrace-check-for-empty-hash-and-comment-the-race-with-registering-probes.patch49
-rw-r--r--series.conf1
2 files changed, 50 insertions, 0 deletions
diff --git a/patches.suse/ftrace-check-for-empty-hash-and-comment-the-race-with-registering-probes.patch b/patches.suse/ftrace-check-for-empty-hash-and-comment-the-race-with-registering-probes.patch
new file mode 100644
index 0000000000..2ecf741c35
--- /dev/null
+++ b/patches.suse/ftrace-check-for-empty-hash-and-comment-the-race-with-registering-probes.patch
@@ -0,0 +1,49 @@
+From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+Date: Fri, 30 Aug 2019 16:30:01 -0400
+Subject: ftrace: Check for empty hash and comment the race with registering
+ probes
+Git-commit: 372e0d01da71c84dcecf7028598a33813b0d5256
+Patch-mainline: v5.3-rc7
+References: bsc#1149418
+
+The race between adding a function probe and reading the probes that exist
+is very subtle. It needs a comment. Also, the issue can also happen if the
+probe has has the EMPTY_HASH as its func_hash.
+
+Cc: stable@vger.kernel.org
+Fixes: 7b60f3d876156 ("ftrace: Dynamically create the probe ftrace_ops for the trace_array")
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Acked-by: Miroslav Benes <mbenes@suse.cz>
+---
+ kernel/trace/ftrace.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
+index 80beed2cf0da..6200a6fe10e3 100644
+--- a/kernel/trace/ftrace.c
++++ b/kernel/trace/ftrace.c
+@@ -3096,7 +3096,11 @@ t_probe_next(struct seq_file *m, loff_t *pos)
+
+ hash = iter->probe->ops.func_hash->filter_hash;
+
+- if (!hash)
++ /*
++ * A probe being registered may temporarily have an empty hash
++ * and it's at the end of the func_probes list.
++ */
++ if (!hash || hash == EMPTY_HASH)
+ return NULL;
+
+ size = 1 << hash->size_bits;
+@@ -4324,6 +4328,10 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
+
+ mutex_unlock(&ftrace_lock);
+
++ /*
++ * Note, there's a small window here that the func_hash->filter_hash
++ * may be NULL or empty. Need to be carefule when reading the loop.
++ */
+ mutex_lock(&probe->ops.func_hash->regex_lock);
+
+ orig_hash = &probe->ops.func_hash->filter_hash;
+
diff --git a/series.conf b/series.conf
index 82efae56e9..0c208975aa 100644
--- a/series.conf
+++ b/series.conf
@@ -24158,6 +24158,7 @@
patches.suse/mmc-sdhci-of-at91-add-quirk-for-broken-HS200.patch
patches.suse/kvm-x86-don-t-update-rip-or-do-single-step-on-faulting-emulation
patches.suse/ftrace-fix-null-pointer-dereference-in-t_probe_next.patch
+ patches.suse/ftrace-check-for-empty-hash-and-comment-the-race-with-registering-probes.patch
patches.suse/batman-adv-Only-read-OGM-tvlv_len-after-buffer-len-c.patch
patches.suse/batman-adv-Only-read-OGM2-tvlv_len-after-buffer-len-.patch
patches.suse/usb-host-xhci-rcar-Fix-typo-in-compatible-string-mat.patch