# git rev-parse -q --verify b1ad106c02e19d81927b5a522167780525569490^{commit} b1ad106c02e19d81927b5a522167780525569490 already have revision, skipping fetch # git checkout -q -f -B kisskb b1ad106c02e19d81927b5a522167780525569490 # git clean -qxdf # < git log -1 # commit b1ad106c02e19d81927b5a522167780525569490 # Author: Michael Ellerman # Date: Tue Mar 3 23:28:47 2020 +1100 # # powerpc/mm: Fix missing KUAP disable in flush_coherent_icache() # # We received a report of strange kernel faults which turned out to be # due to a missing KUAP disable in flush_coherent_icache() called # from flush_icache_range(). # # The fault looks like: # # Kernel attempted to access user page (7fffc30d9c00) - exploit attempt? (uid: 1009) # BUG: Unable to handle kernel data access on read at 0x7fffc30d9c00 # Faulting instruction address: 0xc00000000007232c # Oops: Kernel access of bad area, sig: 11 [#1] # LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV # CPU: 35 PID: 5886 Comm: sigtramp Not tainted 5.6.0-rc2-gcc-8.2.0-00003-gfc37a1632d40 #79 # NIP: c00000000007232c LR: c00000000003b7fc CTR: 0000000000000000 # REGS: c000001e11093940 TRAP: 0300 Not tainted (5.6.0-rc2-gcc-8.2.0-00003-gfc37a1632d40) # MSR: 900000000280b033 CR: 28000884 XER: 00000000 # CFAR: c0000000000722fc DAR: 00007fffc30d9c00 DSISR: 08000000 IRQMASK: 0 # GPR00: c00000000003b7fc c000001e11093bd0 c0000000023ac200 00007fffc30d9c00 # GPR04: 00007fffc30d9c18 0000000000000000 c000001e11093bd4 0000000000000000 # GPR08: 0000000000000000 0000000000000001 0000000000000000 c000001e1104ed80 # GPR12: 0000000000000000 c000001fff6ab380 c0000000016be2d0 4000000000000000 # GPR16: c000000000000000 bfffffffffffffff 0000000000000000 0000000000000000 # GPR20: 00007fffc30d9c00 00007fffc30d8f58 00007fffc30d9c18 00007fffc30d9c20 # GPR24: 00007fffc30d9c18 0000000000000000 c000001e11093d90 c000001e1104ed80 # GPR28: c000001e11093e90 0000000000000000 c0000000023d9d18 00007fffc30d9c00 # NIP flush_icache_range+0x5c/0x80 # LR handle_rt_signal64+0x95c/0xc2c # Call Trace: # 0xc000001e11093d90 (unreliable) # handle_rt_signal64+0x93c/0xc2c # do_notify_resume+0x310/0x430 # ret_from_except_lite+0x70/0x74 # Instruction dump: # 409e002c 7c0802a6 3c62ff31 3863f6a0 f8010080 48195fed 60000000 48fe4c8d # 60000000 e8010080 7c0803a6 7c0004ac <7c00ffac> 7c0004ac 4c00012c 38210070 # # This path through handle_rt_signal64() to setup_trampoline() and # flush_icache_range() is only triggered by 64-bit processes that have # unmapped their VDSO, which is rare. # # flush_icache_range() takes a range of addresses to flush. In # flush_coherent_icache() we implement an optimisation for CPUs where we # know we don't actually have to flush the whole range, we just need to # do a single icbi. # # However we still execute the icbi on the user address of the start of # the range we're flushing. On CPUs that also implement KUAP (Power9) # that leads to the spurious fault above. # # We should be able to pass any address, including a kernel address, to # the icbi on these CPUs, which would avoid any interaction with KUAP. # But I don't want to make that change in a bug fix, just in case it # surfaces some strange behaviour on some CPU. # # So for now just disable KUAP around the icbi. Note the icbi is treated # as a load, so we allow read access, not write as you'd expect. # # Fixes: 890274c2dc4c ("powerpc/64s: Implement KUAP for Radix MMU") # Cc: stable@vger.kernel.org # v5.2+ # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 b1ad106c02e19d81927b5a522167780525569490 # < make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-fixes_mpc85xx_defconfig+KVM_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- mpc85xx_defconfig # Added to kconfig CONFIG_PPC_E500MC=y # Added to kconfig CONFIG_VIRTUALIZATION=y # Added to kconfig CONFIG_KVM_E500MC=y # Added to kconfig # < make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-fixes_mpc85xx_defconfig+KVM_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-fixes_mpc85xx_defconfig+KVM_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig .config:4063:warning: override: reassigning to symbol PPC_E500MC .config:4064:warning: override: reassigning to symbol VIRTUALIZATION # make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-fixes_mpc85xx_defconfig+KVM_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- In file included from /kisskb/src/include/linux/kernel.h:11, from /kisskb/src/include/linux/list.h:9, from /kisskb/src/include/linux/module.h:12, from /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:15: /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c: In function 'allocate_bd': /kisskb/src/include/linux/err.h:22:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 22 | #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) | ^ /kisskb/src/include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:139:6: note: in expansion of macro 'IS_ERR_VALUE' 139 | if (IS_ERR_VALUE(fep->ring_mem_addr)) | ^~~~~~~~~~~~ /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8541cds.dts:330.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8555cds.dts:330.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe62988) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) INFO: Uncompressed kernel (size 0xe52184) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xf00000) Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6720282 Bytes = 6562.78 KiB = 6.41 MiB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6754860 Bytes = 6596.54 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755984 Bytes = 6597.64 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6756040 Bytes = 6597.70 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755357 Bytes = 6597.03 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f0031c Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755844 Bytes = 6597.50 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:24 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6754891 Bytes = 6596.57 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755517 Bytes = 6597.18 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755523 Bytes = 6597.19 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755114 Bytes = 6596.79 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f0031c Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755126 Bytes = 6596.80 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f0031c Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755892 Bytes = 6597.55 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755112 Bytes = 6596.79 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f0031c Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755471 Bytes = 6597.14 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f0031c Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6756039 Bytes = 6597.69 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Image Name: Linux-5.6.0-rc2-gb1ad106c02e1 Created: Wed Mar 4 01:37:25 2020 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6755328 Bytes = 6597.00 KiB = 6.44 MiB Load Address: 00f00000 Entry Point: 00f002cc Completed OK # rm -rf /kisskb/build/powerpc-fixes_mpc85xx_defconfig+KVM_powerpc-gcc9 # Build took: 0:02:47.546244