Re: [PATCH 0/2] um: Convert to platform remove callback returning void

2024-04-29 Thread Uwe Kleine-König
Hello Richard, On Sun, Mar 10, 2024 at 08:52:26AM +0100, Uwe Kleine-König wrote: > this series converts all platform drivers below arch/um to stop using > struct platform_driver::remove(). See commit 5c5a7680e67b ("platform: > Provide a remove callback that returns no value") for an extended > exp

[PATCH v2 03/12] um: Add generic stub_syscall6 function

2024-04-29 Thread benjamin
From: Benjamin Berg This function will be used by the new syscall handling code. Signed-off-by: Benjamin Berg --- arch/x86/um/shared/sysdep/stub_32.h | 22 ++ arch/x86/um/shared/sysdep/stub_64.h | 16 2 files changed, 38 insertions(+) diff --git a/arch/x86

[PATCH v2 01/12] um: Remove stub-data.h include from common-offsets.h

2024-04-29 Thread benjamin
From: Benjamin Berg Further commits will require values from common-offsets.h inside stub-data.h. Resolve the possible circular dependency and simply use offsetof() inside stub_32.h and stub_64.h. Signed-off-by: Benjamin Berg --- arch/um/include/shared/common-offsets.h | 5 - arch/x86/um/s

[PATCH v2 00/12] Rework stub syscall and page table handling

2024-04-29 Thread benjamin
From: Benjamin Berg This patchset reworks the stub syscall handling and also redos how page table updates are tracked and synchronized. Some of this originated in the SECCOMP patchset, but it became clear that these refactorings make sense independently as they result in a considerably fewer page

[PATCH v2 05/12] um: compress memory related stub syscalls while adding them

2024-04-29 Thread benjamin
From: Benjamin Berg To keep the number of syscalls that the stub has to do lower, compress two consecutive syscalls of the same type if the second is just a continuation of the first. Signed-off-by: Benjamin Berg --- arch/um/os-Linux/skas/mem.c | 39 + 1 fil

[PATCH v2 06/12] um: remove LDT support

2024-04-29 Thread benjamin
From: Benjamin Berg The current LDT code has a few issues that mean it should be redone in a different way once we always start with a fresh MM even when cloning. In a new and better world, the kernel would just ensure its own LDT is clear at startup. At that point, all that is needed is a simpl

[PATCH v2 02/12] um: Create signal stack memory assignment in stub_data

2024-04-29 Thread benjamin
From: Benjamin Berg When we switch to use seccomp, we need both the signal stack and other data (i.e. syscall information) to co-exist in the stub data. To facilitate this, start by defining separate memory areas for the stack and syscall data. This moves the signal stack onto a new page as the

[PATCH v2 04/12] um: Rework syscall handling

2024-04-29 Thread benjamin
From: Benjamin Berg Rework syscall handling to be platform independent. Also create a clean split between queueing of syscalls and flushing them out, removing the need to keep state in the code that triggers the syscalls. The code adds syscall_data_len to the global mm_id structure. This will be

[PATCH v2 07/12] um: remove copy_context_skas0

2024-04-29 Thread benjamin
From: Benjamin Berg The kernel flushes the memory ranges anyway for CoW and does not assume that the userspace process has anything set up already. So, start with a fresh process for the new mm context. Signed-off-by: Benjamin Berg --- arch/um/include/shared/os.h | 1 - arch/um/kernel/sk

[PATCH v2 10/12] um: remove force_flush_all from fork_handler

2024-04-29 Thread benjamin
From: Benjamin Berg There should be no need for this. It may be that this used to work around another issue where after a clone the MM was in a bad state. Signed-off-by: Benjamin Berg --- arch/um/include/asm/mmu_context.h | 2 -- arch/um/kernel/process.c | 2 -- arch/um/kernel/tlb.c

[PATCH v2 08/12] um: Delay flushing syscalls until the thread is restarted

2024-04-29 Thread benjamin
From: Benjamin Berg As running the syscalls is expensive due to context switches, we should do so as late as possible in case more syscalls need to be queued later on. This will also benefit a later move to a SECCOMP enabled userspace as in that case the need of extra context switches is removed

[PATCH v2 11/12] um: simplify and consolidate TLB updates

2024-04-29 Thread benjamin
From: Benjamin Berg The HVC update was mostly used to compress consecutive calls into one. This is mostly relevant for userspace where it is already handled by the syscall stub code. Simplify the whole logic and consolidate it for both kernel and userspace. This does remove the sequential syscal

[PATCH v2 09/12] um: Do not flush MM in flush_thread

2024-04-29 Thread benjamin
From: Benjamin Berg There should be no need to flush the memory in flush_thread. Doing this likely worked around some issue where memory was still incorrectly mapped when creating or cloning an MM. With the removal of the special clone path, that isn't relevant anymore. However, add the flush in

[PATCH v2 12/12] um: refactor TLB update handling

2024-04-29 Thread benjamin
From: Benjamin Berg Conceptually, we want the memory mappings to always be up to date and represent whatever is in the TLB. To ensure that, we need to sync them over in the userspace case and for the kernel we need to process the mappings. The kernel will call flush_tlb_* if page table entries t