OSDN Git Service

powerpc: Fix boot on BOOK3S_32 with CONFIG_STRICT_KERNEL_RWX
authorChristophe Leroy <christophe.leroy@c-s.fr>
Tue, 21 Nov 2017 14:28:20 +0000 (15:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:56 +0000 (08:40 +0000)
commitdf4d69feaf017cd2d6d521d5d32870e7e05f7121
tree491a8149323a660274bb9431322811a9def5f342
parentc7311af0e236710e57a71bc942d1fd1f968865a5
powerpc: Fix boot on BOOK3S_32 with CONFIG_STRICT_KERNEL_RWX

commit 252eb55816a6f69ef9464cad303cdb3326cdc61d upstream.

On powerpc32, patch_instruction() is called by apply_feature_fixups()
which is called from early_init()

There is the following note in front of early_init():
 * Note that the kernel may be running at an address which is different
 * from the address that it was linked at, so we must use RELOC/PTRRELOC
 * to access static data (including strings).  -- paulus

Therefore, slab_is_available() cannot be called yet, and
text_poke_area must be addressed with PTRRELOC()

Fixes: 95902e6c8864 ("powerpc/mm: Implement STRICT_KERNEL_RWX on PPC32")
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/lib/code-patching.c