summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-02-20 22:31:43 +0000
committergVisor bot <gvisor-bot@google.com>2020-02-20 22:31:43 +0000
commit1ef036583b04a3a3ac625899d124e4b732281ab3 (patch)
tree6aae8adee759b0a3fb015a997391c9d0733559b8
parentd3b40e45b3bdc3e444cda9816c4e30924d7c9122 (diff)
parentd90d71474f4c82f742140fdf026821709845cece (diff)
Merge release-20200211.0-55-gd90d714 (automated)
-rwxr-xr-xpkg/abi/linux/linux_abi_autogen_unsafe.go24
-rwxr-xr-xpkg/abi/linux/linux_amd64_abi_autogen_unsafe.go25
-rwxr-xr-xpkg/abi/linux/linux_arm64_abi_autogen_unsafe.go25
-rw-r--r--pkg/sentry/kernel/rseq.go2
-rw-r--r--pkg/sentry/syscalls/linux/sys_stat.go6
-rwxr-xr-xtools/go_marshal/marshal/marshal.go4
6 files changed, 43 insertions, 43 deletions
diff --git a/pkg/abi/linux/linux_abi_autogen_unsafe.go b/pkg/abi/linux/linux_abi_autogen_unsafe.go
index 73853a078..82f1100cc 100755
--- a/pkg/abi/linux/linux_abi_autogen_unsafe.go
+++ b/pkg/abi/linux/linux_abi_autogen_unsafe.go
@@ -65,7 +65,7 @@ func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) {
}
// CopyOut implements marshal.Marshallable.CopyOut.
-func (r *RSeqCriticalSection) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
+func (r *RSeqCriticalSection) CopyOut(task marshal.Task, addr usermem.Addr) error {
// Bypass escape analysis on r. The no-op arithmetic operation on the
// pointer makes the compiler think val doesn't depend on r.
// See src/runtime/stubs.go:noescape() in the golang toolchain.
@@ -80,15 +80,15 @@ func (r *RSeqCriticalSection) CopyOut(task marshal.Task, addr usermem.Addr) (int
hdr.Len = r.SizeBytes()
hdr.Cap = r.SizeBytes()
- len, err := task.CopyOutBytes(addr, buf)
+ _, err := task.CopyOutBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that r
// must live until after the CopyOutBytes.
runtime.KeepAlive(r)
- return len, err
+ return err
}
// CopyIn implements marshal.Marshallable.CopyIn.
-func (r *RSeqCriticalSection) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (r *RSeqCriticalSection) CopyIn(task marshal.Task, addr usermem.Addr) error {
// Bypass escape analysis on r. The no-op arithmetic operation on the
// pointer makes the compiler think val doesn't depend on r.
// See src/runtime/stubs.go:noescape() in the golang toolchain.
@@ -103,11 +103,11 @@ func (r *RSeqCriticalSection) CopyIn(task marshal.Task, addr usermem.Addr) (int,
hdr.Len = r.SizeBytes()
hdr.Cap = r.SizeBytes()
- len, err := task.CopyInBytes(addr, buf)
+ _, err := task.CopyInBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that r
// must live until after the CopyInBytes.
runtime.KeepAlive(r)
- return len, err
+ return err
}
// WriteTo implements io.WriterTo.WriteTo.
@@ -170,7 +170,7 @@ func (t *Timespec) UnmarshalUnsafe(src []byte) {
}
// CopyOut implements marshal.Marshallable.CopyOut.
-func (t *Timespec) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
+func (t *Timespec) CopyOut(task marshal.Task, addr usermem.Addr) error {
// Bypass escape analysis on t. The no-op arithmetic operation on the
// pointer makes the compiler think val doesn't depend on t.
// See src/runtime/stubs.go:noescape() in the golang toolchain.
@@ -185,15 +185,15 @@ func (t *Timespec) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = t.SizeBytes()
hdr.Cap = t.SizeBytes()
- len, err := task.CopyOutBytes(addr, buf)
+ _, err := task.CopyOutBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that t
// must live until after the CopyOutBytes.
runtime.KeepAlive(t)
- return len, err
+ return err
}
// CopyIn implements marshal.Marshallable.CopyIn.
-func (t *Timespec) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (t *Timespec) CopyIn(task marshal.Task, addr usermem.Addr) error {
// Bypass escape analysis on t. The no-op arithmetic operation on the
// pointer makes the compiler think val doesn't depend on t.
// See src/runtime/stubs.go:noescape() in the golang toolchain.
@@ -208,11 +208,11 @@ func (t *Timespec) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = t.SizeBytes()
hdr.Cap = t.SizeBytes()
- len, err := task.CopyInBytes(addr, buf)
+ _, err := task.CopyInBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that t
// must live until after the CopyInBytes.
runtime.KeepAlive(t)
- return len, err
+ return err
}
// WriteTo implements io.WriterTo.WriteTo.
diff --git a/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go b/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go
index bf002d73f..cefe4941a 100755
--- a/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go
+++ b/pkg/abi/linux/linux_amd64_abi_autogen_unsafe.go
@@ -110,7 +110,7 @@ func (s *Stat) MarshalUnsafe(dst []byte) {
// UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
func (s *Stat) UnmarshalUnsafe(src []byte) {
- if s.CTime.Packed() && s.ATime.Packed() && s.MTime.Packed() {
+ if s.ATime.Packed() && s.MTime.Packed() && s.CTime.Packed() {
safecopy.CopyOut(unsafe.Pointer(s), src)
} else {
s.UnmarshalBytes(src)
@@ -118,12 +118,13 @@ func (s *Stat) UnmarshalUnsafe(src []byte) {
}
// CopyOut implements marshal.Marshallable.CopyOut.
-func (s *Stat) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *Stat) CopyOut(task marshal.Task, addr usermem.Addr) error {
if !s.ATime.Packed() && s.MTime.Packed() && s.CTime.Packed() {
// Type Stat doesn't have a packed layout in memory, fall back to MarshalBytes.
buf := task.CopyScratchBuffer(s.SizeBytes())
s.MarshalBytes(buf)
- return task.CopyOutBytes(addr, buf)
+ _, err := task.CopyOutBytes(addr, buf)
+ return err
}
// Bypass escape analysis on s. The no-op arithmetic operation on the
@@ -140,24 +141,24 @@ func (s *Stat) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- len, err := task.CopyOutBytes(addr, buf)
+ _, err := task.CopyOutBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until after the CopyOutBytes.
runtime.KeepAlive(s)
- return len, err
+ return err
}
// CopyIn implements marshal.Marshallable.CopyIn.
-func (s *Stat) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *Stat) CopyIn(task marshal.Task, addr usermem.Addr) error {
if !s.ATime.Packed() && s.MTime.Packed() && s.CTime.Packed() {
// Type Stat doesn't have a packed layout in memory, fall back to UnmarshalBytes.
buf := task.CopyScratchBuffer(s.SizeBytes())
- n, err := task.CopyInBytes(addr, buf)
+ _, err := task.CopyInBytes(addr, buf)
if err != nil {
- return n, err
+ return err
}
s.UnmarshalBytes(buf)
- return n, nil
+ return nil
}
// Bypass escape analysis on s. The no-op arithmetic operation on the
@@ -174,16 +175,16 @@ func (s *Stat) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- len, err := task.CopyInBytes(addr, buf)
+ _, err := task.CopyInBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until after the CopyInBytes.
runtime.KeepAlive(s)
- return len, err
+ return err
}
// WriteTo implements io.WriterTo.WriteTo.
func (s *Stat) WriteTo(w io.Writer) (int64, error) {
- if !s.ATime.Packed() && s.MTime.Packed() && s.CTime.Packed() {
+ if !s.CTime.Packed() && s.ATime.Packed() && s.MTime.Packed() {
// Type Stat doesn't have a packed layout in memory, fall back to MarshalBytes.
buf := make([]byte, s.SizeBytes())
s.MarshalBytes(buf)
diff --git a/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go b/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
index daee765f3..83d655d30 100755
--- a/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
+++ b/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
@@ -122,12 +122,13 @@ func (s *Stat) UnmarshalUnsafe(src []byte) {
}
// CopyOut implements marshal.Marshallable.CopyOut.
-func (s *Stat) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- if !s.ATime.Packed() && s.MTime.Packed() && s.CTime.Packed() {
+func (s *Stat) CopyOut(task marshal.Task, addr usermem.Addr) error {
+ if !s.CTime.Packed() && s.ATime.Packed() && s.MTime.Packed() {
// Type Stat doesn't have a packed layout in memory, fall back to MarshalBytes.
buf := task.CopyScratchBuffer(s.SizeBytes())
s.MarshalBytes(buf)
- return task.CopyOutBytes(addr, buf)
+ _, err := task.CopyOutBytes(addr, buf)
+ return err
}
// Bypass escape analysis on s. The no-op arithmetic operation on the
@@ -144,24 +145,24 @@ func (s *Stat) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- len, err := task.CopyOutBytes(addr, buf)
+ _, err := task.CopyOutBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until after the CopyOutBytes.
runtime.KeepAlive(s)
- return len, err
+ return err
}
// CopyIn implements marshal.Marshallable.CopyIn.
-func (s *Stat) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
- if !s.ATime.Packed() && s.MTime.Packed() && s.CTime.Packed() {
+func (s *Stat) CopyIn(task marshal.Task, addr usermem.Addr) error {
+ if !s.MTime.Packed() && s.CTime.Packed() && s.ATime.Packed() {
// Type Stat doesn't have a packed layout in memory, fall back to UnmarshalBytes.
buf := task.CopyScratchBuffer(s.SizeBytes())
- n, err := task.CopyInBytes(addr, buf)
+ _, err := task.CopyInBytes(addr, buf)
if err != nil {
- return n, err
+ return err
}
s.UnmarshalBytes(buf)
- return n, nil
+ return nil
}
// Bypass escape analysis on s. The no-op arithmetic operation on the
@@ -178,11 +179,11 @@ func (s *Stat) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- len, err := task.CopyInBytes(addr, buf)
+ _, err := task.CopyInBytes(addr, buf)
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until after the CopyInBytes.
runtime.KeepAlive(s)
- return len, err
+ return err
}
// WriteTo implements io.WriterTo.WriteTo.
diff --git a/pkg/sentry/kernel/rseq.go b/pkg/sentry/kernel/rseq.go
index 18416643b..ded95f532 100644
--- a/pkg/sentry/kernel/rseq.go
+++ b/pkg/sentry/kernel/rseq.go
@@ -304,7 +304,7 @@ func (t *Task) rseqAddrInterrupt() {
}
var cs linux.RSeqCriticalSection
- if _, err := cs.CopyIn(t, critAddr); err != nil {
+ if err := cs.CopyIn(t, critAddr); err != nil {
t.Debugf("Failed to copy critical section from %#x for rseq: %v", critAddr, err)
t.forceSignal(linux.SIGSEGV, false /* unconditional */)
t.SendSignal(SignalInfoPriv(linux.SIGSEGV))
diff --git a/pkg/sentry/syscalls/linux/sys_stat.go b/pkg/sentry/syscalls/linux/sys_stat.go
index 8b66a9006..11f25e00d 100644
--- a/pkg/sentry/syscalls/linux/sys_stat.go
+++ b/pkg/sentry/syscalls/linux/sys_stat.go
@@ -131,8 +131,7 @@ func stat(t *kernel.Task, d *fs.Dirent, dirPath bool, statAddr usermem.Addr) err
return err
}
s := statFromAttrs(t, d.Inode.StableAttr, uattr)
- _, err = s.CopyOut(t, statAddr)
- return err
+ return s.CopyOut(t, statAddr)
}
// fstat implements fstat for the given *fs.File.
@@ -142,8 +141,7 @@ func fstat(t *kernel.Task, f *fs.File, statAddr usermem.Addr) error {
return err
}
s := statFromAttrs(t, f.Dirent.Inode.StableAttr, uattr)
- _, err = s.CopyOut(t, statAddr)
- return err
+ return s.CopyOut(t, statAddr)
}
// Statx implements linux syscall statx(2).
diff --git a/tools/go_marshal/marshal/marshal.go b/tools/go_marshal/marshal/marshal.go
index 20353850d..f129788e0 100755
--- a/tools/go_marshal/marshal/marshal.go
+++ b/tools/go_marshal/marshal/marshal.go
@@ -91,12 +91,12 @@ type Marshallable interface {
// marshalled does not escape. The implementation should avoid creating
// extra copies in memory by directly deserializing to the object's
// underlying memory.
- CopyIn(task Task, addr usermem.Addr) (int, error)
+ CopyIn(task Task, addr usermem.Addr) error
// CopyOut serializes a Marshallable type to a task's memory. This may only
// be called from a task goroutine. This is more efficient than calling
// MarshalUnsafe on Marshallable.Packed types, as the type being serialized
// does not escape. The implementation should avoid creating extra copies in
// memory by directly serializing from the object's underlying memory.
- CopyOut(task Task, addr usermem.Addr) (int, error)
+ CopyOut(task Task, addr usermem.Addr) error
}