]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
powerpc: Ensure .mem(init|exit).text are within _stext/_etext
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 15 Sep 2016 05:11:59 +0000 (15:11 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 19 Sep 2016 00:53:56 +0000 (10:53 +1000)
commit7de3b27bac47da9de08409df1d69664acbb72197
tree34c3d7f43012a3a5a686ce95c7d94d731b0dddb4
parentbea2dccccfd47ef3f8612f1265f653f8e018d793
powerpc: Ensure .mem(init|exit).text are within _stext/_etext

In our linker script we open code the list of text sections, because we
need to include the __ftr_alt sections, which are arch-specific.

This means we can't use TEXT_TEXT as defined in vmlinux.lds.h, and so we
don't have the MEM_KEEP() logic for memory hotplug sections.

If we build the kernel with the gold linker, and with CONFIG_MEMORY_HOTPLUG=y,
we see that functions marked __meminit can end up outside of the
_stext/_etext range, and also outside of _sinittext/_einittext, eg:

    c000000000000000 T _stext
    c0000000009e0000 A _etext
    c0000000009e3f18 T hash__vmemmap_create_mapping
    c000000000ca0000 T _sinittext
    c000000000d00844 T _einittext

This causes them to not be recognised as text by is_kernel_text(), and
prevents them being patched by jump_label (and presumably ftrace/kprobes
etc.).

Fix it by adding MEM_KEEP() directives, mirroring what TEXT_TEXT does.

This isn't a problem when CONFIG_MEMORY_HOTPLUG=n, because we use the
standard INIT_TEXT_SECTION() and EXIT_TEXT macros from vmlinux.lds.h.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/vmlinux.lds.S