# git rev-parse -q --verify 2d4f9bdc22740d10984b850bdd74a86ad8ed3d23^{commit} 2d4f9bdc22740d10984b850bdd74a86ad8ed3d23 already have revision, skipping fetch # git checkout -q -f -B kisskb 2d4f9bdc22740d10984b850bdd74a86ad8ed3d23 # git clean -qxdf # < git log -1 # commit 2d4f9bdc22740d10984b850bdd74a86ad8ed3d23 # Author: Michael Ellerman # Date: Tue May 14 23:00:58 2019 +1000 # # powerpc/mm: Fix crashes with hugepages & 4K pages # # The recent commit to cleanup ifdefs in the hugepage initialisation led # to crashes when using 4K pages as reported by Sachin: # # BUG: Kernel NULL pointer dereference at 0x0000001c # Faulting instruction address: 0xc000000001d1e58c # Oops: Kernel access of bad area, sig: 11 [#1] # LE PAGE_SIZE=4K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries # ... # CPU: 3 PID: 4635 Comm: futex_wake04 Tainted: G W O 5.1.0-next-20190507-autotest #1 # NIP: c000000001d1e58c LR: c000000001d1e54c CTR: 0000000000000000 # REGS: c000000004937890 TRAP: 0300 # MSR: 8000000000009033 CR: 22424822 XER: 00000000 # CFAR: c00000000183e9e0 DAR: 000000000000001c DSISR: 40000000 IRQMASK: 0 # ... # NIP kmem_cache_alloc+0xbc/0x5a0 # LR kmem_cache_alloc+0x7c/0x5a0 # Call Trace: # huge_pte_alloc+0x580/0x950 # hugetlb_fault+0x9a0/0x1250 # handle_mm_fault+0x490/0x4a0 # __do_page_fault+0x77c/0x1f00 # do_page_fault+0x28/0x50 # handle_page_fault+0x18/0x38 # # This is caused by us trying to allocate from a NULL kmem cache in # __hugepte_alloc(). The kmem cache is NULL because it was never # allocated in hugetlbpage_init(), because add_huge_page_size() returned # an error. # # The reason add_huge_page_size() returned an error is a simple typo, we # are calling check_and_get_huge_psize(size) when we should be passing # shift instead. # # The fact that we're able to trigger this path when the kmem caches are # NULL is a separate bug, ie. we should not advertise any hugepage sizes # if we haven't setup the required caches for them. # # This was only seen with 4K pages, with 64K pages we don't need to # allocate any extra kmem caches because the 16M hugepage just occupies # a single entry at the PMD level. # # Fixes: 723f268f19da ("powerpc/mm: cleanup ifdef mess in add_huge_page_size()") # Reported-by: Sachin Sant # Tested-by: Sachin Sant # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 2d4f9bdc22740d10984b850bdd74a86ad8ed3d23 # < make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-fixes_52xx_lite5200b_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- 52xx/lite5200b_defconfig # make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-fixes_52xx_lite5200b_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- :1388:2: warning: #warning syscall open_tree not implemented [-Wcpp] :1391:2: warning: #warning syscall move_mount not implemented [-Wcpp] :1394:2: warning: #warning syscall fsopen not implemented [-Wcpp] :1397:2: warning: #warning syscall fsconfig not implemented [-Wcpp] :1400:2: warning: #warning syscall fsmount not implemented [-Wcpp] :1403:2: warning: #warning syscall fspick not implemented [-Wcpp] /kisskb/src/arch/powerpc/platforms/52xx/lite5200_sleep.S: Assembler messages: /kisskb/src/arch/powerpc/platforms/52xx/lite5200_sleep.S:184: Warning: invalid register expression /kisskb/src/kernel/futex.c: In function 'do_futex': /kisskb/src/kernel/futex.c:1658:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized] return oldval == cmparg; ^ /kisskb/src/kernel/futex.c:1633:6: note: 'oldval' was declared here int oldval, ret; ^ INFO: Uncompressed kernel (size 0x5033ac) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0x600000) INFO: Uncompressed kernel (size 0x5033ac) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0x600000) INFO: Uncompressed kernel (size 0x4f2cc8) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0x500000) Image Name: Linux-5.1.0-g2d4f9bdc2274 Created: Wed May 15 06:41:48 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 2563017 Bytes = 2502.95 KiB = 2.44 MiB Load Address: 00600000 Entry Point: 00600284 Image Name: Linux-5.1.0-g2d4f9bdc2274 Created: Wed May 15 06:41:48 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 2533760 Bytes = 2474.38 KiB = 2.42 MiB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-5.1.0-g2d4f9bdc2274 Created: Wed May 15 06:41:49 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 2562629 Bytes = 2502.57 KiB = 2.44 MiB Load Address: 00600000 Entry Point: 00600284 Completed OK # rm -rf /kisskb/build/powerpc-fixes_52xx_lite5200b_defconfig_powerpc-gcc5 # Build took: 0:00:21.330845