ARM: current: prevent literal references from going out of range
PATCH 1/1 ARM: current: prevent literal references from going out of range
Nathan reports that the new get_current() accessor may cause problems at build time due to the use of a literal to hold the address of the variable that stores the 'current' pointer. This is due to the fact that LLD before v14 does not support the PC-relative group relocations that are normally used for this, and the fallback relies on literals without emitting the literal pools explictly using the .ltorg directive.
Since emitting a literal pool in this particular case is not possible, avoid the LOAD_SYM_ARMV6() entirely, and use the ordinary C assigment instead.
While at it, add a .ltorg directive to the other instantiation of LOAD_SYM_ARMV6(), which could potentially suffer from the same issue, but can be fixed by an .ltorg directive due to the existence of an unconditional branch right after it.
--- arch/arm/include/asm/current.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/include/asm/current.h +3 -1
@@ -39,6 +39,7 @@ static inline __attribute_const__ struct task_struct *get_current(void)" .subsection 1 \n\t" "2: " LOAD_SYM_ARMV6(%0, __current) " \n\t"" b 1b \n\t" +" .ltorg \n\t" " .previous \n\t" " .pushsection \".alt.smp.init\", \"a\" \n\t" " .long 0b - . \n\t"
@@ -46,7 +47,8 @@ static inline __attribute_const__ struct task_struct *get_current(void)" .popsection \n\t" #endif : "=r"(cur)); -#elif __LINUX_ARM_ARCH__>=7 || \ +#elif __LINUX_ARM_ARCH__>=7 || \ + (defined(CONFIG_LD_IS_LLD ) &&CONFIG_LLD_VERSION <140000 ) || \ (defined(MODULE ) && defined(CONFIG_ARM_MODULE_PLTS )) cur = __current;#else
Signature · 7 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel