Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-14 11:59:09 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-14 11:59:09 +0100
commita34e8dd3dfcf216bf5da1cd83a3912d7ef608437 (patch)
tree904e962770b69a8cb61a62dd7f40e4362adf5bac
parent81f4204151efaa1879b2b1886b56b84ef41be5d5 (diff)
kprobes: Return error if we fail to reuse kprobe instead of
BUG_ON() (bsc#1051510).
-rw-r--r--patches.fixes/kprobes-Return-error-if-we-fail-to-reuse-kprobe-inst.patch90
-rw-r--r--series.conf1
2 files changed, 91 insertions, 0 deletions
diff --git a/patches.fixes/kprobes-Return-error-if-we-fail-to-reuse-kprobe-inst.patch b/patches.fixes/kprobes-Return-error-if-we-fail-to-reuse-kprobe-inst.patch
new file mode 100644
index 0000000000..235ec99390
--- /dev/null
+++ b/patches.fixes/kprobes-Return-error-if-we-fail-to-reuse-kprobe-inst.patch
@@ -0,0 +1,90 @@
+From 819319fc93461c07b9cdb3064f154bd8cfd48172 Mon Sep 17 00:00:00 2001
+From: Masami Hiramatsu <mhiramat@kernel.org>
+Date: Tue, 11 Sep 2018 19:20:40 +0900
+Subject: [PATCH] kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()
+Git-commit: 819319fc93461c07b9cdb3064f154bd8cfd48172
+Patch-mainline: v4.20-rc1
+References: bsc#1051510
+
+Make reuse_unused_kprobe() to return error code if
+it fails to reuse unused kprobe for optprobe instead
+of calling BUG_ON().
+
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
+Cc: David S . Miller <davem@davemloft.net>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Naveen N . Rao <naveen.n.rao@linux.vnet.ibm.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/153666124040.21306.14150398706331307654.stgit@devbox
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ kernel/kprobes.c | 27 ++++++++++++++++++++-------
+ 1 file changed, 20 insertions(+), 7 deletions(-)
+
+--- a/kernel/kprobes.c
++++ b/kernel/kprobes.c
+@@ -697,9 +697,10 @@ static void unoptimize_kprobe(struct kpr
+ }
+
+ /* Cancel unoptimizing for reusing */
+-static void reuse_unused_kprobe(struct kprobe *ap)
++static int reuse_unused_kprobe(struct kprobe *ap)
+ {
+ struct optimized_kprobe *op;
++ int ret;
+
+ BUG_ON(!kprobe_unused(ap));
+ /*
+@@ -713,8 +714,12 @@ static void reuse_unused_kprobe(struct k
+ /* Enable the probe again */
+ ap->flags &= ~KPROBE_FLAG_DISABLED;
+ /* Optimize it again (remove from op->list) */
+- BUG_ON(!kprobe_optready(ap));
++ ret = kprobe_optready(ap);
++ if (ret)
++ return ret;
++
+ optimize_kprobe(ap);
++ return 0;
+ }
+
+ /* Remove optimized instructions */
+@@ -933,11 +938,16 @@ static void __disarm_kprobe(struct kprob
+ #define kprobe_disarmed(p) kprobe_disabled(p)
+ #define wait_for_kprobe_optimizer() do {} while (0)
+
+-/* There should be no unused kprobes can be reused without optimization */
+-static void reuse_unused_kprobe(struct kprobe *ap)
++static int reuse_unused_kprobe(struct kprobe *ap)
+ {
++ /*
++ * If the optimized kprobe is NOT supported, the aggr kprobe is
++ * released at the same time that the last aggregated kprobe is
++ * unregistered.
++ * Thus there should be no chance to reuse unused kprobe.
++ */
+ printk(KERN_ERR "Error: There should be no unused kprobe here.\n");
+- BUG_ON(kprobe_unused(ap));
++ return -EINVAL;
+ }
+
+ static void free_aggr_kprobe(struct kprobe *p)
+@@ -1315,9 +1325,12 @@ static int register_aggr_kprobe(struct k
+ goto out;
+ }
+ init_aggr_kprobe(ap, orig_p);
+- } else if (kprobe_unused(ap))
++ } else if (kprobe_unused(ap)) {
+ /* This probe is going to die. Rescue it */
+- reuse_unused_kprobe(ap);
++ ret = reuse_unused_kprobe(ap);
++ if (ret)
++ goto out;
++ }
+
+ if (kprobe_gone(ap)) {
+ /*
diff --git a/series.conf b/series.conf
index a0da16b579..2b1c5197f6 100644
--- a/series.conf
+++ b/series.conf
@@ -19007,6 +19007,7 @@
patches.drivers/mailbox-PCC-handle-parse-error.patch
patches.fixes/0001-xen-swiotlb-use-actually-allocated-size-on-check-phy.patch
patches.arch/s390-sthyi-fix-machine-name-validity-indication
+ patches.fixes/kprobes-Return-error-if-we-fail-to-reuse-kprobe-inst.patch
patches.suse/sched-numa-remove-unused-code-from-update_numa_stats.patch
patches.suse/sched-numa-remove-unused-nr_running-field.patch
patches.arch/x86-corruption-check-fix-panic-in-memory_corruption_check-when-boot-option-without-value-is-provided