shm: access iterator before invalidating it

Debug allocator was keen to point out that unordered_map<>::erase()
invalideates the iterator thus it erase, read operation pair should be
done in reverse order.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: fix freeing huge pages in shm_file::_pages

shm_file::_pages contains only huge pages allocated in shm_file::page(),
so they should be freed by calling memory::free_huge_page(), not
memory::free_page().

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
elf: make sure section '.note.osv-mlock' actually exists

LD is too serious linker to be fooled into creating an empty section.
A single .long 0 would be enough but .long 0, 0, 0 is actually a valid
entry in any notes section and readelf -n has no reason to complain
when reading a file containing it.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: add OSV_ELF_MLOCK_OBJECT() to tests that need it

"tests that need it" = all tests which at least partially are executed
with preemption disabled. That includes but is not limited to using:
preempt_lock, rcu_read_lock or sched::thread::wait_until().

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc/multibyte: Migrate to upstream musl

Migrate all identical files under libc/multibyte to upstream musl.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc/process: Migrate to upstream musl

Migrate all identical files under libc/process to upstream musl.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc/unistd: Migrate to upstream musl

Migrate all identical files under libc/unistd to upstream musl.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>