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

2024-05-24 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

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

2024-05-24 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 v3 11/12] um: simplify and consolidate TLB updates

2024-05-24 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 v3 07/12] um: remove copy_context_skas0

2024-05-24 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 --- v3: Remove further unused code --- arch/um/include/share

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

2024-05-24 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 v3 09/12] um: Do not flush MM in flush_thread

2024-05-24 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 v3 08/12] um: Delay flushing syscalls until the thread is restarted

2024-05-24 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 v3 04/12] um: Rework syscall handling

2024-05-24 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 v3 03/12] um: Add generic stub_syscall6 function

2024-05-24 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 v3 05/12] um: compress memory related stub syscalls while adding them

2024-05-24 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 v3 01/12] um: Remove stub-data.h include from common-offsets.h

2024-05-24 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 v3 00/12] Rework stub syscall and page table handling

2024-05-24 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 v3 02/12] um: Create signal stack memory assignment in stub_data

2024-05-24 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

[GIT PULL] UML changes for v6.10-rc1

2024-05-24 Thread Richard Weinberger
Linus, The following changes since commit ed30a4a51bb196781c8058073ea720133a65596f: Linux 6.9-rc5 (2024-04-21 12:35:54 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux.git tags/uml-for-linus-6.10-rc1 for you to fetch changes up to 919e