# git rev-parse -q --verify a5a1fb260210893015872209514f73b55ab2138e^{commit} a5a1fb260210893015872209514f73b55ab2138e already have revision, skipping fetch # git checkout -q -f -B kisskb a5a1fb260210893015872209514f73b55ab2138e # git clean -qxdf # < git log -1 # commit a5a1fb260210893015872209514f73b55ab2138e # Author: Michael Ellerman # Date: Wed May 8 13:06:42 2019 +1000 # # powerpc/64s: Use early_mmu_has_feature() in set_kuap() # # When implementing the KUAP support on Radix we fixed one case where # mmu_has_feature() was being called too early in boot via # __put_user_size(). # # However since then some new code in linux-next has created a new path # via which we can end up calling mmu_has_feature() too early. # # On P9 this leads to crashes early in boot if we have both PPC_KUAP and # CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG enabled. Our early boot code # calls printk() which calls probe_kernel_read(), that does a # __copy_from_user_inatomic() which calls into set_kuap() and that uses # mmu_has_feature(). # # At that point in boot we haven't patched MMU features yet so the debug # code in mmu_has_feature() complains, and calls printk(). At that point # we recurse, eg: # # ... # dump_stack+0xdc # probe_kernel_read+0x1a4 # check_pointer+0x58 # ... # printk+0x40 # dump_stack_print_info+0xbc # dump_stack+0x8 # probe_kernel_read+0x1a4 # probe_kernel_read+0x19c # check_pointer+0x58 # ... # printk+0x40 # cpufeatures_process_feature+0xc8 # scan_cpufeatures_subnodes+0x380 # of_scan_flat_dt_subnodes+0xb4 # dt_cpu_ftrs_scan_callback+0x158 # of_scan_flat_dt+0xf0 # dt_cpu_ftrs_scan+0x3c # early_init_devtree+0x360 # early_setup+0x9c # # And so on for infinity, symptom is a dead system. # # Even more fun is what happens when using the hash MMU (ie. p8 or p9 # with Radix disabled), and when we don't have # CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG enabled. With the debug disabled # we don't check if static keys have been initialised, we just rely on # the jump label. But the jump label defaults to true so we just whack # the AMR even though Radix is not enabled. # # Clearing the AMR is fine, but after we've done the user copy we write # (0b11 << 62) into AMR. When using hash that makes all pages with key # zero no longer readable or writable. All kernel pages implicitly have # key zero, and so all of a sudden the kernel can't read or write any of # its memory. Again dead system. # # In the medium term we have several options for fixing this. # probe_kernel_read() doesn't need to touch AMR at all, it's not doing a # user access after all, but it uses __copy_from_user_inatomic() just # because it's easy, we could fix that. # # It would also be safe to default to not writing to the AMR during # early boot, until we've detected features. But it's not clear that # flipping all the MMU features to static_key_false won't introduce # other bugs. # # But for now just switch to early_mmu_has_feature() in set_kuap(), that # avoids all the problems with jump labels. It adds the overhead of a # global lookup and test, but that's probably trivial compared to the # writes to the AMR anyway. # # Fixes: 890274c2dc4c ("powerpc/64s: Implement KUAP for Radix MMU") # 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 a5a1fb260210893015872209514f73b55ab2138e # < make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_ppc64le-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- randconfig KCONFIG_SEED=0xF10E7210 WARNING: unmet direct dependencies detected for SND_SOC_MAX98927 Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m] Selected by [y]: - SND_SOC_SDM845 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && QCOM_APR [=y] && MFD_CROS_EC [=y] Selected by [m]: - SND_SOC_ALL_CODECS [=m] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && COMPILE_TEST [=y] && I2C [=m] WARNING: unmet direct dependencies detected for SND_SOC_MAX98927 Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m] Selected by [y]: - SND_SOC_SDM845 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && QCOM_APR [=y] && MFD_CROS_EC [=y] Selected by [m]: - SND_SOC_ALL_CODECS [=m] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && COMPILE_TEST [=y] && I2C [=m] # Added to kconfig CONFIG_STANDALONE=y # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_CPU_BIG_ENDIAN=n # Added to kconfig CONFIG_CPU_LITTLE_ENDIAN=y # Added to kconfig CONFIG_PPC64=y # Added to kconfig CONFIG_PPC_BOOK3E_64=n # Added to kconfig CONFIG_PPC_BOOK3S_64=y # Added to kconfig CONFIG_PPC_DISABLE_WERROR=y # Added to kconfig CONFIG_SECTION_MISMATCH_WARN_ONLY=y # Added to kconfig CONFIG_PREVENT_FIRMWARE_BUILD=y # Added to kconfig CONFIG_LD_HEAD_STUB_CATCH=y # yes \n | make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_ppc64le-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- oldconfig yes: standard output: Broken pipe # make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_ppc64le-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- WARNING: unmet direct dependencies detected for SND_SOC_MAX98927 Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m] Selected by [y]: - SND_SOC_SDM845 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && QCOM_APR [=y] && MFD_CROS_EC [=y] Selected by [m]: - SND_SOC_ALL_CODECS [=m] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && COMPILE_TEST [=y] && I2C [=m] WARNING: unmet direct dependencies detected for SND_SOC_MAX98927 Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m] Selected by [y]: - SND_SOC_SDM845 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && QCOM_APR [=y] && MFD_CROS_EC [=y] Selected by [m]: - SND_SOC_ALL_CODECS [=m] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && COMPILE_TEST [=y] && I2C [=m] WARNING: unmet direct dependencies detected for SND_SOC_MAX98927 Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m] Selected by [y]: - SND_SOC_SDM845 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && QCOM_APR [=y] && MFD_CROS_EC [=y] Selected by [m]: - SND_SOC_ALL_CODECS [=m] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && COMPILE_TEST [=y] && I2C [=m] :1478:2: warning: #warning syscall pidfd_send_signal not implemented [-Wcpp] :1481:2: warning: #warning syscall io_uring_setup not implemented [-Wcpp] :1484:2: warning: #warning syscall io_uring_enter not implemented [-Wcpp] :1487:2: warning: #warning syscall io_uring_register not implemented [-Wcpp] WARNING: vmlinux.o(.text+0x30d4): Section mismatch in reference from the variable __boot_from_prom to the function .init.text:prom_init() The function __boot_from_prom() references the function __init prom_init(). This is often because __boot_from_prom lacks a __init annotation or the annotation of prom_init is wrong. WARNING: vmlinux.o(.text+0x3334): Section mismatch in reference from the variable start_here_multiplatform to the function .init.text:early_setup() The function start_here_multiplatform() references the function __init early_setup(). This is often because start_here_multiplatform lacks a __init annotation or the annotation of early_setup is wrong. WARNING: vmlinux.o(.text+0x3370): Section mismatch in reference from the variable start_here_common to the function .init.text:start_kernel() The function start_here_common() references the function __init start_kernel(). This is often because start_here_common lacks a __init annotation or the annotation of start_kernel is wrong. sound/soc/codecs/max98927.o: In function `max98927_i2c_probe': max98927.c:(.text+0xcc8): undefined reference to `__devm_regmap_init_i2c' sound/soc/codecs/max98927.o: In function `max98927_i2c_driver_init': max98927.c:(.init.text+0x20): undefined reference to `i2c_register_driver' sound/soc/codecs/max98927.o: In function `max98927_i2c_driver_exit': max98927.c:(.exit.text+0x1c): undefined reference to `i2c_del_driver' sound/soc/codecs/rt5663.o: In function `rt5663_i2c_probe': rt5663.c:(.text+0x3080): undefined reference to `__devm_regmap_init_i2c' rt5663.c:(.text+0x3134): undefined reference to `__devm_regmap_init_i2c' rt5663.c:(.text+0x315c): undefined reference to `__devm_regmap_init_i2c' sound/soc/codecs/rt5663.o: In function `rt5663_i2c_driver_init': rt5663.c:(.init.text+0x20): undefined reference to `i2c_register_driver' sound/soc/codecs/rt5663.o: In function `rt5663_i2c_driver_exit': rt5663.c:(.exit.text+0x1c): undefined reference to `i2c_del_driver' make[1]: *** [/kisskb/src/Makefile:1029: vmlinux] Error 1 make: *** [Makefile:169: sub-make] Error 2 Command 'make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_ppc64le-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ' returned non-zero exit status 2 # rm -rf /kisskb/build/powerpc-next-rand_randconfig+ppc64le_ppc64le-gcc5 # Build took: 0:00:36.508883