linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] rust: arch/um: Rust support for UML
@ 2022-12-17  4:44 David Gow
  2022-12-17  4:44 ` [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML David Gow
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: David Gow @ 2022-12-17  4:44 UTC (permalink / raw)
  To: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers
  Cc: David Gow, rust-for-linux, linux-um, llvm, linux-doc, kunit-dev,
	x86, linux-kernel, Wedson Almeida Filho, Gary Guo,
	Brendan Higgins, Daniel Latypov, Jonathan Corbet

This series adds support for building and running code in the Rust
programming language under x86_64 UML kernels.

It is based on two Pull Requests from the Rust-for-Linux GitHub page:
- https://github.com/Rust-for-Linux/linux/pull/766
- https://github.com/Rust-for-Linux/linux/pull/881

The series consists of three patches: the first two set up various
compiler options to match both the UML and the X86 CFLAGS.

Rust support can be enabled by setting CONFIG_RUST=y, when the suitable
Rust compiler and bindgen versions are available (run make rustavaiable
to check). LLVM=1 is also required at present with all Rust builds.

The whole thing can be built and tested with kunit.py:
./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_RUST=y --make_options LLVM=1

(Note that there are no Rust-based KUnit tests upstream yet. The "rust"
branch of the Rust-for-Linux GitHub repository does use KUnit for its
"doctests", and all of those tests pass under UML with these patches.)

This series is currently based on the uml/next branch: I'm happy to
rebase it next year once we're past the 6.2 merge window (though it
applies cleanly to torvalds/master at the moment). Equally, it
should be possible to take these changes in via the rust tree instead,
but since it's mostly UML Makefile changes, it probably makes more sense
for it to go in via the uml tree.

Also note that this series marks UML as a "maintained" architecture for
Rust support. It's definitely my intention to keep this working, but if
anyone has serious concerns, we can downgrade that.

Cheers,
-- David

David Gow (3):
  rust: arch/um: Use 'pie' relocation mode under UML
  rust: arch/um: Disable FP/SIMD instruction to match x86
  rust: arch/um: Add support for CONFIG_RUST under x86_64 UML

 Documentation/rust/arch-support.rst | 2 ++
 arch/um/Kconfig                     | 1 +
 arch/um/Makefile                    | 2 ++
 arch/x86/Makefile.um                | 6 ++++++
 4 files changed, 11 insertions(+)

-- 
2.39.0.314.g84b9a713c41-goog


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML
  2022-12-17  4:44 [PATCH 0/3] rust: arch/um: Rust support for UML David Gow
@ 2022-12-17  4:44 ` David Gow
  2023-01-15 10:30   ` Thomas Meyer
  2022-12-17  4:44 ` [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86 David Gow
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: David Gow @ 2022-12-17  4:44 UTC (permalink / raw)
  To: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers
  Cc: David Gow, rust-for-linux, linux-um, llvm, linux-doc, kunit-dev,
	x86, linux-kernel, Wedson Almeida Filho, Gary Guo,
	Brendan Higgins, Daniel Latypov, Jonathan Corbet

UML expects a position independent executable for some reason, so tell
rustc to generate pie objects. Otherwise we get a bunch of relocations
we can't deal with in libcore.

Signed-off-by: David Gow <davidgow@google.com>
---
 arch/um/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index f1d4d67157be..ae321282dc6f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
 	-Din6addr_loopback=kernel_in6addr_loopback \
 	-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
 
+KBUILD_RUSTFLAGS += -Crelocation-model=pie
+
 KBUILD_AFLAGS += $(ARCH_INCLUDE)
 
 USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
-- 
2.39.0.314.g84b9a713c41-goog


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86
  2022-12-17  4:44 [PATCH 0/3] rust: arch/um: Rust support for UML David Gow
  2022-12-17  4:44 ` [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML David Gow
@ 2022-12-17  4:44 ` David Gow
  2023-01-15  9:47   ` Sergio González Collado
  2022-12-17  4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
  2022-12-17 11:59 ` [PATCH 0/3] rust: arch/um: Rust support for UML Miguel Ojeda
  3 siblings, 1 reply; 10+ messages in thread
From: David Gow @ 2022-12-17  4:44 UTC (permalink / raw)
  To: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers
  Cc: David Gow, rust-for-linux, linux-um, llvm, linux-doc, kunit-dev,
	x86, linux-kernel, Wedson Almeida Filho, Gary Guo,
	Brendan Higgins, Daniel Latypov, Jonathan Corbet

The kernel disables all SSE and similar FP/SIMD instructions on
x86-based architectures (partly because we shouldn't be using floats in
the kernel, and partly to avoid the need for stack alignment, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 )

UML does not do the same thing, which isn't in itself a problem, but
does add to the list of differences between UML and "normal" x86 builds.

In addition, there was a crash bug with LLVM < 15 / rustc < 1.65 when
building with SSE, so disabling it fixes rust builds with earlier
compiler versions, see:
https://github.com/Rust-for-Linux/linux/pull/881

Signed-off-by: David Gow <davidgow@google.com>
---
 arch/x86/Makefile.um | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index b3c1ae084180..d2e95d1d4db7 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0
 core-y += arch/x86/crypto/
 
+#
+# Disable SSE and other FP/SIMD instructions to match normal x86
+#
+KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
+KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
+
 ifeq ($(CONFIG_X86_32),y)
 START := 0x8048000
 
-- 
2.39.0.314.g84b9a713c41-goog


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
  2022-12-17  4:44 [PATCH 0/3] rust: arch/um: Rust support for UML David Gow
  2022-12-17  4:44 ` [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML David Gow
  2022-12-17  4:44 ` [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86 David Gow
@ 2022-12-17  4:44 ` David Gow
  2023-01-15  9:49   ` Sergio González Collado
                     ` (2 more replies)
  2022-12-17 11:59 ` [PATCH 0/3] rust: arch/um: Rust support for UML Miguel Ojeda
  3 siblings, 3 replies; 10+ messages in thread
From: David Gow @ 2022-12-17  4:44 UTC (permalink / raw)
  To: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers
  Cc: David Gow, rust-for-linux, linux-um, llvm, linux-doc, kunit-dev,
	x86, linux-kernel, Wedson Almeida Filho, Gary Guo,
	Brendan Higgins, Daniel Latypov, Jonathan Corbet

CONFIG_RUST currently supports x86_64, but does not support it under
UML. With the previous patches applied, adding support is trivial:
add CONFIG_HAVE_RUST to UML if X86_64 is set.

The scripts/generate_rust_target.rs file already checks for
CONFIG_X86_64, not CONFIG_X86, so is prepared for UML support.

The Rust support does not currently support X86_32.

Also, update the Rust architecture support documentation to not that
this is being maintained: I intend to look after this as best I can.

Signed-off-by: David Gow <davidgow@google.com>
---
 Documentation/rust/arch-support.rst | 2 ++
 arch/um/Kconfig                     | 1 +
 2 files changed, 3 insertions(+)

diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index 6982b63775da..a526ca1c688b 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
 ============  ================  ==============================================
 ``x86``       Maintained        ``x86_64`` only.
 ============  ================  ==============================================
+``um``        Maintained        ``x86_64`` only.
+============  ================  ==============================================
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index ad4ff3b0e91e..4db186f019ae 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -28,6 +28,7 @@ config UML
 	select TRACE_IRQFLAGS_SUPPORT
 	select TTY # Needed for line.c
 	select HAVE_ARCH_VMAP_STACK
+	select HAVE_RUST			if X86_64
 
 config MMU
 	bool
-- 
2.39.0.314.g84b9a713c41-goog


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] rust: arch/um: Rust support for UML
  2022-12-17  4:44 [PATCH 0/3] rust: arch/um: Rust support for UML David Gow
                   ` (2 preceding siblings ...)
  2022-12-17  4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
@ 2022-12-17 11:59 ` Miguel Ojeda
  3 siblings, 0 replies; 10+ messages in thread
From: Miguel Ojeda @ 2022-12-17 11:59 UTC (permalink / raw)
  To: David Gow
  Cc: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers, rust-for-linux, linux-um,
	llvm, linux-doc, kunit-dev, x86, linux-kernel,
	Wedson Almeida Filho, Gary Guo, Brendan Higgins, Daniel Latypov,
	Jonathan Corbet

On Sat, Dec 17, 2022 at 5:44 AM David Gow <davidgow@google.com> wrote:
>
> This series adds support for building and running code in the Rust
> programming language under x86_64 UML kernels.

Thanks for all your work and support on getting KUnit/UML + Rust ready
(long before we landed in mainline!).

> This series is currently based on the uml/next branch: I'm happy to
> rebase it next year once we're past the 6.2 merge window (though it
> applies cleanly to torvalds/master at the moment). Equally, it
> should be possible to take these changes in via the rust tree instead,
> but since it's mostly UML Makefile changes, it probably makes more sense
> for it to go in via the uml tree.

Agreed.

> Also note that this series marks UML as a "maintained" architecture for
> Rust support. It's definitely my intention to keep this working, but if

That is great -- thanks for stepping up!

Cheers,
Miguel

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86
  2022-12-17  4:44 ` [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86 David Gow
@ 2023-01-15  9:47   ` Sergio González Collado
  0 siblings, 0 replies; 10+ messages in thread
From: Sergio González Collado @ 2023-01-15  9:47 UTC (permalink / raw)
  To: David Gow
  Cc: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers, rust-for-linux, linux-um,
	llvm, linux-doc, kunit-dev, x86, linux-kernel,
	Wedson Almeida Filho, Gary Guo, Brendan Higgins, Daniel Latypov,
	Jonathan Corbet

On Sat, 17 Dec 2022 at 05:49, David Gow <davidgow@google.com> wrote:
>
> The kernel disables all SSE and similar FP/SIMD instructions on
> x86-based architectures (partly because we shouldn't be using floats in
> the kernel, and partly to avoid the need for stack alignment, see:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 )
>
> UML does not do the same thing, which isn't in itself a problem, but
> does add to the list of differences between UML and "normal" x86 builds.
>
> In addition, there was a crash bug with LLVM < 15 / rustc < 1.65 when
> building with SSE, so disabling it fixes rust builds with earlier
> compiler versions, see:
> https://github.com/Rust-for-Linux/linux/pull/881
>
> Signed-off-by: David Gow <davidgow@google.com>
> ---
>  arch/x86/Makefile.um | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
> index b3c1ae084180..d2e95d1d4db7 100644
> --- a/arch/x86/Makefile.um
> +++ b/arch/x86/Makefile.um
> @@ -1,6 +1,12 @@
>  # SPDX-License-Identifier: GPL-2.0
>  core-y += arch/x86/crypto/
>
> +#
> +# Disable SSE and other FP/SIMD instructions to match normal x86
> +#
> +KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
> +KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
> +
>  ifeq ($(CONFIG_X86_32),y)
>  START := 0x8048000
>
> --
> 2.39.0.314.g84b9a713c41-goog
>

Reviewed-by: Sergio González Collado <sergio.collado@gmail.com>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
  2022-12-17  4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
@ 2023-01-15  9:49   ` Sergio González Collado
  2023-01-15  9:51   ` Sergio González Collado
  2023-01-15 21:42   ` Miguel Ojeda
  2 siblings, 0 replies; 10+ messages in thread
From: Sergio González Collado @ 2023-01-15  9:49 UTC (permalink / raw)
  To: David Gow
  Cc: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers, rust-for-linux, linux-um,
	llvm, linux-doc, kunit-dev, x86, linux-kernel,
	Wedson Almeida Filho, Gary Guo, Brendan Higgins, Daniel Latypov,
	Jonathan Corbet

On Sat, 17 Dec 2022 at 05:48, David Gow <davidgow@google.com> wrote:
>
> CONFIG_RUST currently supports x86_64, but does not support it under
> UML. With the previous patches applied, adding support is trivial:
> add CONFIG_HAVE_RUST to UML if X86_64 is set.
>
> The scripts/generate_rust_target.rs file already checks for
> CONFIG_X86_64, not CONFIG_X86, so is prepared for UML support.
>
> The Rust support does not currently support X86_32.
>
> Also, update the Rust architecture support documentation to not that
> this is being maintained: I intend to look after this as best I can.
>
> Signed-off-by: David Gow <davidgow@google.com>
> ---
>  Documentation/rust/arch-support.rst | 2 ++
>  arch/um/Kconfig                     | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
> index 6982b63775da..a526ca1c688b 100644
> --- a/Documentation/rust/arch-support.rst
> +++ b/Documentation/rust/arch-support.rst
> @@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
>  ============  ================  ==============================================
>  ``x86``       Maintained        ``x86_64`` only.
>  ============  ================  ==============================================
> +``um``        Maintained        ``x86_64`` only.
> +============  ================  ==============================================
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index ad4ff3b0e91e..4db186f019ae 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -28,6 +28,7 @@ config UML
>         select TRACE_IRQFLAGS_SUPPORT
>         select TTY # Needed for line.c
>         select HAVE_ARCH_VMAP_STACK
> +       select HAVE_RUST                        if X86_64
>
>  config MMU
>         bool
> --
> 2.39.0.314.g84b9a713c41-goog
>

Reviewed-by: Sergio González Collado <sergio.collado@gmail.com>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
  2022-12-17  4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
  2023-01-15  9:49   ` Sergio González Collado
@ 2023-01-15  9:51   ` Sergio González Collado
  2023-01-15 21:42   ` Miguel Ojeda
  2 siblings, 0 replies; 10+ messages in thread
From: Sergio González Collado @ 2023-01-15  9:51 UTC (permalink / raw)
  To: David Gow
  Cc: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers, rust-for-linux, linux-um,
	llvm, linux-doc, kunit-dev, x86, linux-kernel,
	Wedson Almeida Filho, Gary Guo, Brendan Higgins, Daniel Latypov,
	Jonathan Corbet

On Sat, 17 Dec 2022 at 05:48, David Gow <davidgow@google.com> wrote:
>
> CONFIG_RUST currently supports x86_64, but does not support it under
> UML. With the previous patches applied, adding support is trivial:
> add CONFIG_HAVE_RUST to UML if X86_64 is set.
>
> The scripts/generate_rust_target.rs file already checks for
> CONFIG_X86_64, not CONFIG_X86, so is prepared for UML support.
>
> The Rust support does not currently support X86_32.
>
> Also, update the Rust architecture support documentation to not that
> this is being maintained: I intend to look after this as best I can.
>
> Signed-off-by: David Gow <davidgow@google.com>
> ---
>  Documentation/rust/arch-support.rst | 2 ++
>  arch/um/Kconfig                     | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
> index 6982b63775da..a526ca1c688b 100644
> --- a/Documentation/rust/arch-support.rst
> +++ b/Documentation/rust/arch-support.rst
> @@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
>  ============  ================  ==============================================
>  ``x86``       Maintained        ``x86_64`` only.
>  ============  ================  ==============================================
> +``um``        Maintained        ``x86_64`` only.
> +============  ================  ==============================================
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index ad4ff3b0e91e..4db186f019ae 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -28,6 +28,7 @@ config UML
>         select TRACE_IRQFLAGS_SUPPORT
>         select TTY # Needed for line.c
>         select HAVE_ARCH_VMAP_STACK
> +       select HAVE_RUST                        if X86_64
>
>  config MMU
>         bool
> --
> 2.39.0.314.g84b9a713c41-goog
>

Tested-by: Sergio González Collado <sergio.collado@gmail.com>

sergio@laptop:~/repos/rust-for-linux$ git log -4 --oneline
888468208678 (HEAD) rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
055730a58ded rust: arch/um: Disable FP/SIMD instruction to match x86
924ccc99887f rust: arch/um: Use 'pie' relocation mode under UML
615131b8e9bc (tag: rust-v6.1-rc1, origin/for-next/rust) MAINTAINERS: Rust
sergio@laptop:~/repos/rust-for-linux$ ./tools/testing/kunit/kunit.py
run --kconfig_add CONFIG_RUST=y --make_options LLVM=1
[10:43:28] Configuring KUnit Kernel ...
[10:43:28] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig LLVM=1
Building with:
$ make ARCH=um O=.kunit --jobs=12 LLVM=1
/usr/bin/ld: warning: arch/x86/um/vdso/vdso.o: missing .note.GNU-stack
section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in
a future version of the linker
/usr/bin/ld: init/main.o: warning: relocation in read-only section `.ref.text'
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms1 has a LOAD segment with
RWX permissions
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms1.o: missing
.note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in
a future version of the linker
/usr/bin/ld: init/main.o: warning: relocation in read-only section `.ref.text'
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms2 has a LOAD segment with
RWX permissions
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms2.o: missing
.note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in
a future version of the linker
/usr/bin/ld: init/main.o: warning: relocation in read-only section `.ref.text'
/usr/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE

[10:44:20] Starting KUnit Kernel (1/1)...
[10:44:20] ============================================================
[10:44:21] =============== time_test_cases (1 subtest) ================
[10:44:21] [PASSED] time64_to_tm_test_date_range
[10:44:21] ================= [PASSED] time_test_cases =================
[10:44:21] ================== resource (2 subtests) ===================
[10:44:21] [PASSED] resource_test_union
[10:44:21] [PASSED] resource_test_intersection
[10:44:21] ==================== [PASSED] resource =====================
[10:44:21] ================ sysctl_test (10 subtests) =================
[10:44:21] [PASSED] sysctl_test_api_dointvec_null_tbl_data
[10:44:21] [PASSED] sysctl_test_api_dointvec_table_maxlen_unset
[10:44:21] [PASSED] sysctl_test_api_dointvec_table_len_is_zero
[10:44:21] [PASSED] sysctl_test_api_dointvec_table_read_but_position_set
[10:44:21] [PASSED] sysctl_test_dointvec_read_happy_single_positive
[10:44:21] [PASSED] sysctl_test_dointvec_read_happy_single_negative
[10:44:21] [PASSED] sysctl_test_dointvec_write_happy_single_positive
[10:44:21] [PASSED] sysctl_test_dointvec_write_happy_single_negative
[10:44:21] [PASSED] sysctl_test_api_dointvec_write_single_less_int_min
[10:44:21] [PASSED] sysctl_test_api_dointvec_write_single_greater_int_max
[10:44:21] =================== [PASSED] sysctl_test ===================
[10:44:21] ================== binfmt_elf (1 subtest) ==================
[10:44:21] [PASSED] total_mapping_size_test
[10:44:21] =================== [PASSED] binfmt_elf ====================
[10:44:21] =================== cpumask (6 subtests) ===================
[10:44:21] [PASSED] test_cpumask_weight
[10:44:21] [PASSED] test_cpumask_first
[10:44:21] [PASSED] test_cpumask_last
[10:44:21] [PASSED] test_cpumask_next
[10:44:21] [PASSED] test_cpumask_iterators
[10:44:21] [PASSED] test_cpumask_iterators_builtin
[10:44:21] ===================== [PASSED] cpumask =====================
[10:44:21] ==================== hash (2 subtests) =====================
[10:44:21] [PASSED] test_string_or
[10:44:21] [PASSED] test_hash_or
[10:44:21] ====================== [PASSED] hash =======================
[10:44:21] ================== list_sort (1 subtest) ===================
[10:44:21] [PASSED] list_sort_test
[10:44:21] ==================== [PASSED] list_sort ====================
[10:44:21] =================== lib_sort (1 subtest) ===================
[10:44:21] [PASSED] test_sort
[10:44:21] ==================== [PASSED] lib_sort =====================
[10:44:21] ============= kunit_executor_test (4 subtests) =============
[10:44:21] [PASSED] parse_filter_test
[10:44:21] [PASSED] filter_suites_test
[10:44:21] [PASSED] filter_suites_test_glob_test
[10:44:21] [PASSED] filter_suites_to_empty_test
[10:44:21] =============== [PASSED] kunit_executor_test ===============
[10:44:21] ============ kunit-try-catch-test (2 subtests) =============
[10:44:21] [PASSED] kunit_test_try_catch_successful_try_no_catch
[10:44:21] [PASSED] kunit_test_try_catch_unsuccessful_try_does_catch
[10:44:21] ============== [PASSED] kunit-try-catch-test ===============
[10:44:21] ============= kunit-resource-test (8 subtests) =============
[10:44:21] [PASSED] kunit_resource_test_init_resources
[10:44:21] [PASSED] kunit_resource_test_alloc_resource
[10:44:21] [PASSED] kunit_resource_test_destroy_resource
[10:44:21] [PASSED] kunit_resource_test_remove_resource
[10:44:21] [PASSED] kunit_resource_test_cleanup_resources
[10:44:21] [PASSED] kunit_resource_test_proper_free_ordering
[10:44:21] [PASSED] kunit_resource_test_static
[10:44:21] [PASSED] kunit_resource_test_named
[10:44:21] =============== [PASSED] kunit-resource-test ===============
[10:44:21] ================ kunit-log-test (1 subtest) ================
[10:44:21] [PASSED] kunit_log_test
[10:44:21] ================= [PASSED] kunit-log-test ==================
[10:44:21] ================ kunit_status (2 subtests) =================
[10:44:21] [PASSED] kunit_status_set_failure_test
[10:44:21] [PASSED] kunit_status_mark_skipped_test
[10:44:21] ================== [PASSED] kunit_status ===================
[10:44:21] ============= string-stream-test (3 subtests) ==============
[10:44:21] [PASSED] string_stream_test_empty_on_creation
[10:44:21] [PASSED] string_stream_test_not_empty_after_add
[10:44:21] [PASSED] string_stream_test_get_string
[10:44:21] =============== [PASSED] string-stream-test ================
[10:44:21] =================== example (4 subtests) ===================
[10:44:21] [PASSED] example_simple_test
[10:44:21] [SKIPPED] example_skip_test
[10:44:21] [SKIPPED] example_mark_skipped_test
[10:44:21] [PASSED] example_all_expect_macros_test
[10:44:21] ===================== [PASSED] example =====================
[10:44:21] ================== bitfields (2 subtests) ==================
[10:44:21] [PASSED] test_bitfields_constants
[10:44:21] [PASSED] test_bitfields_variables
[10:44:21] ==================== [PASSED] bitfields ====================
[10:44:21] ============== list-kunit-test (39 subtests) ===============
[10:44:21] [PASSED] list_test_list_init
[10:44:21] [PASSED] list_test_list_add
[10:44:21] [PASSED] list_test_list_add_tail
[10:44:21] [PASSED] list_test_list_del
[10:44:21] [PASSED] list_test_list_replace
[10:44:21] [PASSED] list_test_list_replace_init
[10:44:21] [PASSED] list_test_list_swap
[10:44:21] [PASSED] list_test_list_del_init
[10:44:21] [PASSED] list_test_list_del_init_careful
[10:44:21] [PASSED] list_test_list_move
[10:44:21] [PASSED] list_test_list_move_tail
[10:44:21] [PASSED] list_test_list_bulk_move_tail
[10:44:21] [PASSED] list_test_list_is_head
[10:44:21] [PASSED] list_test_list_is_first
[10:44:21] [PASSED] list_test_list_is_last
[10:44:21] [PASSED] list_test_list_empty
[10:44:21] [PASSED] list_test_list_empty_careful
[10:44:21] [PASSED] list_test_list_rotate_left
[10:44:21] [PASSED] list_test_list_rotate_to_front
[10:44:21] [PASSED] list_test_list_is_singular
[10:44:21] [PASSED] list_test_list_cut_position
[10:44:21] [PASSED] list_test_list_cut_before
[10:44:21] [PASSED] list_test_list_splice
[10:44:21] [PASSED] list_test_list_splice_tail
[10:44:21] [PASSED] list_test_list_splice_init
[10:44:21] [PASSED] list_test_list_splice_tail_init
[10:44:21] [PASSED] list_test_list_entry
[10:44:21] [PASSED] list_test_list_entry_is_head
[10:44:21] [PASSED] list_test_list_first_entry
[10:44:21] [PASSED] list_test_list_last_entry
[10:44:21] [PASSED] list_test_list_first_entry_or_null
[10:44:21] [PASSED] list_test_list_next_entry
[10:44:21] [PASSED] list_test_list_prev_entry
[10:44:21] [PASSED] list_test_list_for_each
[10:44:21] [PASSED] list_test_list_for_each_prev
[10:44:21] [PASSED] list_test_list_for_each_safe
[10:44:21] [PASSED] list_test_list_for_each_prev_safe
[10:44:21] [PASSED] list_test_list_for_each_entry
[10:44:21] [PASSED] list_test_list_for_each_entry_reverse
[10:44:21] ================= [PASSED] list-kunit-test =================
[10:44:21] =================== hlist (18 subtests) ====================
[10:44:21] [PASSED] hlist_test_init
[10:44:21] [PASSED] hlist_test_unhashed
[10:44:21] [PASSED] hlist_test_unhashed_lockless
[10:44:21] [PASSED] hlist_test_del
[10:44:21] [PASSED] hlist_test_del_init
[10:44:21] [PASSED] hlist_test_add
[10:44:21] [PASSED] hlist_test_fake
[10:44:21] [PASSED] hlist_test_is_singular_node
[10:44:21] [PASSED] hlist_test_empty
[10:44:21] [PASSED] hlist_test_move_list
[10:44:21] [PASSED] hlist_test_entry
[10:44:21] [PASSED] hlist_test_entry_safe
[10:44:21] [PASSED] hlist_test_for_each
[10:44:21] [PASSED] hlist_test_for_each_safe
[10:44:21] [PASSED] hlist_test_for_each_entry
[10:44:21] [PASSED] hlist_test_for_each_entry_continue
[10:44:21] [PASSED] hlist_test_for_each_entry_from
[10:44:21] [PASSED] hlist_test_for_each_entry_safe
[10:44:21] ====================== [PASSED] hlist ======================
[10:44:21] ================== bits-test (3 subtests) ==================
[10:44:21] [PASSED] genmask_test
[10:44:21] [PASSED] genmask_ull_test
[10:44:21] [PASSED] genmask_input_check_test
[10:44:21] ==================== [PASSED] bits-test ====================
[10:44:21] =================== cmdline (4 subtests) ===================
[10:44:21] [PASSED] cmdline_test_noint
[10:44:21] [PASSED] cmdline_test_lead_int
[10:44:21] [PASSED] cmdline_test_tail_int
[10:44:21] [PASSED] cmdline_test_range
[10:44:21] ===================== [PASSED] cmdline =====================
[10:44:21] ================== slub_test (5 subtests) ==================
[10:44:21] [PASSED] test_clobber_zone
[10:44:21] [PASSED] test_next_pointer
[10:44:21] [PASSED] test_first_word
[10:44:21] [PASSED] test_clobber_50th_byte
[10:44:21] [PASSED] test_clobber_redzone_free
[10:44:21] ==================== [PASSED] slub_test ====================
[10:44:21] =================== memcpy (3 subtests) ====================
[10:44:21] [PASSED] memset_test
[10:44:21] [PASSED] memcpy_test
[10:44:21] [PASSED] memmove_test
[10:44:21] ===================== [PASSED] memcpy ======================
[10:44:21] ================== overflow (11 subtests) ==================
[10:44:21] [PASSED] u8_overflow_test
[10:44:21] [PASSED] s8_overflow_test
[10:44:21] [PASSED] u16_overflow_test
[10:44:21] [PASSED] s16_overflow_test
[10:44:21] [PASSED] u32_overflow_test
[10:44:21] [PASSED] s32_overflow_test
[10:44:21] [PASSED] u64_overflow_test
[10:44:21] [PASSED] s64_overflow_test
[10:44:21] [PASSED] overflow_shift_test
[10:44:21] [PASSED] overflow_allocation_test
[10:44:21] [PASSED] overflow_size_helpers_test
[10:44:21] ==================== [PASSED] overflow =====================
[10:44:21] ================= stackinit (65 subtests) ==================
[10:44:21] [PASSED] test_u8_zero
[10:44:21] [PASSED] test_u16_zero
[10:44:21] [PASSED] test_u32_zero
[10:44:21] [PASSED] test_u64_zero
[10:44:21] [PASSED] test_char_array_zero
[10:44:21] [PASSED] test_small_hole_zero
[10:44:21] [PASSED] test_big_hole_zero
[10:44:21] [PASSED] test_trailing_hole_zero
[10:44:21] [PASSED] test_packed_zero
[10:44:21] [PASSED] test_small_hole_dynamic_partial
[10:44:21] [PASSED] test_big_hole_dynamic_partial
[10:44:21] [PASSED] test_trailing_hole_dynamic_partial
[10:44:21] [PASSED] test_packed_dynamic_partial
[10:44:21] [PASSED] test_small_hole_assigned_dynamic_partial
[10:44:21] [PASSED] test_big_hole_assigned_dynamic_partial
[10:44:21] [PASSED] test_trailing_hole_assigned_dynamic_partial
[10:44:21] [PASSED] test_packed_assigned_dynamic_partial
[10:44:21] [PASSED] test_small_hole_static_partial
[10:44:21] [PASSED] test_big_hole_static_partial
[10:44:21] [PASSED] test_trailing_hole_static_partial
[10:44:21] [PASSED] test_packed_static_partial
[10:44:21] [PASSED] test_small_hole_static_all
[10:44:21] [PASSED] test_big_hole_static_all
[10:44:21] [PASSED] test_trailing_hole_static_all
[10:44:21] [PASSED] test_packed_static_all
[10:44:21] [PASSED] test_small_hole_dynamic_all
[10:44:21] [PASSED] test_big_hole_dynamic_all
[10:44:21] [PASSED] test_trailing_hole_dynamic_all
[10:44:21] [PASSED] test_packed_dynamic_all
[10:44:21] [PASSED] test_small_hole_runtime_partial
[10:44:21] [PASSED] test_big_hole_runtime_partial
[10:44:21] [PASSED] test_trailing_hole_runtime_partial
[10:44:21] [PASSED] test_packed_runtime_partial
[10:44:21] [PASSED] test_small_hole_runtime_all
[10:44:21] [PASSED] test_big_hole_runtime_all
[10:44:21] [PASSED] test_trailing_hole_runtime_all
[10:44:21] [PASSED] test_packed_runtime_all
[10:44:21] [PASSED] test_small_hole_assigned_static_partial
[10:44:21] [PASSED] test_big_hole_assigned_static_partial
[10:44:21] [PASSED] test_trailing_hole_assigned_static_partial
[10:44:21] [PASSED] test_packed_assigned_static_partial
[10:44:21] [PASSED] test_small_hole_assigned_static_all
[10:44:21] [PASSED] test_big_hole_assigned_static_all
[10:44:21] [PASSED] test_trailing_hole_assigned_static_all
[10:44:21] [PASSED] test_packed_assigned_static_all
[10:44:21] [PASSED] test_small_hole_assigned_dynamic_all
[10:44:21] [PASSED] test_big_hole_assigned_dynamic_all
[10:44:21] [PASSED] test_trailing_hole_assigned_dynamic_all
[10:44:21] [PASSED] test_packed_assigned_dynamic_all
[10:44:21] [SKIPPED] test_small_hole_assigned_copy
[10:44:21] [SKIPPED] test_big_hole_assigned_copy
[10:44:21] [SKIPPED] test_trailing_hole_assigned_copy
[10:44:21] [PASSED] test_packed_assigned_copy
[10:44:21] [PASSED] test_u8_none
[10:44:21] [PASSED] test_u16_none
[10:44:21] [PASSED] test_u32_none
[10:44:21] [PASSED] test_u64_none
[10:44:21] [PASSED] test_char_array_none
[10:44:21] [SKIPPED] test_switch_1_none
[10:44:21] [SKIPPED] test_switch_2_none
[10:44:21] [PASSED] test_small_hole_none
[10:44:21] [PASSED] test_big_hole_none
[10:44:21] [PASSED] test_trailing_hole_none
[10:44:21] [PASSED] test_packed_none
[10:44:21] [PASSED] test_user
[10:44:21] ==================== [PASSED] stackinit ====================
[10:44:21] =============== qos-kunit-test (3 subtests) ================
[10:44:21] [PASSED] freq_qos_test_min
[10:44:21] [PASSED] freq_qos_test_maxdef
[10:44:21] [PASSED] freq_qos_test_readd
[10:44:21] ================= [PASSED] qos-kunit-test ==================
[10:44:21] =============== property-entry (7 subtests) ================
[10:44:21] [PASSED] pe_test_uints
[10:44:21] [PASSED] pe_test_uint_arrays
[10:44:21] [PASSED] pe_test_strings
[10:44:21] [PASSED] pe_test_bool
[10:44:21] [PASSED] pe_test_move_inline_u8
[10:44:21] [PASSED] pe_test_move_inline_str
[10:44:21] [PASSED] pe_test_reference
[10:44:21] ================= [PASSED] property-entry ==================
[10:44:21] ============================================================
[10:44:21] Testing complete. Ran 208 tests: passed: 201, skipped: 7
[10:44:21] Elapsed time: 52.940s total, 0.001s configuring, 52.223s
building, 0.696s running

sergio@laptop:~/repos/rust-for-linux$ date
dom 15 ene 2023 10:44:26 CET
sergio@laptop:~/repos/rust-for-linux$ grep CONFIG_RUST .kunit/.config
CONFIG_RUST_IS_AVAILABLE=y
CONFIG_RUST=y
CONFIG_RUSTC_VERSION_TEXT="rustc 1.62.0 (a8314ef7d 2022-06-27)"
# CONFIG_RUST_DEBUG_ASSERTIONS is not set
CONFIG_RUST_OVERFLOW_CHECKS=y

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML
  2022-12-17  4:44 ` [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML David Gow
@ 2023-01-15 10:30   ` Thomas Meyer
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Meyer @ 2023-01-15 10:30 UTC (permalink / raw)
  To: linux-um, David Gow, Miguel Ojeda, Björn Roy Baron,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Thomas Gleixner,
	Ingo Molnar, Nathan Chancellor, Nick Desaulniers
  Cc: rust-for-linux, llvm, linux-doc, kunit-dev, x86, linux-kernel,
	Wedson Almeida Filho, Gary Guo, Brendan Higgins, Daniel Latypov,
	Jonathan Corbet

Hi,


Am 17. Dezember 2022 05:44:34 MEZ schrieb David Gow <davidgow@google.com>:
>UML expects a position independent executable for some reason, 

I think I did add this to make UML build on Debian...

> so tell
>rustc to generate pie objects. Otherwise we get a bunch of relocations
>we can't deal with in libcore.
>
>Signed-off-by: David Gow <davidgow@google.com>
>---
> arch/um/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/arch/um/Makefile b/arch/um/Makefile
>index f1d4d67157be..ae321282dc6f 100644
>--- a/arch/um/Makefile
>+++ b/arch/um/Makefile
>@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
> 	-Din6addr_loopback=kernel_in6addr_loopback \
> 	-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
> 
>+KBUILD_RUSTFLAGS += -Crelocation-model=pie
>+
> KBUILD_AFLAGS += $(ARCH_INCLUDE)
> 
> USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
  2022-12-17  4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
  2023-01-15  9:49   ` Sergio González Collado
  2023-01-15  9:51   ` Sergio González Collado
@ 2023-01-15 21:42   ` Miguel Ojeda
  2 siblings, 0 replies; 10+ messages in thread
From: Miguel Ojeda @ 2023-01-15 21:42 UTC (permalink / raw)
  To: David Gow
  Cc: Miguel Ojeda, Björn Roy Baron, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Thomas Gleixner, Ingo Molnar,
	Nathan Chancellor, Nick Desaulniers, rust-for-linux, linux-um,
	llvm, linux-doc, kunit-dev, x86, linux-kernel,
	Wedson Almeida Filho, Gary Guo, Brendan Higgins, Daniel Latypov,
	Jonathan Corbet

On Sat, Dec 17, 2022 at 5:45 AM David Gow <davidgow@google.com> wrote:
>
> diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
> index 6982b63775da..a526ca1c688b 100644
> --- a/Documentation/rust/arch-support.rst
> +++ b/Documentation/rust/arch-support.rst
> @@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
>  ============  ================  ==============================================
>  ``x86``       Maintained        ``x86_64`` only.
>  ============  ================  ==============================================
> +``um``        Maintained        ``x86_64`` only.
> +============  ================  ==============================================

Nit: if there is a v2 for another reason, this could be swapped to
keep the list sorted.

Cheers,
Miguel

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-15 21:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17  4:44 [PATCH 0/3] rust: arch/um: Rust support for UML David Gow
2022-12-17  4:44 ` [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML David Gow
2023-01-15 10:30   ` Thomas Meyer
2022-12-17  4:44 ` [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86 David Gow
2023-01-15  9:47   ` Sergio González Collado
2022-12-17  4:44 ` [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML David Gow
2023-01-15  9:49   ` Sergio González Collado
2023-01-15  9:51   ` Sergio González Collado
2023-01-15 21:42   ` Miguel Ojeda
2022-12-17 11:59 ` [PATCH 0/3] rust: arch/um: Rust support for UML Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).