Fix x86_64 builds with CC_STACKPROTECTOR enabled
PATCH 1/1 Fix x86_64 builds with CC_STACKPROTECTOR enabled
From: Wolfgang Mauerer (none) <[email protected]>
The per_cpu__ prefix for per-cpu-variables in the Linux kernel is gone since dd17c8f72993f. This patch adapts the x86_64 task switching code to cope with kernels before and after this commit.
--- include/asm-x86/switch_64.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/asm-x86/switch_64.h +4 -0
@@ -37,6 +37,10 @@ struct xnarch_x8664_initstack { };#ifdef CONFIG_CC_STACKPROTECTOR +#include <asm/percpu.h> +#ifndef per_cpu_var +#define per_cpu_var (x) x +#endif /* * We have an added complexity with -fstack-protector, due to the * hybrid scheduling between user- and kernel-based Xenomai threads,
Signature · 1 line
1.7.0.4
Quoted 18 lines · Wolfgang Mauerer
From: Wolfgang Mauerer (none) <[email protected]>
The
per_cpu__prefix for per-cpu-variables in the Linux kernel is gone sincedd17c8f72993f. This patch adapts thex86_64task switching code to cope with kernels before and after this commit.Signed-off-by Wolfgang Mauerer <[email protected]>Acked-by Jan Kiszka <[email protected]>--- include/asm-x86/switch_64.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)include/asm-x86/switch_64.h +0
-0
include/asm-x86/switch_64.h struct xnarch_x8664_initstack { · line 43
Quoted 7 lines
include/asm-x86/switch_64.h +4
-0@@ -37,6 +37,10 @@ struct xnarch_x8664_initstack { };#ifdef CONFIG_CC_STACKPROTECTOR +#include <asm/percpu.h> +#ifndef per_cpu_var +#define per_cpu_var (x) x +#endif
Please move those soon-to-be-generic bits to asm-generic/wrappers.h, into a section that would be unconditionally parsed with 2.6.34 or later.
TIA,
Quoted 3 lines
include/asm-x86/switch_64.h +0
-0/* * We have an added complexity with -fstack-protector, due to the * hybrid scheduling between user- and kernel-based Xenomai threads,
Signature · 1 line
Philippe.
PATCH 1/1 Fix x86_64 builds with CC_STACKPROTECTOR enabled
The per_cpu__ prefix for per-cpu-variables in the Linux kernel is gone since dd17c8f72993f. This patch adds a corresponding wrapper.
--- include/asm-generic/wrappers.h | 4 ++++ include/asm-x86/switch_64.h | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-)
include/asm-generic/wrappers.h +4 -0
@@ -598,4 +598,8 @@ static inline void wrap_proc_dir_entry_owner(struct proc_dir_entry *entry) raw_spin_unlock_irqrestore(&rthal_irq_descp(irq)->lock, flags)#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) */ +#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,34 ) +#define per_cpu_var (x) x +#endif +#endif /* _XENO_ASM_GENERIC_WRAPPERS_H */
include/asm-x86/switch_64.h +3 -0
@@ -25,6 +25,9 @@#error "Pure kernel header included from user-space!"#endif +#include <asm/percpu.h> +#include <asm/xenomai/wrappers.h> +struct xnarch_x8664_initstack {#ifdef CONFIG_CC_STACKPROTECTOR
Signature · 1 line
1.7.0.4