Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 721734
Collapse All | Expand All

(-)a/arch/x86/include/asm/stackprotector.h (-1 / +6 lines)
Lines 55-62 Link Here
55
/*
55
/*
56
 * Initialize the stackprotector canary value.
56
 * Initialize the stackprotector canary value.
57
 *
57
 *
58
 * NOTE: this must only be called from functions that never return,
58
 * NOTE: this must only be called from functions that never return
59
 * and it must always be inlined.
59
 * and it must always be inlined.
60
 *
61
 * In addition, it should be called from a compilation unit for which
62
 * stack protector is disabled. Alternatively, the caller should not end
63
 * with a function call which gets tail-call optimized as that would
64
 * lead to checking a modified canary value.
60
 */
65
 */
61
static __always_inline void boot_init_stack_canary(void)
66
static __always_inline void boot_init_stack_canary(void)
62
{
67
{
(-)a/arch/x86/kernel/smpboot.c (+8 lines)
Lines 266-271 static void notrace start_secondary(void *unused) Link Here
266
266
267
	wmb();
267
	wmb();
268
	cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
268
	cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
269
270
	/*
271
	 * Prevent tail call to cpu_startup_entry() because the stack protector
272
	 * guard has been changed a couple of function calls up, in
273
	 * boot_init_stack_canary() and must not be checked before tail calling
274
	 * another function.
275
	 */
276
	prevent_tail_call_optimization();
269
}
277
}
270
278
271
/**
279
/**
(-)a/arch/x86/xen/smp_pv.c (+1 lines)
Lines 93-98 asmlinkage __visible void cpu_bringup_and_idle(void) Link Here
93
	cpu_bringup();
93
	cpu_bringup();
94
	boot_init_stack_canary();
94
	boot_init_stack_canary();
95
	cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
95
	cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
96
	prevent_tail_call_optimization();
96
}
97
}
97
98
98
void xen_smp_intr_free_pv(unsigned int cpu)
99
void xen_smp_intr_free_pv(unsigned int cpu)
(-)a/include/linux/compiler.h (+6 lines)
Lines 356-359 static inline void *offset_to_ptr(const int *off) Link Here
356
/* &a[0] degrades to a pointer: a different type from an array */
356
/* &a[0] degrades to a pointer: a different type from an array */
357
#define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
357
#define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
358
358
359
/*
360
 * This is needed in functions which generate the stack canary, see
361
 * arch/x86/kernel/smpboot.c::start_secondary() for an example.
362
 */
363
#define prevent_tail_call_optimization()	asm("")
364
359
#endif /* __LINUX_COMPILER_H */
365
#endif /* __LINUX_COMPILER_H */

Return to bug 721734