| 0b8b2668 | 10-Oct-2024 |
Benjamin Berg <[email protected]> |
um: insert scheduler ticks when userspace does not yield
In time-travel mode userspace can do a lot of work without any time passing. Unfortunately, this can result in OOM situations as the RCU core
um: insert scheduler ticks when userspace does not yield
In time-travel mode userspace can do a lot of work without any time passing. Unfortunately, this can result in OOM situations as the RCU core code will never be run.
Work around this by keeping track of userspace processes that do not yield for a lot of operations. When this happens, insert a jiffie into the sched_clock clock to account time against the process and cause the bookkeeping to run.
As sched_clock is used for tracing, it is useful to keep it in sync between the different VMs. As such, try to remove added ticks again when the actual clock ticks.
Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
show more ...
|
| 32e8eaf2 | 19-Sep-2024 |
Benjamin Berg <[email protected]> |
um: use execveat to create userspace MMs
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 m
um: use execveat to create userspace MMs
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 standard library might also use mseal by default to protect itself, which would also thwart our attempts at unmapping everything.
Solve all this by taking a step back and doing an execve into a tiny static binary that sets up the minimal environment required for the stub without using any standard library. That way we have a clean execution environment that is fully under the control of UML.
Note that this changes things a bit as the FDs are not anymore shared with the kernel. Instead, we explicitly share the FDs for the physical memory and all existing iomem regions. Doing this is fine, as iomem regions cannot be added at runtime.
Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] [use pipe() instead of pipe2(), remove unneeded close() calls] Signed-off-by: Johannes Berg <[email protected]>
show more ...
|
| bcf3d957 | 03-Jul-2024 |
Benjamin Berg <[email protected]> |
um: refactor TLB update handling
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 ca
um: refactor TLB update handling
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 that were valid before become invalid. Unfortunately, this is not the case if entries are added.
As such, change both flush_tlb_* and set_ptes to track the memory range that has to be synchronized. For the kernel, we need to execute a flush_tlb_kern_* immediately but we can wait for the first page fault in case of set_ptes. For userspace in contrast we only store that a range of memory needs to be synced and do so whenever we switch to that process.
Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
show more ...
|
| 3c83170d | 03-Jul-2024 |
Benjamin Berg <[email protected]> |
um: Delay flushing syscalls until the thread is restarted
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 la
um: Delay flushing syscalls until the thread is restarted
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 for extra context switches is removed entirely.
Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
show more ...
|
| 6d8992e4 | 03-Jul-2024 |
Benjamin Berg <[email protected]> |
um: compress memory related stub syscalls while adding them
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 c
um: compress memory related stub syscalls while adding them
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
show more ...
|
| 57135337 | 10-Nov-2023 |
Benjamin Berg <[email protected]> |
um: Drop NULL check from start_userspace
start_userspace is only called from exactly one location, and the passed pointer for the userspace process stack cannot be NULL.
Remove the check, without c
um: Drop NULL check from start_userspace
start_userspace is only called from exactly one location, and the passed pointer for the userspace process stack cannot be NULL.
Remove the check, without changing the control flow.
Signed-off-by: Benjamin Berg <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
show more ...
|
| 8970d5c9 | 14-Jul-2022 |
Guenter Roeck <[email protected]> |
um: Replace to_phys() and to_virt() with less generic function names
to_virt() and to_phys() are very generic and may be defined by drivers. As it turns out, commit 9409c9b6709e ("pmem: refactor pme
um: Replace to_phys() and to_virt() with less generic function names
to_virt() and to_phys() are very generic and may be defined by drivers. As it turns out, commit 9409c9b6709e ("pmem: refactor pmem_clear_poison()") did exactly that. This results in build errors such as the following when trying to build um:allmodconfig.
drivers/nvdimm/pmem.c: In function ‘pmem_dax_zero_page_range’: ./arch/um/include/asm/page.h:105:20: error: too few arguments to function ‘to_phys’ 105 | #define __pa(virt) to_phys((void *) (unsigned long) (virt)) | ^~~~~~~
Use less generic function names for the um specific to_phys() and to_virt() functions to fix the problem and to avoid similar problems in the future.
Fixes: 9409c9b6709e ("pmem: refactor pmem_clear_poison()") Cc: Dan Williams <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Acked-By: Anton Ivanov <[email protected]> Acked-by: Dan Williams <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
show more ...
|