# git rev-parse -q --verify 99793e64b815ec88daa9955c6347bd541e78543b^{commit} 99793e64b815ec88daa9955c6347bd541e78543b already have revision, skipping fetch # git checkout -q -f -B kisskb 99793e64b815ec88daa9955c6347bd541e78543b # git clean -qxdf # < git log -1 # commit 99793e64b815ec88daa9955c6347bd541e78543b # Author: Michael Ellerman # Date: Mon Mar 16 22:32:32 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 # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-ld --version # < git log --format=%s --max-count=1 99793e64b815ec88daa9955c6347bd541e78543b # < make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_powerpc-randconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- randconfig KCONFIG_SEED=0x9368F71C WARNING: unmet direct dependencies detected for FSL_EMB_PERFMON Depends on [n]: E500 [=n] || PPC_83xx [=n] Selected by [y]: - PPC_FSL_BOOK3E [=y] # 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=y # Added to kconfig CONFIG_PPC64=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_CC_STACKPROTECTOR_STRONG=n # Added to kconfig CONFIG_GCC_PLUGINS=n # 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 48 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_powerpc-randconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- help # make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_powerpc-randconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- olddefconfig .config:3974:warning: override: reassigning to symbol MODULE_SIG .config:3976:warning: override: reassigning to symbol PPC64 .config:3977:warning: override: reassigning to symbol PPC_DISABLE_WERROR .config:3978:warning: override: reassigning to symbol SECTION_MISMATCH_WARN_ONLY .config:3979:warning: override: reassigning to symbol PREVENT_FIRMWARE_BUILD WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [m]: - OCXL [=m] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y] # make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-next-rand_powerpc-randconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [m]: - OCXL [=m] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y] WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [m]: - OCXL [=m] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y] WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [m]: - OCXL [=m] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:72:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:338:21: note: 'pdeo' was declared here /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:204:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/video/backlight/adp8860_bl.c: In function 'adp8860_bl_ambient_light_level_show': /kisskb/src/drivers/video/backlight/adp8860_bl.c:578:10: warning: 'ret_val' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/soc/qcom/wcnss_ctrl.c: In function 'wcnss_async_probe': /kisskb/src/drivers/soc/qcom/wcnss_ctrl.c:299:5: warning: 'expect_cbc' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/lib/mpi/mpicoder.c: In function 'mpi_read_raw_from_sgl': /kisskb/src/lib/mpi/mpicoder.c:352:8: warning: 'buff' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/bpf/btf.c: In function '__btf_resolve_helper_id': /kisskb/src/kernel/bpf/btf.c:4002:20: warning: 't' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/iommu/io-pgtable-arm-v7s.c: In function 'arm_v7s_map': /kisskb/src/drivers/iommu/io-pgtable-arm-v7s.c:480:7: warning: 'cptep' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/iommu/io-pgtable-arm-v7s.c:476:22: note: 'cptep' was declared here /kisskb/src/lib/rhashtable.c: In function 'rht_deferred_worker': /kisskb/src/include/linux/rhashtable.h:110:10: warning: 'next' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/lib/rhashtable.c:222:28: note: 'next' was declared here /kisskb/src/fs/splice.c: In function '__do_compat_sys_vmsplice': /kisskb/src/fs/splice.c:1416:8: warning: 'type' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/splice.c: In function '__do_sys_vmsplice': /kisskb/src/fs/splice.c:1390:8: warning: 'type' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/mfd/tc3589x.c: In function 'tc3589x_probe': /kisskb/src/drivers/mfd/tc3589x.c:390:2: warning: 'version' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/misc/cxl/native.c: In function 'native_irq_wait': /kisskb/src/drivers/misc/cxl/native.c:1244:2: warning: 'ph' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/misc/cxl/native.c:1244:2: warning: 'dsisr' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/cpufreq/powernv-cpufreq.c: In function 'powernv_cpufreq_reboot_notifier': /kisskb/src/drivers/cpufreq/powernv-cpufreq.c:896:1: warning: the frame size of 1248 bytes is larger than 1024 bytes [-Wframe-larger-than=] /kisskb/src/drivers/cpufreq/powernv-cpufreq.c: In function 'powernv_cpufreq_work_fn': /kisskb/src/drivers/cpufreq/powernv-cpufreq.c:928:1: warning: the frame size of 1248 bytes is larger than 1024 bytes [-Wframe-larger-than=] /kisskb/src/drivers/hwspinlock/hwspinlock_core.c: In function 'of_hwspin_lock_get_id': /kisskb/src/drivers/hwspinlock/hwspinlock_core.c:345:6: warning: 'id' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/bcma/sprom.c: In function 'bcma_sprom_get': /kisskb/src/drivers/bcma/sprom.c:233:5: warning: 'sprom' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/bcma/sprom.c:580:7: note: 'sprom' was declared here /kisskb/src/drivers/mtd/hyperbus/hbmc-am654.c: In function 'am654_hbmc_calibrate': /kisskb/src/drivers/mtd/hyperbus/hbmc-am654.c:51:2: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] Completed OK # rm -rf /kisskb/build/powerpc-next-rand_powerpc-randconfig_powerpc-gcc4.6 # Build took: 0:01:35.171818