diff options
author | Rahat Mahmood <rahat@google.com> | 2018-12-10 12:47:20 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-10 12:48:02 -0800 |
commit | fc297702511edef4760c4f7a1d89cc6f02347d50 (patch) | |
tree | 8bdcb8a8086af0de4db2525b1ea1327449e89bf1 /pkg/sentry/syscalls/linux | |
parent | 99d595869332f817de8f570fae184658c513a43c (diff) |
Add type safety to shm ids and keys.
PiperOrigin-RevId: 224864380
Change-Id: I49542279ad56bf15ba462d3de1ef2b157b31830a
Diffstat (limited to 'pkg/sentry/syscalls/linux')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_shm.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_shm.go b/pkg/sentry/syscalls/linux/sys_shm.go index 8753c2e58..a0d3a73c5 100644 --- a/pkg/sentry/syscalls/linux/sys_shm.go +++ b/pkg/sentry/syscalls/linux/sys_shm.go @@ -24,7 +24,7 @@ import ( // Shmget implements shmget(2). func Shmget(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) { - key := args[0].Int() + key := shm.Key(args[0].Int()) size := uint64(args[1].SizeT()) flag := args[2].Int() @@ -43,7 +43,7 @@ func Shmget(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal } // findSegment retrives a shm segment by the given id. -func findSegment(t *kernel.Task, id int32) (*shm.Shm, error) { +func findSegment(t *kernel.Task, id shm.ID) (*shm.Shm, error) { r := t.IPCNamespace().ShmRegistry() segment := r.FindByID(id) if segment == nil { @@ -55,7 +55,7 @@ func findSegment(t *kernel.Task, id int32) (*shm.Shm, error) { // Shmat implements shmat(2). func Shmat(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) { - id := args[0].Int() + id := shm.ID(args[0].Int()) addr := args[1].Pointer() flag := args[2].Int() @@ -86,7 +86,7 @@ func Shmdt(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall // Shmctl implements shmctl(2). func Shmctl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) { - id := args[0].Int() + id := shm.ID(args[0].Int()) cmd := args[1].Int() buf := args[2].Pointer() |