* [PATCH] selftest/vDSO: Fix cross build for the random tests
@ 2024-08-30 14:06 Mark Brown
2024-08-30 15:30 ` Jason A. Donenfeld
2024-08-30 15:34 ` Jason A. Donenfeld
0 siblings, 2 replies; 8+ messages in thread
From: Mark Brown @ 2024-08-30 14:06 UTC (permalink / raw)
To: Shuah Khan, Jason A. Donenfeld; +Cc: linux-kselftest, linux-kernel, Mark Brown
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. Use
a check for ARCH instead.
Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
The x86_64 build is still broken for me because nothing installs
tools/arch/x86_64/vdso/vgetrandom-chacha.S (I beleive it's supposed to
be copied from ./arch/x86/entry/vdso/vgetrandom-chacha.S but I don't see
how?) but this at least fixes all the other architectures.
---
tools/testing/selftests/vDSO/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index e21e78aae24d..7fb59310718c 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -10,7 +10,7 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
TEST_GEN_PROGS += vdso_standalone_test_x86
endif
TEST_GEN_PROGS += vdso_test_correctness
-ifeq ($(uname_M),x86_64)
+ifeq ($(ARCH),$(filter $(ARCH),x86_64))
TEST_GEN_PROGS += vdso_test_getrandom
TEST_GEN_PROGS += vdso_test_chacha
endif
---
base-commit: 985bf40edf4343dcb04c33f58b40b4a85c1776d4
change-id: 20240830-vdso-chacha-build-8d3789bf695c
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] selftest/vDSO: Fix cross build for the random tests
2024-08-30 14:06 [PATCH] selftest/vDSO: Fix cross build for the random tests Mark Brown
@ 2024-08-30 15:30 ` Jason A. Donenfeld
2024-08-30 15:42 ` Mark Brown
2024-08-30 15:34 ` Jason A. Donenfeld
1 sibling, 1 reply; 8+ messages in thread
From: Jason A. Donenfeld @ 2024-08-30 15:30 UTC (permalink / raw)
To: Mark Brown; +Cc: Shuah Khan, linux-kselftest, linux-kernel
On Fri, Aug 30, 2024 at 03:06:35PM +0100, Mark Brown wrote:
> 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. Use
> a check for ARCH instead.
>
> Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
> Signed-off-by: Mark Brown <broonie@kernel.org>
Thanks for the patch. Seems reasonable; I'll queue it up.
> ---
> The x86_64 build is still broken for me because nothing installs
> tools/arch/x86_64/vdso/vgetrandom-chacha.S (I beleive it's supposed to
> be copied from ./arch/x86/entry/vdso/vgetrandom-chacha.S but I don't see
> how?) but this at least fixes all the other architectures.
There should be a symlink installed for that. Are you using this tree?
https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git
That's where all these fixups are going for 6.12. (And yea, there are a
lot.)
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] selftest/vDSO: Fix cross build for the random tests
2024-08-30 15:30 ` Jason A. Donenfeld
@ 2024-08-30 15:42 ` Mark Brown
2024-08-30 15:58 ` Jason A. Donenfeld
0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2024-08-30 15:42 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: Shuah Khan, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 909 bytes --]
On Fri, Aug 30, 2024 at 05:30:07PM +0200, Jason A. Donenfeld wrote:
> On Fri, Aug 30, 2024 at 03:06:35PM +0100, Mark Brown wrote:
> > The x86_64 build is still broken for me because nothing installs
> > tools/arch/x86_64/vdso/vgetrandom-chacha.S (I beleive it's supposed to
> > be copied from ./arch/x86/entry/vdso/vgetrandom-chacha.S but I don't see
> > how?) but this at least fixes all the other architectures.
> There should be a symlink installed for that. Are you using this tree?
> https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git
> That's where all these fixups are going for 6.12. (And yea, there are a
> lot.)
I was using -next, hopefully it's getting merged in there (I see the
master branch is included). This is also breaking in for example
kernelci:
https://storage.kernelci.org/next/master/next-20240830/x86_64/x86_64_defconfig/gcc-12/logs/kselftest.log
in the same way.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftest/vDSO: Fix cross build for the random tests
2024-08-30 15:42 ` Mark Brown
@ 2024-08-30 15:58 ` Jason A. Donenfeld
0 siblings, 0 replies; 8+ messages in thread
From: Jason A. Donenfeld @ 2024-08-30 15:58 UTC (permalink / raw)
To: Mark Brown; +Cc: Shuah Khan, linux-kselftest, linux-kernel
On Fri, Aug 30, 2024 at 5:42 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Aug 30, 2024 at 05:30:07PM +0200, Jason A. Donenfeld wrote:
> > On Fri, Aug 30, 2024 at 03:06:35PM +0100, Mark Brown wrote:
>
> > > The x86_64 build is still broken for me because nothing installs
> > > tools/arch/x86_64/vdso/vgetrandom-chacha.S (I beleive it's supposed to
> > > be copied from ./arch/x86/entry/vdso/vgetrandom-chacha.S but I don't see
> > > how?) but this at least fixes all the other architectures.
>
> > There should be a symlink installed for that. Are you using this tree?
>
> > https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git
>
> > That's where all these fixups are going for 6.12. (And yea, there are a
> > lot.)
>
> I was using -next, hopefully it's getting merged in there (I see the
> master branch is included). This is also breaking in for example
> kernelci:
>
> https://storage.kernelci.org/next/master/next-20240830/x86_64/x86_64_defconfig/gcc-12/logs/kselftest.log
>
> in the same way.
Ahh yea it looks like that is running into the same thing as your v1,
which the v2 I posted fixes via SRCARCH:
make[4]: *** No rule to make target
'/tmp/kci/linux/tools/testing/selftests/../../../tools/arch/x86_64/vdso/vgetrandom-chacha.S',
needed by '/tmp/kci/linux/build/kselftest/vDSO/vdso_test_chacha'.
Stop.
Here it's looking for arch/x86_64/ instead of arch/x86/, because
$(ARCH) was used to interpolate the path instead of $(SRCARCH).
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selftest/vDSO: Fix cross build for the random tests
2024-08-30 14:06 [PATCH] selftest/vDSO: Fix cross build for the random tests Mark Brown
2024-08-30 15:30 ` Jason A. Donenfeld
@ 2024-08-30 15:34 ` Jason A. Donenfeld
2024-08-30 15:43 ` Mark Brown
1 sibling, 1 reply; 8+ messages in thread
From: Jason A. Donenfeld @ 2024-08-30 15:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Shuah Khan, linux-kselftest, linux-kernel
On Fri, Aug 30, 2024 at 03:06:35PM +0100, Mark Brown wrote:
> 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. Use
> a check for ARCH instead.
>
> Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> The x86_64 build is still broken for me because nothing installs
> tools/arch/x86_64/vdso/vgetrandom-chacha.S (I beleive it's supposed to
> be copied from ./arch/x86/entry/vdso/vgetrandom-chacha.S but I don't see
> how?) but this at least fixes all the other architectures.
> ---
> tools/testing/selftests/vDSO/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
> index e21e78aae24d..7fb59310718c 100644
> --- a/tools/testing/selftests/vDSO/Makefile
> +++ b/tools/testing/selftests/vDSO/Makefile
> @@ -10,7 +10,7 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
> TEST_GEN_PROGS += vdso_standalone_test_x86
> endif
> TEST_GEN_PROGS += vdso_test_correctness
> -ifeq ($(uname_M),x86_64)
> +ifeq ($(ARCH),$(filter $(ARCH),x86_64))
Actually... this doesn't work. Because:
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
The x86_64 gets turned into an x86. It's a little trickier when
considering subarch. I'll send a followup here and not queue this.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] selftest/vDSO: Fix cross build for the random tests
2024-08-30 15:34 ` Jason A. Donenfeld
@ 2024-08-30 15:43 ` Mark Brown
2024-08-30 15:54 ` [PATCH v2] selftests: vDSO: fix cross build for getrandom and chacha tests Jason A. Donenfeld
0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2024-08-30 15:43 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: Shuah Khan, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 530 bytes --]
On Fri, Aug 30, 2024 at 05:34:13PM +0200, Jason A. Donenfeld wrote:
> > +ifeq ($(ARCH),$(filter $(ARCH),x86_64))
> Actually... this doesn't work. Because:
> ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
> The x86_64 gets turned into an x86. It's a little trickier when
> considering subarch. I'll send a followup here and not queue this.
Ah, right - I originally had copied the line above with both x86 and
x86_64 when I tested and did a last minute edit during final review
after I'd switched away.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] selftests: vDSO: fix cross build for getrandom and chacha tests
2024-08-30 15:43 ` Mark Brown
@ 2024-08-30 15:54 ` Jason A. Donenfeld
2024-08-30 16:05 ` Mark Brown
0 siblings, 1 reply; 8+ messages in thread
From: Jason A. Donenfeld @ 2024-08-30 15:54 UTC (permalink / raw)
To: broonie, Shuah Khan, linux-kselftest, linux-kernel; +Cc: Jason A. Donenfeld
From: Mark Brown <broonie@kernel.org>
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. Use
a check for ARCH instead.
This also handles s a small complication in conditionalizing on x86_64
but not x86, which requires defining the standard SRCARCH variable and
being careful about which uname-m substitutions are done.
Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
Mark - is this okay with you? I fixed the issue I mentioned.
tools/testing/selftests/vDSO/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index e21e78aae24d..5ead6b1f0478 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m | sed -e s/i.86/x86/)
+SRCARCH := $(subst x86_64,x86,$(ARCH))
TEST_GEN_PROGS := vdso_test_gettimeofday
TEST_GEN_PROGS += vdso_test_getcpu
@@ -10,7 +10,7 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
TEST_GEN_PROGS += vdso_standalone_test_x86
endif
TEST_GEN_PROGS += vdso_test_correctness
-ifeq ($(uname_M),x86_64)
+ifeq ($(ARCH),$(filter $(ARCH),x86_64))
TEST_GEN_PROGS += vdso_test_getrandom
TEST_GEN_PROGS += vdso_test_chacha
endif
@@ -38,8 +38,8 @@ $(OUTPUT)/vdso_test_getrandom: CFLAGS += -isystem $(top_srcdir)/tools/include \
$(KHDR_INCLUDES) \
-isystem $(top_srcdir)/include/uapi
-$(OUTPUT)/vdso_test_chacha: $(top_srcdir)/tools/arch/$(ARCH)/vdso/vgetrandom-chacha.S
+$(OUTPUT)/vdso_test_chacha: $(top_srcdir)/tools/arch/$(SRCARCH)/vdso/vgetrandom-chacha.S
$(OUTPUT)/vdso_test_chacha: CFLAGS += -idirafter $(top_srcdir)/tools/include \
- -idirafter $(top_srcdir)/arch/$(ARCH)/include \
+ -idirafter $(top_srcdir)/arch/$(SRCARCH)/include \
-idirafter $(top_srcdir)/include \
-D__ASSEMBLY__ -Wa,--noexecstack
--
2.46.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v2] selftests: vDSO: fix cross build for getrandom and chacha tests
2024-08-30 15:54 ` [PATCH v2] selftests: vDSO: fix cross build for getrandom and chacha tests Jason A. Donenfeld
@ 2024-08-30 16:05 ` Mark Brown
0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-08-30 16:05 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: Shuah Khan, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]
On Fri, Aug 30, 2024 at 05:54:35PM +0200, Jason A. Donenfeld wrote:
> From: Mark Brown <broonie@kernel.org>
>
> 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. Use
> a check for ARCH instead.
>
> This also handles s a small complication in conditionalizing on x86_64
> but not x86, which requires defining the standard SRCARCH variable and
> being careful about which uname-m substitutions are done.
>
> Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> Mark - is this okay with you? I fixed the issue I mentioned.
That makes sense and appears to work for me so:
Tested-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-08-30 16:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 14:06 [PATCH] selftest/vDSO: Fix cross build for the random tests Mark Brown
2024-08-30 15:30 ` Jason A. Donenfeld
2024-08-30 15:42 ` Mark Brown
2024-08-30 15:58 ` Jason A. Donenfeld
2024-08-30 15:34 ` Jason A. Donenfeld
2024-08-30 15:43 ` Mark Brown
2024-08-30 15:54 ` [PATCH v2] selftests: vDSO: fix cross build for getrandom and chacha tests Jason A. Donenfeld
2024-08-30 16:05 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox