# git rev-parse -q --verify b3258f133d72af0bb463e198610d47ae57498b00^{commit} b3258f133d72af0bb463e198610d47ae57498b00 already have revision, skipping fetch # git checkout -q -f -B kisskb b3258f133d72af0bb463e198610d47ae57498b00 # git clean -qxdf # < git log -1 # commit b3258f133d72af0bb463e198610d47ae57498b00 # Author: Michael Ellerman # Date: Fri Mar 20 14:21:16 2020 +1100 # # powerpc/64: Prevent stack protection in early boot # # The previous commit reduced the amount of code that is run before we # setup a paca. However there are still a few remaining functions that # run with no paca, or worse, with an arbitrary value in r13 that will # be used as a paca pointer. # # In particular the stack protector canary is stored in the paca, so if # stack protector is activated for any of these functions we will read # the stack canary from wherever r13 points. If r13 happens to point # outside of memory we will get a machine check / checkstop. # # For example if we modify initialise_paca() to trigger stack # protection, and then boot in the mambo simulator with r13 poisoned in # skiboot before calling the kernel: # # DEBUG: 19952232: (19952232): INSTRUCTION: PC=0xC0000000191FC1E8: [0x3C4C006D]: addis r2,r12,0x6D [fetch] # DEBUG: 19952236: (19952236): INSTRUCTION: PC=0xC00000001807EAD8: [0x7D8802A6]: mflr r12 [fetch] # FATAL ERROR: 19952276: (19952276): Check Stop for 0:0: Machine Check with ME bit of MSR off # DEBUG: 19952276: (19952276): INSTRUCTION: PC=0xC0000000191FCA7C: [0xE90D0CF8]: ld r8,0xCF8(r13) [Instruction Failed] # INFO: 19952276: (19952277): ** Execution stopped: Mambo Error, Machine Check Stop, ** # systemsim % bt # pc: 0xC0000000191FCA7C initialise_paca+0x54 # lr: 0xC0000000191FC22C early_setup+0x44 # stack:0x00000000198CBED0 0x0 +0x0 # stack:0x00000000198CBF00 0xC0000000191FC22C early_setup+0x44 # stack:0x00000000198CBF90 0x1801C968 +0x1801C968 # # So annotate the relevant functions to ensure stack protection is never # enabled for them. # # Fixes: 06ec27aea9fc ("powerpc/64: add stack protector support") # Cc: stable@vger.kernel.org # v4.20+ # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/20200320032116.1024773-2-mpe@ellerman.id.au # < /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 b3258f133d72af0bb463e198610d47ae57498b00 # < make -s -j 32 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- randconfig KCONFIG_SEED=0xE764640 # 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 # Added to kconfig CONFIG_TRIM_UNUSED_KSYMS=n # Added to kconfig CONFIG_UBSAN=n # < make -s -j 32 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 32 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig .config:4425:warning: override: reassigning to symbol STANDALONE .config:4432:warning: override: reassigning to symbol PPC_BOOK3S_64 .config:4433:warning: override: reassigning to symbol PPC_DISABLE_WERROR .config:4434:warning: override: reassigning to symbol SECTION_MISMATCH_WARN_ONLY # make -s -j 32 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- In file included from /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29, from /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:37, from /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:27: /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: In function 'dcn_bw_apply_registry_override': /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:64:3: error: implicit declaration of function 'enable_kernel_vsx'; did you mean 'enable_kernel_fp'? [-Werror=implicit-function-declaration] 64 | enable_kernel_vsx(); \ | ^~~~~~~~~~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:626:2: note: in expansion of macro 'DC_FP_START' 626 | DC_FP_START(); | ^~~~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:67:3: error: implicit declaration of function 'enable_kernel_altivec'; did you mean 'enable_kernel_fp'? [-Werror=implicit-function-declaration] 67 | enable_kernel_altivec(); \ | ^~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:626:2: note: in expansion of macro 'DC_FP_START' 626 | DC_FP_START(); | ^~~~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:75:3: error: implicit declaration of function 'disable_kernel_vsx'; did you mean 'disable_kernel_fp'? [-Werror=implicit-function-declaration] 75 | disable_kernel_vsx(); \ | ^~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:662:2: note: in expansion of macro 'DC_FP_END' 662 | DC_FP_END(); | ^~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:78:3: error: implicit declaration of function 'disable_kernel_altivec'; did you mean 'disable_kernel_fp'? [-Werror=implicit-function-declaration] 78 | disable_kernel_altivec(); \ | ^~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:662:2: note: in expansion of macro 'DC_FP_END' 662 | DC_FP_END(); | ^~~~~~~~~ cc1: some warnings being treated as errors make[5]: *** [/kisskb/src/scripts/Makefile.build:267: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1 make[5]: *** Waiting for unfinished jobs.... make[4]: *** [/kisskb/src/scripts/Makefile.build:505: drivers/gpu/drm/amd/amdgpu] Error 2 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [/kisskb/src/scripts/Makefile.build:505: drivers/gpu/drm] Error 2 make[2]: *** [/kisskb/src/scripts/Makefile.build:505: drivers/gpu] Error 2 make[2]: *** Waiting for unfinished jobs.... /kisskb/src/drivers/vfio/pci/vfio_pci_nvlink2.c: In function 'vfio_pci_nvgpu_release': /kisskb/src/drivers/vfio/pci/vfio_pci_nvlink2.c:101:10: error: implicit declaration of function 'mm_iommu_put'; did you mean 'mm_iommu_init'? [-Werror=implicit-function-declaration] 101 | ret = mm_iommu_put(data->mm, data->mem); | ^~~~~~~~~~~~ | mm_iommu_init /kisskb/src/drivers/vfio/pci/vfio_pci_nvlink2.c: In function 'vfio_pci_nvgpu_mmap': /kisskb/src/drivers/vfio/pci/vfio_pci_nvlink2.c:165:14: error: implicit declaration of function 'mm_iommu_newdev' [-Werror=implicit-function-declaration] 165 | ret = (int) mm_iommu_newdev(data->mm, data->useraddr, | ^~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[4]: *** [/kisskb/src/scripts/Makefile.build:267: drivers/vfio/pci/vfio_pci_nvlink2.o] Error 1 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [/kisskb/src/scripts/Makefile.build:505: drivers/vfio/pci] Error 2 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/kisskb/src/scripts/Makefile.build:505: drivers/vfio] Error 2 make[1]: *** [/kisskb/src/Makefile:1681: drivers] Error 2 make: *** [Makefile:179: sub-make] Error 2 Command 'make -s -j 32 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ' returned non-zero exit status 2 # rm -rf /kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 # Build took: 0:03:49.852281