File tree Expand file tree Collapse file tree 6 files changed +23
-1
lines changed Expand file tree Collapse file tree 6 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ config PPC
180
180
select HAVE_ARCH_SECCOMP_FILTER
181
181
select HAVE_ARCH_TRACEHOOK
182
182
select HAVE_CBPF_JIT if !PPC64
183
- select HAVE_STACKPROTECTOR if $(cc-option,-mstack-protector-guard=tls) && PPC32
183
+ select HAVE_STACKPROTECTOR if $(cc-option,-mstack-protector-guard=tls)
184
184
select HAVE_CONTEXT_TRACKING if PPC64
185
185
select HAVE_DEBUG_KMEMLEAK
186
186
select HAVE_DEBUG_STACKOVERFLOW
Original file line number Diff line number Diff line change @@ -113,7 +113,11 @@ KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET)
113
113
endif
114
114
115
115
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls
116
+ ifdef CONFIG_PPC64
117
+ cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r13
118
+ else
116
119
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2
120
+ endif
117
121
118
122
LDFLAGS_vmlinux-y := -Bstatic
119
123
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
@@ -411,8 +415,12 @@ ifdef CONFIG_STACKPROTECTOR
411
415
prepare : stack_protector_prepare
412
416
413
417
stack_protector_prepare : prepare0
418
+ ifdef CONFIG_PPC64
419
+ $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
420
+ else
414
421
$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
415
422
endif
423
+ endif
416
424
417
425
# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
418
426
# to stdout and these checks are run even on install targets.
Original file line number Diff line number Diff line change @@ -256,6 +256,9 @@ struct paca_struct {
256
256
struct slb_entry * mce_faulty_slbs ;
257
257
u16 slb_save_cache_ptr ;
258
258
#endif /* CONFIG_PPC_BOOK3S_64 */
259
+ #ifdef CONFIG_STACKPROTECTOR
260
+ unsigned long canary ;
261
+ #endif
259
262
} ____cacheline_aligned ;
260
263
261
264
extern void copy_mm_to_paca (struct mm_struct * mm );
Original file line number Diff line number Diff line change 11
11
#include <linux/version.h>
12
12
#include <asm/reg.h>
13
13
#include <asm/current.h>
14
+ #include <asm/paca.h>
14
15
15
16
/*
16
17
* Initialize the stackprotector canary value.
@@ -29,6 +30,9 @@ static __always_inline void boot_init_stack_canary(void)
29
30
canary &= CANARY_MASK ;
30
31
31
32
current -> stack_canary = canary ;
33
+ #ifdef CONFIG_PPC64
34
+ get_paca ()-> canary = canary ;
35
+ #endif
32
36
}
33
37
34
38
#endif /* _ASM_STACKPROTECTOR_H */
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ int main(void)
81
81
OFFSET (MM , task_struct , mm );
82
82
#ifdef CONFIG_STACKPROTECTOR
83
83
OFFSET (TASK_CANARY , task_struct , stack_canary );
84
+ #ifdef CONFIG_PPC64
85
+ OFFSET (PACA_CANARY , paca_struct , canary );
86
+ #endif
84
87
#endif
85
88
OFFSET (MMCONTEXTID , mm_struct , context .id );
86
89
#ifdef CONFIG_PPC64
Original file line number Diff line number Diff line change @@ -624,6 +624,10 @@ _GLOBAL(_switch)
624
624
625
625
addi r6,r4,-THREAD /* Convert THREAD to 'current' */
626
626
std r6,PACACURRENT(r13) /* Set new 'current' */
627
+ #if defined(CONFIG_STACKPROTECTOR)
628
+ ld r6, TASK_CANARY(r6)
629
+ std r6, PACA_CANARY(r13)
630
+ #endif
627
631
628
632
ld r8,KSP(r4) /* new stack pointer */
629
633
#ifdef CONFIG_PPC_BOOK3S_64
You can’t perform that action at this time.
0 commit comments