diff options
author | Jamie Liu <jamieliu@google.com> | 2018-10-08 10:19:27 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-08 10:20:38 -0700 |
commit | e9e8be661328661b5527f1643727b9a13bbeab48 (patch) | |
tree | fb6ab9a8e995d56a73b00c237cb6225799f6417c /pkg/sentry/strace | |
parent | 4a00ea557c6e60cdd131b2a9866aa3b0bcb9cb2c (diff) |
Implement shared futexes.
- Shared futex objects on shared mappings are represented by Mappable +
offset, analogous to Linux's use of inode + offset. Add type
futex.Key, and change the futex.Manager bucket API to use futex.Keys
instead of addresses.
- Extend the futex.Checker interface to be able to return Keys for
memory mappings. It returns Keys rather than just mappings because
whether the address or the target of the mapping is used in the Key
depends on whether the mapping is MAP_SHARED or MAP_PRIVATE; this
matters because using mapping target for a futex on a MAP_PRIVATE
mapping causes it to stop working across COW-breaking.
- futex.Manager.WaitComplete depends on atomic updates to
futex.Waiter.addr to determine when it has locked the right bucket,
which is much less straightforward for struct futex.Waiter.key. Switch
to an atomically-accessed futex.Waiter.bucket pointer.
- futex.Manager.Wake now needs to take a futex.Checker to resolve
addresses for shared futexes. CLONE_CHILD_CLEARTID requires the exit
path to perform a shared futex wakeup (Linux:
kernel/fork.c:mm_release() => sys_futex(tsk->clear_child_tid,
FUTEX_WAKE, ...)). This is a problem because futexChecker is in the
syscalls/linux package. Move it to kernel.
PiperOrigin-RevId: 216207039
Change-Id: I708d68e2d1f47e526d9afd95e7fed410c84afccf
Diffstat (limited to 'pkg/sentry/strace')
0 files changed, 0 insertions, 0 deletions