Re: [PATCH 1/2] rust: pass correct target to bindgen on Usermode Linux

2025-03-18 Thread David Gow
On Sat, 8 Feb 2025 at 21:32, Thomas Weißschuh wrote: > > Usermode Linux uses "um" as primary architecture name and the underlying > physical architecture is provided in "SUBARCH". > Resolve the target architecture flags through that underlying architecture. > This is the same pattern as used by sc

Re: [PATCH 1/2] rust: pass correct target to bindgen on Usermode Linux

2025-02-10 Thread David Gow
t a patch[1] to fix it. (Though note that 32-bit UML/Rust still hits issues with atomics in the block driver, so you'll need to disable that for now.) Regardless, this is a significant improvement, thanks! Reviewed-by: David Gow Thanks, -- David [1]: https://lore.kernel.org/rust-for-linu

[PATCH] arch: um: Pass the correct Rust target and options with gcc

2025-02-10 Thread David Gow
t x86. Move the target definition outside the conditional block, and update the condition to take into account the gcc version. Fixes: a3046a618a28 ("um: Only disable SSE on clang to work around old GCC bugs") Signed-off-by: David Gow --- When combined with Thomas' patch [1]

Re: [RFC PATCH v2 00/13] nommu UML

2024-11-22 Thread David Gow
On Mon, 11 Nov 2024 at 14:27, Hajime Tazaki wrote: > > This is a series of patches of nommu arch addition to UML. It would > be nice to ask comments/opinions on this. > > There are still several limitations/issues which we already found; > here is the list of those issues. > > - prompt configured

Re: [PATCH] um: make stub_exe _start() pure inline asm

2024-10-22 Thread David Gow
om/ > Signed-off-by: Johannes Berg > --- Thanks very much: this is much nicer, and works on all of the differently problematic compilers I've tried. The explanation of the stack space calculation is useful, too. Reviewed-by: David Gow Cheers, -- David > arch/um/kernel/skas/stub_

[PATCH v2] um: Fix misaligned stack in stub_exe

2024-10-22 Thread David Gow
isn't necessarily the _correct_ way of solving the problem, but it avoids the need to rewrite __start in assembly for each architecture for now. Fixes: 32e8eaf263d9 ("um: use execveat to create userspace MMs") Signed-off-by: David Gow --- Changes since v1: https://lore

Re: [PATCH] um: Fix misaligned stack in stub_exe

2024-10-18 Thread David Gow
On Fri, 18 Oct 2024 at 07:10, David Gow wrote: > > The stub_exe could segfault when built with some compilers (e.g. gcc > 13.2.0), as SSE instructions which relied on stack alignment could be > generated, but the stack was misaligned. > > This seems to be due to the __start ent

Re: [PATCH v9 02/10] um: use execveat to create userspace MMs

2024-10-17 Thread David Gow
On Thu, 17 Oct 2024 at 20:05, Benjamin Berg wrote: > > Hi, > > On Thu, 2024-10-17 at 10:18 +0200, Johannes Berg wrote: > > [SNIP] > > > > I wonder now if the SSE instructions generated are memset() and that > > goes away with the patches that Nathan just sent to not have the memset > > (which was

[PATCH] um: Fix misaligned stack in stub_exe

2024-10-17 Thread David Gow
ot;um: use execveat to create userspace MMs") Signed-off-by: David Gow --- See the discussion here: https://lore.kernel.org/linux-um/c7c5228e9de1e79dc88b304e28d25f5ffd7e36dd.ca...@sipsolutions.net/T/#m90c1c5b6c34ebaaa043b402e97009c5825fd158a --- arch/um/kernel/skas/stub_exe.c | 2 +- 1

Re: [PATCH v9 02/10] um: use execveat to create userspace MMs

2024-10-17 Thread David Gow
On Thu, 19 Sept 2024 at 20:45, Benjamin Berg wrote: > > From: Benjamin Berg > > Using clone will not undo features that have been enabled by libc. An > example of this already happening is rseq, which could cause the kernel > to read/write memory of the userspace process. In the future the > stan

[RFC PATCH] rust: block: Use 32-bit atomics

2024-09-04 Thread David Gow
a ("rust: block: introduce `kernel::block::mq` module") Signed-off-by: David Gow --- Hi all, I encountered this build error with Rust/UML since the kernel::block::mq stuff landed. I'm not 100% sure just swapping AtomicU64 with AtomicU32 is correct -- please correct me if not --

[PATCH] arch: um: rust: Add i386 support for Rust

2024-06-04 Thread David Gow
hub[2]. [1]: https://github.com/rust-lang/rust/issues/116972 [2]: https://github.com/Rust-for-Linux/linux/pull/966 Signed-off-by: David Gow --- Documentation/rust/arch-support.rst | 2 +- arch/um/Kconfig | 2 +- rust/Makefile | 2 +- scripts/Mak

[PATCH] arch: um: rust: Use the generated target.json again

2024-05-29 Thread David Gow
wing compile error: error: :0:0: in function _RNvMNtCs5QSdWC790r4_4core3f32f7next_up float (float): SSE register return with SSE disabled Fixes: f82811e22b48 ("rust: Refactor the build target to allow the use of builtin targets") Signed-off-by: David Gow --- arch/x86/Makefile.um | 1

Re: [PATCH v3 7/7] kunit: Add tests for fault

2024-04-23 Thread David Gow
On Mon, 22 Apr 2024 at 21:36, Guenter Roeck wrote: > > On 4/22/24 06:08, Mickaël Salaün wrote: > > On Fri, Apr 19, 2024 at 04:38:01PM -0700, Guenter Roeck wrote: > >> On Fri, Apr 19, 2024 at 03:33:49PM -0700, Guenter Roeck wrote: > >>> Hi, > >>> > >>> On Tue, Mar 19, 2024 at 11:48:57AM +0100, Mick

Re: [PATCH v3 4/7] kunit: Handle test faults

2024-03-23 Thread David Gow
ad of calling kthread_complete_and_exit(). Because thread's exit > code is never checked, always set it to 0 to make it clear. > > Fix the -EINTR error message, which couldn't be reached until now. > > This is tested with a following patch. > > Cc: Brendan Higgins > Cc: Sh

Re: [PATCH RESEND 1/1] um: oops on accessing a non-present page in the vmalloc area

2024-03-20 Thread David Gow
On Fri, 23 Feb 2024 at 22:07, Petr Tesarik wrote: > > From: Petr Tesarik > > If a segmentation fault is caused by accessing an address in the vmalloc > area, check that the target page is present. > > Currently, if the kernel hits a guard page in the vmalloc area, UML blindly > assumes that the f

Re: [PATCH v2 4/7] kunit: Handle test faults

2024-03-11 Thread David Gow
ad of calling kthread_complete_and_exit(). Because thread's exit > code is never checked, always set it to 0 to make it clear. > > Fix the -EINTR error message, which couldn't be reached until now. > > This is tested with a following patch. > > Cc: Brendan Higgins >

Re: [PATCH v2 7/7] kunit: Add tests for fault

2024-03-11 Thread David Gow
c. > > Tested with: > ./tools/testing/kunit/kunit.py run --arch x86_64 kunit_fault > ./tools/testing/kunit/kunit.py run --arch arm64 \ > --cross_compile=aarch64-linux-gnu- kunit_fault > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Signed-off-

Re: [PATCH v2 6/7] kunit: Print last test location on fault

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > This helps identify the location of test faults. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Reviewed-by: Kees Cook > Signed-off-by: Mickaël Salaün > Link: https://lore.kernel

Re: [PATCH v2 5/7] kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > Fix KUNIT_SUCCESS() calls to pass a test argument. > > This is a no-op for now because this macro does nothing, but it will be > required for the next commit. > > Cc: Brendan Higgins > Cc: David Gow > Cc:

Re: [PATCH v2 3/7] kunit: Fix timeout message

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > The exit code is always checked, so let's properly handle the -ETIMEDOUT > error code. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Reviewed-by: Kees Cook > Signed-of

Re: [PATCH v2 2/7] kunit: Fix kthread reference

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > There is a race condition when a kthread finishes after the deadline and > before the call to kthread_stop(), which may lead to use after free. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah K

Re: [PATCH v2 1/7] kunit: Handle thread creation error

2024-03-11 Thread David Gow
ode returned by kthread_run(), which will mark the test as failed and > print "internal error occurred...". > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Reviewed-by: Kees Cook > Signed-off-by: Mickaël Salaün > Link: https://lore.

Re: [PATCH v1 0/8] Run KUnit tests late and handle faults

2024-02-29 Thread David Gow
On Fri, 1 Mar 2024 at 01:04, Mickaël Salaün wrote: > > Hi, > Thanks very much. I think there's a lot going on in this series, and it'd probably be easier to address if it were broken up a bit more. To take things one at a time: > This patch series moves KUnit test execution at the very end of k

Re: [PATCH v1 1/8] kunit: Run tests when the kernel is fully setup

2024-02-29 Thread David Gow
al address 02016f88 ... Call trace: kfree+0x30/0x184 kunit_run_all_tests+0x88/0x154 kernel_init+0x6c/0x1e0 ret_from_fork+0x10/0x20 Code: b25f7be1 aa0003f4 d34cfe73 8b131833 (f9400661) ---[ end trace 00000000 ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x000

Re: [PATCH v3 7/7] of: Add KUnit test to confirm DTB is loaded

2024-02-02 Thread David Gow
On Sat, 3 Feb 2024 at 03:59, Stephen Boyd wrote: > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a > root node, and that the of_have_populated_dt() API works properly. > > Cc: Rob Herring > Cc: Frank Rowand > Cc: David Gow > Cc: Brendan Higgins

Re: [PATCH 6/6] of: Add KUnit test to confirm DTB is loaded

2024-01-23 Thread David Gow
On Tue, 23 Jan 2024 at 06:48, Stephen Boyd wrote: > > Quoting David Gow (2024-01-15 21:03:12) > > On Sat, 13 Jan 2024 at 04:07, Stephen Boyd wrote: > > > > > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a > > > root node, and th

Re: [PATCH 6/6] of: Add KUnit test to confirm DTB is loaded

2024-01-15 Thread David Gow
On Sat, 13 Jan 2024 at 04:07, Stephen Boyd wrote: > > Add a KUnit test that confirms a DTB has been loaded, i.e. there is a > root node, and that the of_have_populated_dt() API works properly. > > Cc: Rob Herring > Cc: Frank Rowand > Cc: David Gow > Cc: Brendan

Re: [PATCH 2/2] Documentation: kunit: Add clang UML coverage example

2023-10-25 Thread David Gow
too, I suppose.) There shouldn't be any merge conflicts on our side. Reviewed-by: David Gow Cheers, -- David > Documentation/dev-tools/kunit/running_tips.rst | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/dev-tools/kunit/running_tip

Re: [PATCH 1/2] arch: um: Add Clang coverage support

2023-10-25 Thread David Gow
n gcc 6! I assume this will go in via the UML tree, but if you want, we can take it via KUnit. Tested-by: David Gow Cheers, -- David > arch/um/Makefile-skas | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/arch/um/Makefile-skas b/arch/um/Makefile-skas > index ac35de53

[PATCH 2/2] arch: um: Use the x86 checksum implementation on 32-bit

2023-07-04 Thread David Gow
share the same implementation between UML and "normal" x86. Signed-off-by: David Gow --- Note that there is a further issue with the pre-pentium-pro codepath in the shared x86 code, which I'll send a separate fix out for. i686+ works fine with just this series. --- arch/x86/um/Makef

[PATCH 1/2] asm-generic: current: Don't include thread-info.h if building asm

2023-07-04 Thread David Gow
when either C code or non-asm-compatible preprocessor directives are included. Just wrap the contents behind an #ifndef __ASSEMBLY__ to avoid any C code making its way in. Signed-off-by: David Gow --- This is requrired for patch #2 here, as UML uses this asm-generic header, but works with x86

Re: [PATCH] x86: Fix build of UML with KASAN

2023-06-10 Thread David Gow
-off-by: Vincent Whitchurch > --- Thanks: I stumbled into this the other day and ran out of time to debug it. I've tested that it works here. Tested-by: David Gow Cheers, -- David > arch/x86/lib/memcpy_64.S | 4 > arch/x86/lib/memmove_64.S | 4 > arch/x8

Re: [PATCH] arch:um: Only disable SSE on clang to work around old GCC bugs

2023-03-31 Thread David Gow
On Sat, 18 Mar 2023 at 12:16, David Gow wrote: > > As part of the Rust support for UML, we disable SSE (and similar flags) > to match the normal x86 builds. This both makes sense (we ideally want a > similar configuration to x86), and works around a crash bug with SSE > generation

Re: Running KUnit using the wrapper script

2023-03-22 Thread David Gow
On Thu, 23 Mar 2023 at 09:08, Mark Brown wrote: > > I've been trying to do some stuff with KUnit but I can't seem to > find a current tree where KUnit builds. Running on Debian stable > starting from a clean -next tree and running: > >./tools/testing/kunit/kunit.py config >./tools/testing

[PATCH] arch:um: Only disable SSE on clang to work around old GCC bugs

2023-03-17 Thread David Gow
654a82acd607fdcbc93ad593c.ca...@huaweicloud.com/ Tested-by: Roberto Sassu Tested-by: SeongJae Park Signed-off-by: David Gow --- arch/x86/Makefile.um | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um index b70559b821df..2106a2bd152b 100644 --- a/arch/x8

Re: [PATCH 2/8] of: Enable DTB loading on UML for KUnit tests

2023-03-15 Thread David Gow
On Thu, 16 Mar 2023 at 08:45, Frank Rowand wrote: > > On 3/15/23 16:35, Frank Rowand wrote: > > On 3/15/23 02:04, David Gow wrote: > >> On Tue, 14 Mar 2023 at 12:28, Frank Rowand wrote: > >>> > >>> On 3/13/23 11:02, Frank Rowand wrote: > >>&g

Re: [PATCH 2/8] of: Enable DTB loading on UML for KUnit tests

2023-03-15 Thread David Gow
On Tue, 14 Mar 2023 at 12:28, Frank Rowand wrote: > > On 3/13/23 11:02, Frank Rowand wrote: > > On 3/11/23 00:42, David Gow wrote: > >> On Sat, 11 Mar 2023 at 07:34, Stephen Boyd wrote: > >>> > >>> Quoting David Gow (2023-03-10 00:09:48) > >&g

Re: [PATCH 2/8] of: Enable DTB loading on UML for KUnit tests

2023-03-10 Thread David Gow
On Sat, 11 Mar 2023 at 07:34, Stephen Boyd wrote: > > Quoting David Gow (2023-03-10 00:09:48) > > On Fri, 10 Mar 2023 at 07:19, Stephen Boyd wrote: > > > > > > > > > Hmm. I think you're suggesting that the unit test data be loaded > > > wh

Re: [PATCH 4/8] clk: Add test managed clk provider/consumer APIs

2023-03-10 Thread David Gow
On Sat, 11 Mar 2023 at 07:21, Stephen Boyd wrote: > > Quoting David Gow (2023-03-02 23:15:35) > > On Thu, 2 Mar 2023 at 09:38, Stephen Boyd wrote: > > > > > > Unit tests are more ergonomic and simpler to understand if they don't > > > have to hoist a

Re: [PATCH 3/8] kunit: Add test managed platform_device/driver APIs

2023-03-10 Thread David Gow
On Fri, 10 Mar 2023 at 07:25, Stephen Boyd wrote: > > Quoting David Gow (2023-03-02 23:15:31) > > On Thu, 2 Mar 2023 at 09:38, Stephen Boyd wrote: > > > > > > Introduce KUnit resource wrappers around platform_driver_register(), > > > platform_device_all

Re: [PATCH 2/8] of: Enable DTB loading on UML for KUnit tests

2023-03-10 Thread David Gow
On Fri, 10 Mar 2023 at 07:19, Stephen Boyd wrote: > > Quoting David Gow (2023-03-02 23:15:04) > > On Thu, 2 Mar 2023 at 09:38, Stephen Boyd wrote: > > > > > > To fully exercise common clk framework code in KUnit we need to > > > associate 'stru

Re: [PATCH 1/8] dt-bindings: Add linux,kunit binding

2023-03-09 Thread David Gow
On Fri, 10 Mar 2023 at 07:12, Stephen Boyd wrote: > > Quoting David Gow (2023-03-02 23:14:55) > > On Thu, 2 Mar 2023 at 09:38, Stephen Boyd wrote: > > > > > > Document the linux,kunit board compatible string. This board is loaded > > > into the Linux

Re: [PATCH 0/8] clk: Add kunit tests for fixed rate and parent data

2023-03-09 Thread David Gow
On Sat, 4 Mar 2023 at 23:50, Frank Rowand wrote: > > On 3/1/23 19:38, Stephen Boyd wrote: > > This patch series adds unit tests for the clk fixed rate basic type and > > the clk registration functions that use struct clk_parent_data. To get > > there, we add support for loading a DTB into the UML

Re: Cannot compile UML in Ubuntu 20.04.5 anymore

2023-03-03 Thread David Gow
On Fri, 3 Mar 2023 at 16:37, Roberto Sassu wrote: > > Hi > > it looks like one recent commit causes the kernel build to break. > > GEN scripts/gdb/linux/constants.py > In file included from /usr/include/stdlib.h:1013, > from arch/um/os-Linux/helper.c:6: > /usr/include/x86_64

Re: [PATCH 4/8] clk: Add test managed clk provider/consumer APIs

2023-03-02 Thread David Gow
can write more code in the actual test and less code in the > harness. > > Only add APIs that are used for now. More wrappers can be added in the > future as necessary. > > Cc: Brendan Higgins > Cc: David Gow > Signed-off-by: Stephen Boyd > --- Looks good, modu

Re: [PATCH 3/8] kunit: Add test managed platform_device/driver APIs

2023-03-02 Thread David Gow
s automatically be unregistered when the test is done. > > This makes test setup code simpler when a platform driver or platform > device is needed. Add a few test cases at the same time to make sure the > APIs work as intended. > > Cc: Brendan Higgins > Cc: David Gow >

Re: [PATCH 2/8] of: Enable DTB loading on UML for KUnit tests

2023-03-02 Thread David Gow
On Thu, 2 Mar 2023 at 09:38, Stephen Boyd wrote: > > To fully exercise common clk framework code in KUnit we need to > associate 'struct device' pointers with 'struct device_node' pointers so > that things like clk_get() can parse DT nodes for 'clocks' and so that > clk providers can use DT to pro

Re: [PATCH 1/8] dt-bindings: Add linux,kunit binding

2023-03-02 Thread David Gow
inux,kunit", "linux-kunit,uml", "linux,kunit-uml", etc? > > Cc: Rob Herring > Cc: Krzysztof Kozlowski > Cc: Brendan Higgins > Cc: David Gow > Signed-off-by: Stephen Boyd > --- > .../bindings/kunit/linux,kunit.yaml | 24 +

Re: [PATCH 0/8] clk: Add kunit tests for fixed rate and parent data

2023-03-02 Thread David Gow
On Thu, 2 Mar 2023 at 09:38, Stephen Boyd wrote: > > This patch series adds unit tests for the clk fixed rate basic type and > the clk registration functions that use struct clk_parent_data. To get > there, we add support for loading a DTB into the UML kernel that's > running the unit tests along

Re: [PATCH] rust: sort uml documentation arch support table

2023-02-26 Thread David Gow
; https://lore.kernel.org/rust-for-linux/caniq72nxmsnusjnzog-qzicvoqa9drusmc4ras3exlznj7v...@mail.gmail.com > Reported-by: Miguel Ojeda > Signed-off-by: Thomas Bamelis > --- Thanks very much for fixing my mistake! This is Reviewed-by: David Gow Cheers, -- David > Documentati

Re: [PATCH 4/4] um: Use CFLAGS_vmlinux

2023-01-12 Thread David Gow
ure version of > the linker > /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: > warning: vmlinux has a LOAD segment with RWX permissions > --- Thanks very much for fixing this -- the LDFLAGS/CFLAGS fun here always trips me up! Reviewed-by: David Gow Cheers, -

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

2022-12-16 Thread David Gow
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 --- Documentation/rust/arch-support.rst | 2 ++ arch/um/Kconfig

[PATCH 0/3] rust: arch/um: Rust support for UML

2022-12-16 Thread David Gow
x27;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 suppor

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

2022-12-16 Thread David Gow
/github.com/Rust-for-Linux/linux/pull/881 Signed-off-by: David Gow --- 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,

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

2022-12-16 Thread David Gow
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 --- arch/um/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/um/Makef

Re: [PATCH v2] arch: um: Mark the stack non-executable to fix a binutils warning

2022-09-21 Thread David Gow
On Thu, Sep 22, 2022 at 1:47 AM 'Nick Desaulniers' via KUnit Development wrote: > > On Tue, Sep 20, 2022 at 11:49 PM David Gow wrote: > > > > Since binutils 2.39, ld will print a warning if any stack section is > > executable, which is the default for

[PATCH v2] arch: um: Mark the stack non-executable to fix a binutils warning

2022-09-20 Thread David Gow
a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 Signed-off-by: David Gow Reviewed-by: Lukas Straub Tested-by: Lukas Straub Acked-by: Randy Dunlap # build-tested --- Note that this still doesn't seem to be working properly with make LLVM=1. It doesn't appear to break anything, and still is an improveme