arm64 memcpy+memove 5.10 patch

Robin Murphy robin.murphy at arm.com
Tue Mar 8 15:11:38 PST 2022


On 2022-03-08 22:38, Nick Desaulniers wrote:
> Dear stable kernel maintainers,
> Please consider cherry-picking
> 
> commit 6c23d54f4cb8 ("arm64: Import latest memcpy()/memmove() implementation")
> 
> to v5.10.y.  It first landed in v5.14-rc1.
> 
> It fixes a linkage failure observed when building kernels for ChromeOS
> under AutoFDO:
> 
> ld.lld: error: arch/arm64/lib/lib.a(memmove.o):(function __memmove:
> .text+0x8): relocation R_AARCH64_CONDBR19 out of range: -6331272 is
> not in [-1048576, 1048575]; references __memcpy
>>>> defined in arch/arm64/lib/lib.a(memcpy.o)
> 
> (The prior version of memmove used assembler conditional branches to
> memcpy; under AutoFDO the linker will decide where best to place
> memmove; it may be > 1MB away from memcpy. After this patch, memcpy
> and memmove are the same function).

Just beware that the new implementation turned out to be really good at 
finding places where __iomem pointers are erroneously being passed to 
memcpy(), by more readily triggering alignment faults, so there is a 
non-zero possibility of functional regressions if any of those places 
are still present in 5.10.y (particularly any which had "naturally" 
disappeared before 5.14). At least one of them still isn't fixed in 
mainline, but that one's so obscure I wouldn't consider it a major 
concern by itself.

Thanks,
Robin.



More information about the linux-arm-kernel mailing list