powerpc/lib/code-patching: Use alternate map for patch_instruction()
authorBalbir Singh <bsingharora@gmail.com>
Wed, 28 Jun 2017 17:04:05 +0000 (03:04 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 3 Jul 2017 13:12:19 +0000 (23:12 +1000)
commit37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1
tree0e6d72132ce557c01a8554043aa6ce34cfb83b7d
parentefe4fbb1ac3a6489c1dc7d31b51ecb7425807b1b
powerpc/lib/code-patching: Use alternate map for patch_instruction()

This patch creates the window using text_poke_area, allocated via
get_vm_area(). text_poke_area is per CPU to avoid locking.
text_poke_area for each cpu is setup using late_initcall, prior to
setup of these alternate mapping areas, we continue to use direct
write to change/modify kernel text. With the ability to use alternate
mappings to write to kernel text, it provides us the freedom to then
turn text read-only and implement CONFIG_STRICT_KERNEL_RWX.

This code is CPU hotplug aware to ensure that the we have mappings for
any new cpus as they come online and tear down mappings for any CPUs
that go offline.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/lib/code-patching.c