summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-12-04 18:52:56 -0800
committerShentubot <shentubot@google.com>2018-12-04 18:53:43 -0800
commit076f107643fafab30a0d45dd5af49b8bd4b574b9 (patch)
treed292b876b55805a2f4f8dbd0ec1402cb4033602d /pkg/sentry
parentffcbda0c8bd772c9019977775daf1d86891c3f28 (diff)
Remove initRegs arg from clone
It is always the same as t.initRegs. PiperOrigin-RevId: 224085550 Change-Id: I5cc4ddc3b481d4748c3c43f6f4bb50da1dbac694
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/platform/ptrace/ptrace_unsafe.go6
-rw-r--r--pkg/sentry/platform/ptrace/subprocess.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/platform/ptrace/ptrace_unsafe.go b/pkg/sentry/platform/ptrace/ptrace_unsafe.go
index 7a3cb8f49..223b23199 100644
--- a/pkg/sentry/platform/ptrace/ptrace_unsafe.go
+++ b/pkg/sentry/platform/ptrace/ptrace_unsafe.go
@@ -130,8 +130,8 @@ func (t *thread) getSignalInfo(si *arch.SignalInfo) error {
// call attach on it.
//
// Precondition: the OS thread must be locked and own t.
-func (t *thread) clone(initRegs *syscall.PtraceRegs) (*thread, error) {
- r, ok := usermem.Addr(initRegs.Rsp).RoundUp()
+func (t *thread) clone() (*thread, error) {
+ r, ok := usermem.Addr(t.initRegs.Rsp).RoundUp()
if !ok {
return nil, syscall.EINVAL
}
@@ -153,7 +153,7 @@ func (t *thread) clone(initRegs *syscall.PtraceRegs) (*thread, error) {
arch.SyscallArgument{},
// We use these registers initially, but really they
// could be anything. We're going to stop immediately.
- arch.SyscallArgument{Value: uintptr(unsafe.Pointer(initRegs))})
+ arch.SyscallArgument{Value: uintptr(unsafe.Pointer(&t.initRegs))})
if err != nil {
return nil, err
}
diff --git a/pkg/sentry/platform/ptrace/subprocess.go b/pkg/sentry/platform/ptrace/subprocess.go
index 2cd49d1ec..5e56a1514 100644
--- a/pkg/sentry/platform/ptrace/subprocess.go
+++ b/pkg/sentry/platform/ptrace/subprocess.go
@@ -160,7 +160,7 @@ func newSubprocess(create func() (*thread, error)) (*subprocess, error) {
// Wait for requests to create threads.
for r := range requests {
- t, err := firstThread.clone(&firstThread.initRegs)
+ t, err := firstThread.clone()
if err != nil {
// Should not happen: not recoverable.
panic(fmt.Sprintf("error initializing first thread: %v", err))