TencentOS-kernel/arch
Joerg Roedel 6b304f2857 x86, vmlinux.lds: Page-align end of ..page_aligned sections
commit de2b41be8fcccb2f5b6c480d35df590476344201 upstream.

On x86-32 the idt_table with 256 entries needs only 2048 bytes. It is
page-aligned, but the end of the .bss..page_aligned section is not
guaranteed to be page-aligned.

As a result, objects from other .bss sections may end up on the same 4k
page as the idt_table, and will accidentially get mapped read-only during
boot, causing unexpected page-faults when the kernel writes to them.

This could be worked around by making the objects in the page aligned
sections page sized, but that's wrong.

Explicit sections which store only page aligned objects have an implicit
guarantee that the object is alone in the page in which it is placed. That
works for all objects except the last one. That's inconsistent.

Enforcing page sized objects for these sections would wreckage memory
sanitizers, because the object becomes artificially larger than it should
be and out of bound access becomes legit.

Align the end of the .bss..page_aligned and .data..page_aligned section on
page-size so all objects places in these sections are guaranteed to have
their own page.

[ tglx: Amended changelog ]

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20200721093448.10417-1-joro@8bytes.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-16 16:32:39 +08:00
..
alpha scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
arc ARC: elf: use right ELF_ARCH 2021-03-16 16:31:39 +08:00
arm ARM: dts: n900: remove mmc1 card detect gpio 2021-03-16 16:32:30 +08:00
arm64 arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP 2021-03-16 16:32:33 +08:00
c6x Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
csky csky: Fixup abiv2 syscall_trace break a4 & a5 2021-03-16 16:28:56 +08:00
h8300 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hexagon hexagon: define ioremap_uc 2021-03-16 16:27:29 +08:00
ia64 scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
m68k scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
microblaze Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mips irqdomain/treewide: Keep firmware node unconditionally allocated 2021-03-16 16:32:20 +08:00
nds32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nios2 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
openrisc openrisc: Fix issue with argument clobbering for clone/fork 2021-03-16 16:30:27 +08:00
parisc parisc: Add atomic64_set_release() define to avoid CPU soft lockups 2021-03-16 16:32:39 +08:00
powerpc powerpc/pseries/svm: Fix incorrect check for shared_lppaca_size 2021-03-16 16:32:13 +08:00
riscv RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw 2021-03-16 16:32:34 +08:00
s390 s390/maccess: add no DAT mode to kernel_write 2021-03-16 16:31:41 +08:00
sh scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
sparc scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
um um: ensure `make ARCH=um mrproper` removes arch/$(SUBARCH)/include/generated/ 2021-03-16 16:27:11 +08:00
unicore32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
x86 x86, vmlinux.lds: Page-align end of ..page_aligned sections 2021-03-16 16:32:39 +08:00
xtensa xtensa: update *pos in cpuinfo_op.next 2021-03-16 16:32:19 +08:00
.gitignore 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 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00