KASAN for AArch64, saving and restoring uio state, further kgprof improvements

Published: Mon 29 March 2021

KASAN: Implementation for AArch64 #1047 (PJ)

We already have kernel address sanitizer (KASAN) in Mimiker under MIPS Malta platform (PR #1040). This PR adds AArch 64 Raspberry Pi support. Great!

Timeout tests based on CPU time, not wall clock time #1021 (JPiec)

As a result of bugged kernel, parts of runtime environment may hang while executing our test suite. Thus we need to perform a clean up after a specified timeout. Upto now wall time has been used, what resulted in spurious timeouts. The correct approach is to measure time CPU actually spent on executing test suite. This is the purpose of the current PR. Previously our launch script used a standard TIMEOUT pattern of Python application driver pexpect spawn/expect function to detect timeouts when running test suite under qemu/gdb. When that happened, the script simply sent SIGINT to the debugger. The approach taken by PR#1021 is different. The launch script uses Linux capability subsystem to set cpu limit (via setrlimit syscall) for qemu, which receives SIGXCPU (SIGKILL) signal upon reaching soft (resp hard) CPU limit. Then, qemu tries to gently exit by catching SIGXCPU (a patch was prepared to implement the signal handler). If that fails, the simulator is simply killed upon receiving SIGKILL.

Implement saving & restoring uio state #1053 (JPiec)

When implementing Vectored I/O it is convenient to use data structure representing ongoing transmission of I/O data between various buffers in user and kernel spaces. This is the purpose of uio_t structure, which is operated on by uiomove function (see also man uiomove). The idea is common to most Unix-like systems, however, standard implementations are incapable of saving and restoring the transmission state (the need for such functionality has recently arisen when implementing pseudoterminals). JPiec has prepared three solutions to the problem:

  • make it possible to roll back effects of uiomove function (#998). This PR introduces uio_rollback function that and expands uio_t with 2 additional fields. Unfortunately, uio_rollback is not O(1).

  • introduce uio_peek and uio_advance (#1052). This solution is based on the fact that uiomove has two responsibilities: to perform data transfer and to update uio_t structure. These two responsibilities are separated into resp. uio_peek and uio_advance. In this way, we may try uio_peek and, if it succeeds, commit the transfer with uio_advance. If it fails, we may redo uio_peek later.

  • implement saving & restoring uio state (#1053). This PR introduces uio_save function that simply saves current state of transfer in a separate structure of type uiostate_t (a subset of uio_t fields), and uio_restore that may restore the transfer state if uiomove fails.

The last solution turned to be the simplest and the most efficient, so it was merged with the kernel.

Statclock and gprof structures initialization #979 (WP)

Further work on kgmon and kgprof.

Set window size on startup #1055 (JPiec)

Since Mimiker is mostly run on QEMU, its user interaction happens via shell console in pseudoterminal on the host OS. It is convenient to occasionally resize pseudoterminal window, but Mimiker won’t be automagically informed of such an event. A tiny program setwinsize was prepared that sets console size to pseudoterminal window size. It bases on the fact that moving cursor to an extremely distant coordinate (like 1000x1000) actually moves it to the bottom right of the window. To interact with console the program uses terminfo library ported recently from NetBSD.

Construct commandline during exec #1043 (FZ)

Upto now, process command line arguments were stored only in process address space. The PR makes process structure proc_t hold these arguments, so to simplify implementation of e.g ps tool.

signal(): restart interrupted system calls by default #1046 (JPiec)

Port of siginterrupt syscall.

Other/Housekeeping

Refine the build system. #1049 (MB)

Review, refinement and documentation of Mimiker’s build system.

Make Mimiker compile under GCC11 #999 (JU)

Bump gcc version to 11 #1050 (JU)

A couple of small changes needed to keep our infrastructure upto date.

Remove rwlock. #1058 (PJ)

Readers-writer locks were once needed in virtual memory implementation, but were replaced by mutexes. Since they are no longer used, they were removed.

Add the AMD64 QEMU target. #1059 (MB)

Extend the toolchain of the AMD64 release. #1054 (MB)

An approach to porting Mimiker to x86-64 architecture.

Remove redundant check in session_enter() #1045 (JPiec)

thread: increase stack size for 64 bit architectures #1064 (PJ)

vm_boot_alloc(): don’t let vm_kernel_end go past _kasan_sanitized_end #1056 (JPiec)