Revision 5f843ed415581cfad4ef8fefe31c138a8346ca8a authored by Masami Hiramatsu on 15 April 2019, 06:01:25 UTC, committed by Ingo Molnar on 16 April 2019, 07:38:16 UTC
The following commit introduced a bug in one of our error paths:

  819319fc9346 ("kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()")

it missed to handle the return value of kprobe_optready() as
error-value. In reality, the kprobe_optready() returns a bool
result, so "true" case must be passed instead of 0.

This causes some errors on kprobe boot-time selftests on ARM:

 [   ] Beginning kprobe tests...
 [   ] Probe ARM code
 [   ]     kprobe
 [   ]     kretprobe
 [   ] ARM instruction simulation
 [   ]     Check decoding tables
 [   ]     Run test cases
 [   ] FAIL: test_case_handler not run
 [   ] FAIL: Test andge	r10, r11, r14, asr r7
 [   ] FAIL: Scenario 11
 ...
 [   ] FAIL: Scenario 7
 [   ] Total instruction simulation tests=1631, pass=1433 fail=198
 [   ] kprobe tests failed

This can happen if an optimized probe is unregistered and next
kprobe is registered on same address until the previous probe
is not reclaimed.

If this happens, a hidden aggregated probe may be kept in memory,
and no new kprobe can probe same address. Also, in that case
register_kprobe() will return "1" instead of minus error value,
which can mislead caller logic.

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>
Cc: stable@vger.kernel.org # v5.0+
Fixes: 819319fc9346 ("kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()")
Link: http://lkml.kernel.org/r/155530808559.32517.539898325433642204.stgit@devnote2
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 618d919
History
File Mode Size
Makefile -rw-r--r-- 1.3 KB
autogroup.c -rw-r--r-- 6.4 KB
autogroup.h -rw-r--r-- 1.4 KB
clock.c -rw-r--r-- 12.1 KB
completion.c -rw-r--r-- 10.0 KB
core.c -rw-r--r-- 174.9 KB
cpuacct.c -rw-r--r-- 8.1 KB
cpudeadline.c -rw-r--r-- 5.9 KB
cpudeadline.h -rw-r--r-- 637 bytes
cpufreq.c -rw-r--r-- 2.1 KB
cpufreq_schedutil.c -rw-r--r-- 25.4 KB
cpupri.c -rw-r--r-- 6.7 KB
cpupri.h -rw-r--r-- 610 bytes
cputime.c -rw-r--r-- 22.3 KB
deadline.c -rw-r--r-- 74.8 KB
debug.c -rw-r--r-- 24.4 KB
fair.c -rw-r--r-- 283.6 KB
features.h -rw-r--r-- 2.4 KB
idle.c -rw-r--r-- 10.8 KB
isolation.c -rw-r--r-- 4.0 KB
loadavg.c -rw-r--r-- 11.0 KB
membarrier.c -rw-r--r-- 9.3 KB
pelt.c -rw-r--r-- 10.2 KB
pelt.h -rw-r--r-- 5.0 KB
psi.c -rw-r--r-- 21.9 KB
rt.c -rw-r--r-- 63.3 KB
sched-pelt.h -rw-r--r-- 601 bytes
sched.h -rw-r--r-- 60.5 KB
stats.c -rw-r--r-- 2.9 KB
stats.h -rw-r--r-- 7.5 KB
stop_task.c -rw-r--r-- 3.3 KB
swait.c -rw-r--r-- 3.3 KB
topology.c -rw-r--r-- 55.5 KB
wait.c -rw-r--r-- 13.0 KB
wait_bit.c -rw-r--r-- 6.8 KB

back to top