summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/ptrace/subprocess.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-06-27 13:23:49 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-27 13:59:57 -0700
commite2760839033618410cdea9aeab039e096cde54be (patch)
treea396466730e085b72e5608493f095de5ff575784 /pkg/sentry/platform/ptrace/subprocess.go
parent7188790f92444e3e817a62606745ecc05cb181a5 (diff)
gvisor/ptrace: grub initial thread registers only once
PiperOrigin-RevId: 255465635
Diffstat (limited to 'pkg/sentry/platform/ptrace/subprocess.go')
-rw-r--r--pkg/sentry/platform/ptrace/subprocess.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/platform/ptrace/subprocess.go b/pkg/sentry/platform/ptrace/subprocess.go
index f15b3415a..46f9d3fb6 100644
--- a/pkg/sentry/platform/ptrace/subprocess.go
+++ b/pkg/sentry/platform/ptrace/subprocess.go
@@ -155,6 +155,7 @@ func newSubprocess(create func() (*thread, error)) (*subprocess, error) {
errChan <- err
return
}
+ firstThread.grabInitRegs()
// Ready to handle requests.
errChan <- nil
@@ -179,6 +180,7 @@ func newSubprocess(create func() (*thread, error)) (*subprocess, error) {
// Detach the thread.
t.detach()
+ t.initRegs = firstThread.initRegs
// Return the thread.
r <- t
@@ -269,7 +271,9 @@ func (t *thread) attach() {
// Initialize options.
t.init()
+}
+func (t *thread) grabInitRegs() {
// Grab registers.
//
// Note that we adjust the current register RIP value to be just before