select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_CBPF_JIT                    if !PPC64
-       select HAVE_STACKPROTECTOR              if $(cc-option,-mstack-protector-guard=tls) && PPC32
+       select HAVE_STACKPROTECTOR              if $(cc-option,-mstack-protector-guard=tls)
        select HAVE_CONTEXT_TRACKING            if PPC64
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DEBUG_STACKOVERFLOW
 
 endif
 
 cflags-$(CONFIG_STACKPROTECTOR)        += -mstack-protector-guard=tls
+ifdef CONFIG_PPC64
+cflags-$(CONFIG_STACKPROTECTOR)        += -mstack-protector-guard-reg=r13
+else
 cflags-$(CONFIG_STACKPROTECTOR)        += -mstack-protector-guard-reg=r2
+endif
 
 LDFLAGS_vmlinux-y := -Bstatic
 LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
 prepare: stack_protector_prepare
 
 stack_protector_prepare: prepare0
+ifdef CONFIG_PPC64
+       $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
+else
        $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
 endif
+endif
 
 # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
 # to stdout and these checks are run even on install targets.
 
        struct slb_entry *mce_faulty_slbs;
        u16 slb_save_cache_ptr;
 #endif /* CONFIG_PPC_BOOK3S_64 */
+#ifdef CONFIG_STACKPROTECTOR
+       unsigned long canary;
+#endif
 } ____cacheline_aligned;
 
 extern void copy_mm_to_paca(struct mm_struct *mm);
 
 #include <linux/version.h>
 #include <asm/reg.h>
 #include <asm/current.h>
+#include <asm/paca.h>
 
 /*
  * Initialize the stackprotector canary value.
        canary &= CANARY_MASK;
 
        current->stack_canary = canary;
+#ifdef CONFIG_PPC64
+       get_paca()->canary = canary;
+#endif
 }
 
 #endif /* _ASM_STACKPROTECTOR_H */
 
        OFFSET(MM, task_struct, mm);
 #ifdef CONFIG_STACKPROTECTOR
        OFFSET(TASK_CANARY, task_struct, stack_canary);
+#ifdef CONFIG_PPC64
+       OFFSET(PACA_CANARY, paca_struct, canary);
+#endif
 #endif
        OFFSET(MMCONTEXTID, mm_struct, context.id);
 #ifdef CONFIG_PPC64
 
 
        addi    r6,r4,-THREAD   /* Convert THREAD to 'current' */
        std     r6,PACACURRENT(r13)     /* Set new 'current' */
+#if defined(CONFIG_STACKPROTECTOR)
+       ld      r6, TASK_CANARY(r6)
+       std     r6, PACA_CANARY(r13)
+#endif
 
        ld      r8,KSP(r4)      /* new stack pointer */
 #ifdef CONFIG_PPC_BOOK3S_64