diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-03-05 23:39:14 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-05 23:40:18 -0800 |
commit | 0b76887147820a809beaa497ede8dc4f7b7b120a (patch) | |
tree | a89be091add2e39163cefe84bf3614a6338f3cd9 /pkg/sentry/safemem | |
parent | fcba4e8f040ab4b40e04b9315d718d7e5aa44635 (diff) |
Priority-inheritance futex implementation
It is Implemented without the priority inheritance part given
that gVisor defers scheduling decisions to Go runtime and doesn't
have control over it.
PiperOrigin-RevId: 236989545
Change-Id: I714c8ca0798743ecf3167b14ffeb5cd834302560
Diffstat (limited to 'pkg/sentry/safemem')
-rw-r--r-- | pkg/sentry/safemem/block_unsafe.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/safemem/block_unsafe.go b/pkg/sentry/safemem/block_unsafe.go index e91ff66ae..c3a9780d2 100644 --- a/pkg/sentry/safemem/block_unsafe.go +++ b/pkg/sentry/safemem/block_unsafe.go @@ -267,3 +267,13 @@ func CompareAndSwapUint32(b Block, old, new uint32) (uint32, error) { } return safecopy.CompareAndSwapUint32(b.start, old, new) } + +// LoadUint32 invokes safecopy.LoadUint32 on the first 4 bytes of b. +// +// Preconditions: b.Len() >= 4. +func LoadUint32(b Block) (uint32, error) { + if b.length < 4 { + panic(fmt.Sprintf("insufficient length: %d", b.length)) + } + return safecopy.LoadUint32(b.start) +} |