x86/i386: Put aligned stack-canary in percpu shared_aligned section
Pack aligned things together into a special section to minimize padding holes. Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Cc: Tejun Heo <tj@kernel.org> LKML-Reference: <4AA035C0.9070202@goop.org> [ queued up in tip:x86/asm because it depends on this commit: x86/i386: Make sure stack-protector segment base is cache aligned ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
1ea0d14e48
commit
53f824520b
@@ -413,7 +413,7 @@ struct stack_canary {
|
|||||||
char __pad[20]; /* canary at %gs:20 */
|
char __pad[20]; /* canary at %gs:20 */
|
||||||
unsigned long canary;
|
unsigned long canary;
|
||||||
};
|
};
|
||||||
DECLARE_PER_CPU(struct stack_canary, stack_canary) ____cacheline_aligned;
|
DECLARE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
|
||||||
#endif
|
#endif
|
||||||
#endif /* X86_64 */
|
#endif /* X86_64 */
|
||||||
|
|
||||||
|
@@ -1043,7 +1043,7 @@ DEFINE_PER_CPU(struct orig_ist, orig_ist);
|
|||||||
#else /* CONFIG_X86_64 */
|
#else /* CONFIG_X86_64 */
|
||||||
|
|
||||||
#ifdef CONFIG_CC_STACKPROTECTOR
|
#ifdef CONFIG_CC_STACKPROTECTOR
|
||||||
DEFINE_PER_CPU(struct stack_canary, stack_canary) ____cacheline_aligned;
|
DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Make sure %fs and %gs are initialized properly in idle threads */
|
/* Make sure %fs and %gs are initialized properly in idle threads */
|
||||||
|
@@ -81,14 +81,17 @@ extern void setup_per_cpu_areas(void);
|
|||||||
|
|
||||||
#ifdef MODULE
|
#ifdef MODULE
|
||||||
#define PER_CPU_SHARED_ALIGNED_SECTION ""
|
#define PER_CPU_SHARED_ALIGNED_SECTION ""
|
||||||
|
#define PER_CPU_ALIGNED_SECTION ""
|
||||||
#else
|
#else
|
||||||
#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
|
#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
|
||||||
|
#define PER_CPU_ALIGNED_SECTION ".shared_aligned"
|
||||||
#endif
|
#endif
|
||||||
#define PER_CPU_FIRST_SECTION ".first"
|
#define PER_CPU_FIRST_SECTION ".first"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define PER_CPU_SHARED_ALIGNED_SECTION ""
|
#define PER_CPU_SHARED_ALIGNED_SECTION ""
|
||||||
|
#define PER_CPU_ALIGNED_SECTION ".shared_aligned"
|
||||||
#define PER_CPU_FIRST_SECTION ""
|
#define PER_CPU_FIRST_SECTION ""
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -66,6 +66,14 @@
|
|||||||
DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
|
DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
|
||||||
____cacheline_aligned_in_smp
|
____cacheline_aligned_in_smp
|
||||||
|
|
||||||
|
#define DECLARE_PER_CPU_ALIGNED(type, name) \
|
||||||
|
DECLARE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
|
||||||
|
____cacheline_aligned
|
||||||
|
|
||||||
|
#define DEFINE_PER_CPU_ALIGNED(type, name) \
|
||||||
|
DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
|
||||||
|
____cacheline_aligned
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Declaration/definition used for per-CPU variables that must be page aligned.
|
* Declaration/definition used for per-CPU variables that must be page aligned.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user