diff options
author | Rahat Mahmood <rahat@google.com> | 2020-09-15 23:37:04 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-15 23:38:57 -0700 |
commit | d201feb8c5e425bfa8abc905f24d49b268520aec (patch) | |
tree | b3aa642d325e2b95bb1a6d5a2f934b6683f61ede /pkg/sentry/syscalls/linux/sys_seccomp.go | |
parent | dcd532e2e416aa81ca9ac42dc153731855f91418 (diff) |
Enable automated marshalling for the syscall package.
PiperOrigin-RevId: 331940975
Diffstat (limited to 'pkg/sentry/syscalls/linux/sys_seccomp.go')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_seccomp.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_seccomp.go b/pkg/sentry/syscalls/linux/sys_seccomp.go index 5b7a66f4d..4fdb4463c 100644 --- a/pkg/sentry/syscalls/linux/sys_seccomp.go +++ b/pkg/sentry/syscalls/linux/sys_seccomp.go @@ -24,6 +24,8 @@ import ( ) // userSockFprog is equivalent to Linux's struct sock_fprog on amd64. +// +// +marshal type userSockFprog struct { // Len is the length of the filter in BPF instructions. Len uint16 @@ -33,7 +35,7 @@ type userSockFprog struct { // Filter is a user pointer to the struct sock_filter array that makes up // the filter program. Filter is a uint64 rather than a usermem.Addr // because usermem.Addr is actually uintptr, which is not a fixed-size - // type, and encoding/binary.Read objects to this. + // type. Filter uint64 } @@ -54,11 +56,11 @@ func seccomp(t *kernel.Task, mode, flags uint64, addr usermem.Addr) error { } var fprog userSockFprog - if _, err := t.CopyIn(addr, &fprog); err != nil { + if _, err := fprog.CopyIn(t, addr); err != nil { return err } filter := make([]linux.BPFInstruction, int(fprog.Len)) - if _, err := t.CopyIn(usermem.Addr(fprog.Filter), &filter); err != nil { + if _, err := linux.CopyBPFInstructionSliceIn(t, usermem.Addr(fprog.Filter), filter); err != nil { return err } compiledFilter, err := bpf.Compile(filter) |