get_user() and put_user() of an aligned 1, 2, 4 or 8 bytes are now one
load or store through kw_user_addr() instead of a memcpy (memory.copy,
which the Wasm spec does not make single-copy atomic on a shared
memory), so a futex word read beside another CPU's stores cannot tear;
an unaligned access still goes through raw_copy_*_user().
kwfb's set_par checks the mappings, allocates and switches the buffer
under info->mm_lock, which fbdev's mmap holds (check_var reads the count
under it too): an mmap racing FBIOPUT_VSCREENINFO from another thread
could map the old buffer.
kwtest checks both (uaccess: FUTEX_WAIT and getcpu beside another CPU's
stores, fault-in, EFAULT and a put_user across a page; kwfb: 200 mmaps
beside a thread changing the mode), and `kwtest smp` runs the kwfb
checks. Ported from VOD-Studio/unkernel@25e90b3f.
Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: xfy <i@rua.plus>
Fold the 56 kernel patches into 32: one arch patch (which now includes
the riscv ISA patch, parking, atomics, SMP, blocking waits, unfair
spinlocks, the arm64 user ABI, pc sampling, ptrace, single-step and core
dumps), each driver with its SMP part, the generic changes one per piece
(the cond_resched() poll split out of the arch patch), and kw_defconfig
last. The messages describe the code as it is; every patch that was
kernel-wasm@localhost's is Pooya Parsa's. The tree is unchanged.
kernel/build.sh patches (kernel/tools/export-patches.sh) exports the
series without what changed in every later patch on each edit: no
numbers in the file names (the order is the new series file, which
build.sh applies), a zero commit hash, no git version signature and no
index lines, with the diff options fixed.