From 076f107643fafab30a0d45dd5af49b8bd4b574b9 Mon Sep 17 00:00:00 2001
From: Michael Pratt <mpratt@google.com>
Date: Tue, 4 Dec 2018 18:52:56 -0800
Subject: Remove initRegs arg from clone

It is always the same as t.initRegs.

PiperOrigin-RevId: 224085550
Change-Id: I5cc4ddc3b481d4748c3c43f6f4bb50da1dbac694
---
 pkg/sentry/platform/ptrace/ptrace_unsafe.go | 6 +++---
 pkg/sentry/platform/ptrace/subprocess.go    | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

(limited to 'pkg/sentry')

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))
-- 
cgit v1.2.3