Skip to contentSkip to conversation

rust: arch/um: Rust support for UML

PATCH In review David Gow 4 participants 10 messages Dec 17, 2022 – Jan 15, 2023

Subsystems (4)
lore
Share & tools
lore

David Gow

author
#0 lore raw

cover rust: arch/um: Rust support for UML

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(+)
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
author
#1 lore raw

PATCH 1/3 rust: arch/um: Use 'pie' relocation mode under UML

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.

---
 arch/um/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/um/Makefile +2 -0
index f1d4d67157be..ae321282dc6f 100644
@@ -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))) \
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
author
#3 lore raw

PATCH 2/3 rust: arch/um: Disable FP/SIMD instruction to match x86

In reply to David Gow

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

---
 arch/x86/Makefile.um | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/Makefile.um +6 -0
index b3c1ae084180..d2e95d1d4db7 100644
@@ -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
 
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
author
#5 lore raw

PATCH 3/3 rust: arch/um: Add support for CONFIG_RUST under x86_64 UML

In reply to David Gow

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.

---
 Documentation/rust/arch-support.rst | 2 ++
 arch/um/Kconfig                     | 1 +
 2 files changed, 3 insertions(+)
Documentation/rust/arch-support.rst +2 -0
index 6982b63775da..a526ca1c688b 100644
@@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
 ============  ================  ==============================================
 ``x86``       Maintained        ``x86_64`` only.
 ============  ================  ==============================================
+``um``        Maintained        ``x86_64`` only.
+============  ================  ==============================================
arch/um/Kconfig +1 -0
index ad4ff3b0e91e..4db186f019ae 100644
@@ -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
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#9 lore raw
In reply to David Gow
Quoted 3 lines · David Gow

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!).

Quoted 6 lines

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.

Quoted 2 lines

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

Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] rust: arch/um: Disable FP/SIMD instruction to match x86

In reply to David Gow
Quoted 37 lines · David Gow

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

---
 arch/x86/Makefile.um | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/Makefile.um +6 -1
index b3c1ae084180..d2e95d1d4db7 100644
@@ -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
 
--
Quoted 2 lines

2.39.0.314.g84b9a713c41-goog

Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML

In reply to David Gow
Quoted 42 lines · David Gow

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.

---
 Documentation/rust/arch-support.rst | 2 ++
 arch/um/Kconfig                     | 1 +
 2 files changed, 3 insertions(+)
Documentation/rust/arch-support.rst +2 -0
index 6982b63775da..a526ca1c688b 100644
@@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
 ============  ================  ==============================================
 ``x86``       Maintained        ``x86_64`` only.
 ============  ================  ==============================================
+``um``        Maintained        ``x86_64`` only.
+============  ================  ==============================================
arch/um/Kconfig +1 -1
index ad4ff3b0e91e..4db186f019ae 100644
@@ -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
--
Quoted 2 lines

2.39.0.314.g84b9a713c41-goog

Tested-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML

In reply to David Gow
Quoted 42 lines · David Gow

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.

---
 Documentation/rust/arch-support.rst | 2 ++
 arch/um/Kconfig                     | 1 +
 2 files changed, 3 insertions(+)
Documentation/rust/arch-support.rst +2 -0
index 6982b63775da..a526ca1c688b 100644
@@ -17,3 +17,5 @@ Architecture  Level of support  Constraints
 ============  ================  ==============================================
 ``x86``       Maintained        ``x86_64`` only.
 ============  ================  ==============================================
+``um``        Maintained        ``x86_64`` only.
+============  ================  ==============================================
arch/um/Kconfig +1 -1
index ad4ff3b0e91e..4db186f019ae 100644
@@ -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
--
Quoted 2 lines

2.39.0.314.g84b9a713c41-goog

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
#2 lore raw

Re: [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML

In reply to David Gow

Hi,

Am 17. Dezember 2022 05:44:34 MEZ schrieb David Gow <[email protected]>:

Quoted 1 line

UML expects a position independent executable for some reason,

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

Quoted 22 lines

so tell
rustc to generate pie objects. Otherwise we get a bunch of relocations we can't deal with in libcore.

---
arch/um/Makefile | 2 ++

1 file changed, 2 insertions(+)
arch/um/Makefile +2 -0
index f1d4d67157be..ae321282dc6f 100644
@@ -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))) \
Signature · 6 lines
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
#8 lore raw

Re: [PATCH 3/3] rust: arch/um: Add support for CONFIG_RUST under x86_64 UML

In reply to David Gow

Documentation/rust/arch-support.rst Architecture Level of support Constraints · line 21

Quoted 11 lines · David Gow
Documentation/rust/arch-support.rst +2 -0
index 6982b63775da..a526ca1c688b 100644
@@ -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