Re: [PATCH v2] crypto: arm64/poly1305 - move data to rodata section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 06, 2024 at 02:55:45PM GMT, Daniel Gomez wrote:
> On Tue, Aug 06, 2024 at 05:54:44AM GMT, Jia He wrote:
> 
> Hi Jia,
> 
> > When objtool gains support for ARM in the future, it may encounter issues
> > disassembling the following data in the .text section:
> > > .Lzeros:
> > > .long   0,0,0,0,0,0,0,0
> > > .asciz  "Poly1305 for ARMv8, CRYPTOGAMS by \@dot-asm"
> > > .align  2
> > 
> > Move it to .rodata which is a more appropriate section for read-only data.
> > 
> > There is a limit on how far the label can be from the instruction, hence
> > use "adrp" and low 12bits offset of the label to avoid the compilation
> > error.
> > 
> > Signed-off-by: Jia He <justin.he@xxxxxxx>
> > ---
> > v2:
> >   - use adrp+offset to avoid compilation error(kernel test bot and Andy)
> > v1: https://lkml.org/lkml/2024/8/2/616
> > 
> >  arch/arm64/crypto/poly1305-armv8.pl | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/crypto/poly1305-armv8.pl b/arch/arm64/crypto/poly1305-armv8.pl
> > index cbc980fb02e3..22c9069c0650 100644
> > --- a/arch/arm64/crypto/poly1305-armv8.pl
> > +++ b/arch/arm64/crypto/poly1305-armv8.pl
> > @@ -473,7 +473,8 @@ poly1305_blocks_neon:
> >  	subs	$len,$len,#64
> >  	ldp	x9,x13,[$inp,#48]
> >  	add	$in2,$inp,#96
> > -	adr	$zeros,.Lzeros
> > +	adrp	$zeros,.Lzeros
> > +	add	$zeros,$zeros,#:lo12:.Lzeros
> >  
> >  	lsl	$padbit,$padbit,#24
> >  	add	x15,$ctx,#48
> > @@ -885,10 +886,13 @@ poly1305_blocks_neon:
> >  	ret
> >  .size	poly1305_blocks_neon,.-poly1305_blocks_neon
> >  
> > +.pushsection .rodata
> >  .align	5
> >  .Lzeros:
> >  .long	0,0,0,0,0,0,0,0
> >  .asciz	"Poly1305 for ARMv8, CRYPTOGAMS by \@dot-asm"
> > +.popsection
> > +
> 
> I'm getting the following error with next-20240806

To clarify my report: the error below disappears when this patch is reverted.

> 
> make LLVM=1 ARCH=arm64 allyesconfig
> make LLVM=1 ARCH=arm64 -j$(nproc)
> 
> ld.lld: error: vmlinux.a(arch/arm64/crypto/poly1305-core.o):(function poly1305_blocks_neon: .text+0x3d4): relocation R_AARCH64_ADR_PREL_LO21 out of range: 269166444 is not in [-1048576, 1048575]
> 
> Full debug error with log context:
> 
> ...
> + grep -q ^CONFIG_DEBUG_INFO_BTF=y include/config/auto.conf
> + strip_debug=1
> + vmlinux_link .tmp_vmlinux1
> + local output=.tmp_vmlinux1
> + local objs
> + local libs
> + local ld
> + local ldflags
> + local ldlibs
> + info LD .tmp_vmlinux1
> + printf   %-7s %s\n LD .tmp_vmlinux1
>   LD      .tmp_vmlinux1
> + shift
> + is_enabled CONFIG_LTO_CLANG
> + grep -q ^CONFIG_LTO_CLANG=y include/config/auto.conf
> + is_enabled CONFIG_X86_KERNEL_IBT
> + grep -q ^CONFIG_X86_KERNEL_IBT=y include/config/auto.conf
> + objs=vmlinux.a
> + libs=./drivers/firmware/efi/libstub/lib.a
> + is_enabled CONFIG_MODULES
> + grep -q ^CONFIG_MODULES=y include/config/auto.conf
> + objs=vmlinux.a .vmlinux.export.o
> + objs=vmlinux.a .vmlinux.export.o init/version-timestamp.o
> + [ arm64 = um ]
> + wl=
> + ld=ld.lld
> + ldflags=-EL  -maarch64elf -z norelro -z noexecstack --no-undefined -X -shared -Bsymbolic -z notext  --no-apply-dynamic-relocs --fix-cortex-a53-843419 --build-id=sha1 -X --pack-dyn-relocs=relr --orphan-handling=error
> + ldlibs=
> + ldflags=-EL  -maarch64elf -z norelro -z noexecstack --no-undefined -X -shared -Bsymbolic -z notext  --no-apply-dynamic-relocs --fix-cortex-a53-843419 --build-id=sha1 -X --pack-dyn-relocs=relr --orphan-handling=error --script=./arch/arm64/kernel/vmlinux.lds
> + [ -n 1 ]
> + ldflags=-EL  -maarch64elf -z norelro -z noexecstack --no-undefined -X -shared -Bsymbolic -z notext  --no-apply-dynamic-relocs --fix-cortex-a53-843419 --build-id=sha1 -X --pack-dyn-relocs=relr --orphan-handling=error --script=./arch/arm64/kernel/vmlinux.lds --strip-debug
> + is_enabled CONFIG_VMLINUX_MAP
> + grep -q ^CONFIG_VMLINUX_MAP=y include/config/auto.conf
> + ldflags=-EL  -maarch64elf -z norelro -z noexecstack --no-undefined -X -shared -Bsymbolic -z notext  --no-apply-dynamic-relocs --fix-cortex-a53-843419 --build-id=sha1 -X --pack-dyn-relocs=relr --orphan-handling=error --script=./arch/arm64/kernel/vmlinux.lds --strip-debug -Map=.tmp_vmlinux1.map
> + ld.lld -EL -maarch64elf -z norelro -z noexecstack --no-undefined -X -shared -Bsymbolic -z notext --no-apply-dynamic-relocs --fix-cortex-a53-843419 --build-id=sha1 -X --pack-dyn-relocs=relr --orphan-handling=error --script=./arch/arm64/kernel/vmlinux.lds --strip-debug -Map=.tmp_vmlinux1.map -o .tmp_vmlinux1 --whole-archive vmlinux.a .vmlinux.export.o init/version-timestamp.o --no-whole-archive --start-group ./drivers/firmware/efi/libstub/lib.a --end-group .tmp_vmlinux0.kallsyms.o
> ld.lld: error: vmlinux.a(arch/arm64/crypto/poly1305-core.o):(function poly1305_blocks_neon: .text+0x3d4): relocation R_AARCH64_ADR_PREL_LO21 out of range: 269166444 is not in [-1048576, 1048575]
> make[2]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
> make[1]: *** [/home/dagomez/src/linux-next/Makefile:1156: vmlinux] Error 2
> make: *** [Makefile:224: __sub-make] Error 2
> 
> Any suggestion how to fix this?
> 
> Daniel
> 
> >  .align	2
> >  #if !defined(__KERNEL__) && !defined(_WIN64)
> >  .comm	OPENSSL_armcap_P,4,4
> > -- 
> > 2.34.1
> > 




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux