jump_label: Fix jump_label_text_reserved() vs __init
authorPeter Zijlstra <peterz@infradead.org>
Mon, 28 Jun 2021 11:24:10 +0000 (13:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:05:58 +0000 (16:05 +0200)
commit59ae35884c5e6a90e9659f43dda20b0167fc9f8d
treea6e544f9fce402d2c7fcc3fed2536a085e695f09
parent143a6b8ec5c6b6e85d1f3a80d5326a83a914effa
jump_label: Fix jump_label_text_reserved() vs __init

[ Upstream commit 9e667624c291753b8a5128f620f493d0b5226063 ]

It turns out that jump_label_text_reserved() was reporting __init text
as being reserved past the time when the __init text was freed and
re-used.

For a long time, this resulted in, at worst, not being able to kprobe
text that happened to land at the re-used address. However a recent
commit e7bf1ba97afd ("jump_label, x86: Emit short JMP") made it a
fatal mistake because it now needs to read the instruction in order to
determine the conflict -- an instruction that's no longer there.

Fixes: 4c3ef6d79328 ("jump label: Add jump_label_text_reserved() to reserve jump points")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20210628113045.045141693@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/jump_label.c