Re: Problems with arm64 compat vdso

From: Ard Biesheuvel
Date: Mon Sep 23 2019 - 12:41:47 EST


On Fri, 20 Sep 2019 at 18:33, Vincenzo Frascino
<vincenzo.frascino@xxxxxxx> wrote:
>
> Hi Will,
>
> thank you for reporting this.
>
> On 20/09/2019 15:27, Will Deacon wrote:
> > Hi Vincenzo,
> >
> > I've been running into a few issues with the COMPAT vDSO. Please could
> > you have a look?
> >
>
> I will be at Linux Recipes next week. I will look at this with priority when I
> come back.
>

Hi all,

I noticed another issue: I build out of tree, and the VDSO gets
rebuilt every time I build the kernel, even if I haven't made any
changes to the source tree at all.

Could you please look into that as well? (once you get around to it)

Thanks,
Ard.


> > If I do the following:
> >
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
> > [...]
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
> > [set CONFIG_CROSS_COMPILE_COMPAT_VDSO="arm-linux-gnueabihf-"]
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
> >
> > Then I see the following warning:
> >
> > arch/arm64/Makefile:62: CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built
> >
> > even though the compat vDSO *has* been built:
> >
> > $ file arch/arm64/kernel/vdso32/vdso.so
> > arch/arm64/kernel/vdso32/vdso.so: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=c67f6c786f2d2d6f86c71f708595594aa25247f6, stripped
> >
> > However, I also get some warnings because arm64 headers are being included
> > in the compat vDSO build:
> >
> > In file included from ./arch/arm64/include/asm/thread_info.h:17:0,
> > from ./include/linux/thread_info.h:38,
> > from ./arch/arm64/include/asm/preempt.h:5,
> > from ./include/linux/preempt.h:78,
> > from ./include/linux/spinlock.h:51,
> > from ./include/linux/seqlock.h:36,
> > from ./include/linux/time.h:6,
> > from /usr/local/google/home/willdeacon/work/linux/lib/vdso/gettimeofday.c:7,
> > from <command-line>:0:
> > ./arch/arm64/include/asm/memory.h: In function â__tag_setâ:
> > ./arch/arm64/include/asm/memory.h:233:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > u64 __addr = (u64)addr & ~__tag_shifted(0xff);
> > ^
> > In file included from ./arch/arm64/include/asm/pgtable-hwdef.h:8:0,
> > from ./arch/arm64/include/asm/processor.h:34,
> > from ./arch/arm64/include/asm/elf.h:118,
> > from ./include/linux/elf.h:5,
> > from ./include/linux/elfnote.h:62,
> > from arch/arm64/kernel/vdso32/note.c:11:
> > ./arch/arm64/include/asm/memory.h: In function â__tag_setâ:
> > ./arch/arm64/include/asm/memory.h:233:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > u64 __addr = (u64)addr & ~__tag_shifted(0xff);
> > ^
> > Worse, if your compat binutils isn't up-to-date, you'll actually run into
> > a build failure:
> >
> > /tmp/ccFCrjUg.s:80: Error: invalid barrier type -- `dmb ishld'
> > /tmp/ccFCrjUg.s:124: Error: invalid barrier type -- `dmb ishld'
> >
> > There also appears to be a problem getting the toolchain prefix from Kconfig.
> > If, for example, I do:
> >
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
> > [...]
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
> > [set CONFIG_CROSS_COMPILE_COMPAT_VDSO="vincenzo"]
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
> > arch/arm64/Makefile:64: *** vincenzogcc not found, check CROSS_COMPILE_COMPAT. Stop.
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
> > [set CONFIG_CROSS_COMPILE_COMPAT_VDSO="arm-linux-gnueabihf-"]
> > $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
> > arch/arm64/Makefile:64: *** vincenzogcc not found, check CROSS_COMPILE_COMPAT. Stop.
> > $ grep CONFIG_CROSS_COMPILE_COMPAT_VDSO .config
> > CONFIG_CROSS_COMPILE_COMPAT_VDSO="arm-linux-gnueabihf-"
> >
> > which is irritating, because it seems to force a 'mrproper' if you don't
> > get the prefix right first time.
> >
> > Cheers,
> >
> > Will
> >
>
> --
> Regards,
> Vincenzo