# 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/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 99793e64b815ec88daa9955c6347bd541e78543b # < make -s -j 80 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=0x9DC66B10 # 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 80 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 80 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:5054:warning: override: reassigning to symbol PPC_BOOK3S_64 .config:5056:warning: override: reassigning to symbol SECTION_MISMATCH_WARN_ONLY .config:5057:warning: override: reassigning to symbol PREVENT_FIRMWARE_BUILD .config:5058:warning: override: reassigning to symbol LD_HEAD_STUB_CATCH .config:5060:warning: override: reassigning to symbol UBSAN WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [y]: - OCXL [=y] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y] # make -s -j 80 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- WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [y]: - OCXL [=y] && 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 [y]: - OCXL [=y] && 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 [y]: - OCXL [=y] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y] /kisskb/src/security/smack/smack_lsm.c: In function 'smack_socket_connect': /kisskb/src/security/smack/smack_lsm.c:2838:24: warning: unused variable 'sip' [-Wunused-variable] 2838 | struct sockaddr_in6 *sip = (struct sockaddr_in6 *)sap; | ^~~ /kisskb/src/drivers/usb/host/fhci-hcd.c: In function 'fhci_urb_enqueue': /kisskb/src/drivers/usb/host/fhci-hcd.c:398:8: warning: this statement may fall through [-Wimplicit-fallthrough=] 398 | size = 2; | ~~~~~^~~ /kisskb/src/drivers/usb/host/fhci-hcd.c:399:2: note: here 399 | case PIPE_BULK: | ^~~~ /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: warning: orphan section `.gnu.hash' from `linker stubs' being placed in section `.gnu.hash' /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: warning: orphan section `.gnu.hash' from `linker stubs' being placed in section `.gnu.hash' /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld: warning: orphan section `.gnu.hash' from `linker stubs' being placed in section `.gnu.hash' Completed OK # rm -rf /kisskb/build/powerpc-next-rand_randconfig+ppc64le_powerpc-gcc9 # Build took: 0:03:27.204701