kernel-fxtec-pro1x/arch
Qian Cai 080fcec7b9 powerpc/64s/pgtable: fix an undefined behaviour
[ Upstream commit c2e929b18cea6cbf71364f22d742d9aad7f4677a ]

Booting a power9 server with hash MMU could trigger an undefined
behaviour because pud_offset(p4d, 0) will do,

0 >> (PAGE_SHIFT:16 + PTE_INDEX_SIZE:8 + H_PMD_INDEX_SIZE:10)

Fix it by converting pud_index() and friends to static inline
functions.

UBSAN: shift-out-of-bounds in arch/powerpc/mm/ptdump/ptdump.c:282:15
shift exponent 34 is too large for 32-bit type 'int'
CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.6.0-rc4-next-20200303+ #13
Call Trace:
dump_stack+0xf4/0x164 (unreliable)
ubsan_epilogue+0x18/0x78
__ubsan_handle_shift_out_of_bounds+0x160/0x21c
walk_pagetables+0x2cc/0x700
walk_pud at arch/powerpc/mm/ptdump/ptdump.c:282
(inlined by) walk_pagetables at arch/powerpc/mm/ptdump/ptdump.c:311
ptdump_check_wx+0x8c/0xf0
mark_rodata_ro+0x48/0x80
kernel_init+0x74/0x194
ret_from_kernel_thread+0x5c/0x74

Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Qian Cai <cai@lca.pw>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Link: https://lore.kernel.org/r/20200306044852.3236-1-cai@lca.pw
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-25 15:32:58 +02:00
..
alpha alpha: fix memory barriers so that they conform to the specification 2020-06-22 09:05:28 +02:00
arc ARC: [plat-eznps]: Restrict to CONFIG_ISA_ARCOMPACT 2020-06-07 13:17:55 +02:00
arm ARM: dts: sun8i-h2-plus-bananapi-m2-zero: Fix led polarity 2020-06-25 15:32:53 +02:00
arm64 arm64: tegra: Fix ethernet phy-mode for Jetson Xavier 2020-06-25 15:32:58 +02:00
c6x
h8300
hexagon hexagon: define ioremap_uc 2020-05-10 10:30:11 +02:00
ia64 mm/memory_hotplug: shrink zones when offlining memory 2020-01-29 16:43:27 +01:00
m68k m68k/PCI: Fix a memory leak in an error handling path 2020-06-25 15:32:50 +02:00
microblaze microblaze: Prevent the overflow of the start 2020-02-24 08:34:53 +01:00
mips MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe() 2020-06-22 09:05:19 +02:00
nds32
nios2 nios2: ksyms: Add missing symbol exports 2020-01-27 14:50:30 +01:00
openrisc arch/openrisc: Fix issues with access_ok() 2020-06-22 09:04:59 +02:00
parisc parisc: Fix kernel panic in mem_init() 2020-06-03 08:19:42 +02:00
powerpc powerpc/64s/pgtable: fix an undefined behaviour 2020-06-25 15:32:58 +02:00
riscv riscv: stacktrace: Fix undefined reference to `walk_stackframe' 2020-06-03 08:19:30 +02:00
s390 s390/mm: fix set_huge_pte_at() for empty ptes 2020-06-07 13:17:56 +02:00
sh Fix 'acccess_ok()' on alpha and SH 2020-06-22 09:04:58 +02:00
sparc sparc64: fix misuses of access_process_vm() in genregs32_[sg]et() 2020-06-22 09:05:28 +02:00
um um: ubd: Prevent buffer overrun on command completion 2020-04-23 10:30:19 +02:00
unicore32
x86 x86/purgatory: Disable various profiling and sanitizing options 2020-06-25 15:32:52 +02:00
xtensa xtensa: fix TLB sanity checker 2019-12-21 10:57:25 +01:00
.gitignore
Kconfig