TencentOS-kernel/arch/powerpc
Ariel Marcovitch 4b9d41a9bc powerpc: Fix alignment bug within the init sections
[ Upstream commit 2225a8dda263edc35a0e8b858fe2945cf6240fde ]

This is a bug that causes early crashes in builds with an .exit.text
section smaller than a page and an .init.text section that ends in the
beginning of a physical page (this is kinda random, which might
explain why this wasn't really encountered before).

The init sections are ordered like this:
  .init.text
  .exit.text
  .init.data

Currently, these sections aren't page aligned.

Because the init code might become read-only at runtime and because
the .init.text section can potentially reside on the same physical
page as .init.data, the beginning of .init.data might be mapped
read-only along with .init.text.

Then when the kernel tries to modify a variable in .init.data (like
kthreadd_done, used in kernel_init()) the kernel panics.

To avoid this, make _einittext page aligned and also align .exit.text
to make sure .init.data is always seperated from the text segments.

Fixes: 060ef9d89d18 ("powerpc32: PAGE_EXEC required for inittext")
Signed-off-by: Ariel Marcovitch <ariel.marcovitch@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210102201156.10805-1-ariel.marcovitch@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-04-12 12:51:36 +08:00
..
boot powerpc/boot: Fix CONFIG_PPC_MPC52XX references 2021-03-16 16:33:42 +08:00
configs vgacon: remove software scrollback support 2021-03-16 16:36:07 +08:00
crypto Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
include powerpc/bitops: Fix possible undefined behaviour with fls() and fls64() 2021-03-16 16:43:50 +08:00
kernel powerpc: Fix alignment bug within the init sections 2021-04-12 12:51:36 +08:00
kvm KVM: PPC: Book3S HV: XIVE: Fix possible oops when accessing ESB page 2021-03-16 16:41:35 +08:00
lib powerpc/64s: flush L1D after user accesses 2021-03-16 16:41:00 +08:00
math-emu Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mm powerpc/mm: Fix verification of MMU_FTR_TYPE_44x 2021-03-16 16:43:34 +08:00
net Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
oprofile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
perf powerpc/perf: Exclude kernel samples while counting events in user space. 2021-03-16 16:43:29 +08:00
platforms powerpc/powernv/memtrace: Fix crashing the kernel when enabling concurrently 2021-03-16 16:43:34 +08:00
purgatory Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sysdev powerpc: sysdev: add missing iounmap() on error in mpic_msgr_probe() 2021-03-16 16:43:55 +08:00
tools Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xmon powerpc/xmon: Change printk() to pr_cont() 2021-03-16 16:43:34 +08:00
Kbuild Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig powerpc/rtas: Restrict RTAS requests from userspace 2021-03-16 16:40:06 +08:00
Kconfig.debug Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile powerpc: Drop -me200 addition to build flags 2021-03-16 16:42:10 +08:00
Makefile.postlink Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00