tracing/kprobes: Enforce kprobes teardown after testing
Thomas Gleixner authored
commit 30e7d894 upstream.

Enabling the tracer selftest triggers occasionally the warning in
text_poke(), which warns when the to be modified page is not marked
reserved.

The reason is that the tracer selftest installs kprobes on functions marked
__init for testing. These probes are removed after the tests, but that
removal schedules the delayed kprobes_optimizer work, which will do the
actual text poke. If the work is executed after the init text is freed,
then the warning triggers. The bug can be reproduced reliably when the work
delay is increased.

Flush the optimizer work and wait for the optimizing/unoptimizing lists to
become empty before returning from the kprobes tracer selftest. That
ensures that all operations which were queued due to the probes removal
have completed.

Link: http://lkml.kernel.org/r/20170516094802.76a468bb@gandalf.local.home

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: Ma...
dd0023d7
Name Last commit Last update
..
acpi ACPICA: Linuxize: Restore and fix Intel compiler build
asm-generic asm-prototypes: Clear any CPP defines before declaring the functions
clocksource clocksource/drivers/sp804: Convert init function to return error
crypto crypto: ahash - Fix EINPROGRESS notification callback
drm drm/i915: more .is_mobile cleanups for BDW
dt-bindings ARM: dts: r8a7794: remove Z clock
keys KEYS: Strip trailing spaces
kvm ARM: KVM: Support vgic-v3
linux tracing/kprobes: Enforce kprobes teardown after testing
math-emu math-emu: fix floating-point to integer overflow detection
media Merge tag 'v4.8' into patchwork
memory ddr: add LPDDR2 data from JESD209-2
misc cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards
net ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf
pcmcia pcmcia/ds.h: introduce helper for pcmcia_driver module boilerplate
ras tracing, RAS: Cleanup on __get_str() usage
rdma RDMA/core: Fix incorrect structure packing for booleans
rxrpc rxrpc: Add tracepoint for ACK proposal
scsi scsi: libiscsi: add lock around task lists to fix list corruption regression
soc ARM: at91: define LPDDR types
sound ASoC: hdmi-codec: use unsigned type to structure members with bit-field
target target: Avoid mappedlun symlink creation during lun shutdown
trace tracing: Add #undef to fix compile error
uapi net: ipv6: RTF_PCPU should not be settable from userspace
video Merge tag 'fbdev-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux
xen xen: Revert commits da72ff5b and 72a9b186
Kbuild UAPI: remove empty Kbuild files