elf: add functions to read the section table and section table entry names

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
elf: populate segments if ".note.osv-mlock" section is present

This allows shared objects that disable preemption to work correctly,
since faulting in executable pages with preemption disabled is not supported.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
elf: fix bad indents

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
rcu: destroy callback after executing it

The callback's destructor may refer to dynamically linked sections; destroy
it after executing it to prevent the destructor firing in the next pass and
referencing deallocated memory.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
rcu: add rcu_flush()

Add a callback to force all currently queued callbacks to execute.

This is useful for global state changes, such as removing a loaded module,
and for unit tests.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
elf: flush all rcu callbacks before unloading a module

An rcu callback may refer to the text or data section of a loaded module;
prevent access to unmapped memory by forcing all rcu callbacks to complete
before removing the module.

Fixes #231.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
rcu: introduce an rcu list type

This is a singly-linked list, suitable for building an rcu hash table.

Only a minimal interface is implemented so far.  The list itself exposes
two list-like interfaces, one for a mutating owner, the other for read-only
rcu access.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: add rcu list test

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Merge branch 'rcu-list'

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