Naveen N. Rao 82123a3d1d powerpc/kprobes: Fix validation of prefixed instructions across page boundary
When checking if the probed instruction is the suffix of a prefixed
instruction, we access the instruction at the previous word. If the
probed instruction is the very first word of a module, we can end up
trying to access an invalid page.

Fix this by skipping the check for all instructions at the beginning of
a page. Prefixed instructions cannot cross a 64-byte boundary and as
such, we don't expect to encounter a suffix as the very first word in a
page for kernel text. Even if there are prefixed instructions crossing
a page boundary (from a module, for instance), the instruction will be
illegal, so preventing probing on the suffix of such prefix instructions
isn't worthwhile.

Fixes: b4657f7650ba ("powerpc/kprobes: Don't allow breakpoints on suffixes")
Cc: stable@vger.kernel.org # v5.8+
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/0df9a032a05576a2fa8e97d1b769af2ff0eafbd6.1621416666.git.naveen.n.rao@linux.vnet.ibm.com
2021-05-28 21:52:42 +10:00
..
2021-04-30 12:22:28 -07:00
2021-04-30 12:22:28 -07:00
2020-08-07 18:48:15 -07:00
2021-04-23 01:38:04 +10:00
2021-03-29 13:22:11 +11:00
2021-04-22 20:59:04 +10:00
2020-12-09 23:48:14 +11:00
2020-12-04 01:01:09 +11:00
2021-04-21 22:52:32 +10:00
2021-04-30 11:20:40 -07:00
2021-03-24 14:09:29 +11:00
2021-04-17 10:40:51 +10:00
2021-02-09 00:10:50 +11:00
2021-04-30 12:22:28 -07:00