From 5f134b3c0a08c0e170aa50ad3342df59832b4356 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 20 Jul 2018 12:58:59 -0700 Subject: Format getcwd path PiperOrigin-RevId: 205440332 Change-Id: I2a838f363e079164c83da88e1b0b8769844fe79b --- pkg/sentry/strace/linux64.go | 2 +- pkg/sentry/strace/strace.go | 2 ++ pkg/sentry/strace/syscalls.go | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/sentry/strace/linux64.go b/pkg/sentry/strace/linux64.go index 90ea8c36f..85e1e1f83 100644 --- a/pkg/sentry/strace/linux64.go +++ b/pkg/sentry/strace/linux64.go @@ -96,7 +96,7 @@ var linuxAMD64 = SyscallMap{ 76: makeSyscallInfo("truncate", Path, Hex), 77: makeSyscallInfo("ftruncate", Hex, Hex), 78: makeSyscallInfo("getdents", Hex, Hex, Hex), - 79: makeSyscallInfo("getcwd", Hex, Hex), + 79: makeSyscallInfo("getcwd", PostPath, Hex), 80: makeSyscallInfo("chdir", Path), 81: makeSyscallInfo("fchdir", Hex), 82: makeSyscallInfo("rename", Path, Path), diff --git a/pkg/sentry/strace/strace.go b/pkg/sentry/strace/strace.go index 4cd16d2f8..03b4a350a 100644 --- a/pkg/sentry/strace/strace.go +++ b/pkg/sentry/strace/strace.go @@ -346,6 +346,8 @@ func (i *SyscallInfo) post(t *kernel.Task, args arch.SyscallArguments, rval uint output[arg] = msghdr(t, args[arg].Pointer(), false /* content */, uint64(maximumBlobSize)) case RecvMsgHdr: output[arg] = msghdr(t, args[arg].Pointer(), true /* content */, uint64(maximumBlobSize)) + case PostPath: + output[arg] = path(t, args[arg].Pointer()) case PipeFDs: output[arg] = fdpair(t, args[arg].Pointer()) case Uname: diff --git a/pkg/sentry/strace/syscalls.go b/pkg/sentry/strace/syscalls.go index eccee733e..4513d1ba6 100644 --- a/pkg/sentry/strace/syscalls.go +++ b/pkg/sentry/strace/syscalls.go @@ -75,6 +75,10 @@ const ( // Path is a pointer to a char* path. Path + // PostPath is a pointer to a char* path, formatted after syscall + // execution. + PostPath + // ExecveStringVector is a NULL-terminated array of strings. Enforces // the maximum execve array length. ExecveStringVector -- cgit v1.2.3