• Jason A. Donenfeld's avatar
    selftests: vDSO: fix cross build for getrandom and chacha tests · 67a121ac
    Jason A. Donenfeld authored
    Unlike the check for the standalone x86 test, the check for building the
    vDSO getrandom and chacaha tests looks at the architecture for the host
    rather than the architecture for the target when deciding if they should
    be built. Since the chacha test includes some assembler code this means
    that cross building with x86 as either the target or host is broken.
    
    There's also some additional complications, where ARCH can legitimately
    be either x86_64 or x86, but the source code we need to compile lives in
    a directory path containing arch/x86. The standard SRCARCH variable
    handles that. And actually, all these variables and proper substitutions
    are already described in tools/scripts/Makefile.arch, so just include
    that to handle it.
    
    Similarly, ARCH=x86 can actually describe ARCH=x86_64,
    just with CONFIG_64BIT, so we can't rely on ARCH for selecting
    non-32-bit tests. For that, check against $(ARCH)$(CONFIG_X86_32). This
    won't help for people manually running this inside the vDSO selftest
    directory (which isn't really supported anyway and has problems on
    various archs), but it should work for builds of the kselftests, where
    the CONFIG_* variables are defined. On x86_64 machines,
    $(ARCH)$(CONFIG_X86_32) will evaluate to x86. On arm64 machines, it will
    evaluate to arm64. On 32-bit x86 machines, it will evaluate to x86y,
    which won't match the filter list.
    Reported-by: default avatarMark Brown <broonie@kernel.org>
    Reported-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    67a121ac
Makefile 1.76 KB