summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/arch/syscalls_arm64.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-19 00:16:21 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-19 00:16:21 +0000
commitdba92a982d4bffa2a7d070b8c633753fec481d8d (patch)
tree3d9643748f9b2563e0be3eb9d3a55ae0abc9c466 /pkg/sentry/arch/syscalls_arm64.go
parent1e4671875d2f3d4432067d315c729f8c6429b407 (diff)
parenta0fed7ea459833c93980dd6937a140db9bdcee8c (diff)
Merge release-20200219.0-197-ga0fed7e (automated)
Diffstat (limited to 'pkg/sentry/arch/syscalls_arm64.go')
-rwxr-xr-xpkg/sentry/arch/syscalls_arm64.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg/sentry/arch/syscalls_arm64.go b/pkg/sentry/arch/syscalls_arm64.go
index 00d5ef461..dc13b6124 100755
--- a/pkg/sentry/arch/syscalls_arm64.go
+++ b/pkg/sentry/arch/syscalls_arm64.go
@@ -50,13 +50,21 @@ func (c *context64) SyscallArgs() SyscallArguments {
}
// RestartSyscall implements Context.RestartSyscall.
+// Prepare for system call restart, OrigR0 will be restored to R0.
+// Please see the linux code as reference:
+// arch/arm64/kernel/signal.c:do_signal()
func (c *context64) RestartSyscall() {
c.Regs.Pc -= SyscallWidth
- c.Regs.Regs[8] = uint64(restartSyscallNr)
+ // R0 will be backed up into OrigR0 when entering doSyscall().
+ // Please see the linux code as reference:
+ // arch/arm64/kernel/syscall.c:el0_svc_common().
+ // Here we restore it back.
+ c.Regs.Regs[0] = uint64(c.OrigR0)
}
// RestartSyscallWithRestartBlock implements Context.RestartSyscallWithRestartBlock.
func (c *context64) RestartSyscallWithRestartBlock() {
c.Regs.Pc -= SyscallWidth
+ c.Regs.Regs[0] = uint64(c.OrigR0)
c.Regs.Regs[8] = uint64(restartSyscallNr)
}