summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/strace
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-10-01 14:15:52 -0700
committerShentubot <shentubot@google.com>2018-10-01 14:16:53 -0700
commit0400e5459288592768af12ab71609c6df6afe3d7 (patch)
treeb8c522749a19aa467b62d097a6b58042d0f971d2 /pkg/sentry/strace
parentd185552e79e19bd25cdcf64c123712086c48ae58 (diff)
Add itimer types to linux package, strace
PiperOrigin-RevId: 215278262 Change-Id: Icd10384c99802be6097be938196044386441e282
Diffstat (limited to 'pkg/sentry/strace')
-rw-r--r--pkg/sentry/strace/linux64.go4
-rw-r--r--pkg/sentry/strace/strace.go19
-rw-r--r--pkg/sentry/strace/syscalls.go7
3 files changed, 26 insertions, 4 deletions
diff --git a/pkg/sentry/strace/linux64.go b/pkg/sentry/strace/linux64.go
index 63851246c..1df148e7d 100644
--- a/pkg/sentry/strace/linux64.go
+++ b/pkg/sentry/strace/linux64.go
@@ -53,9 +53,9 @@ var linuxAMD64 = SyscallMap{
33: makeSyscallInfo("dup2", Hex, Hex),
34: makeSyscallInfo("pause"),
35: makeSyscallInfo("nanosleep", Timespec, PostTimespec),
- 36: makeSyscallInfo("getitimer", Hex, PostItimerVal),
+ 36: makeSyscallInfo("getitimer", ItimerType, PostItimerVal),
37: makeSyscallInfo("alarm", Hex),
- 38: makeSyscallInfo("setitimer", Hex, ItimerVal, PostItimerVal),
+ 38: makeSyscallInfo("setitimer", ItimerType, ItimerVal, PostItimerVal),
39: makeSyscallInfo("getpid"),
40: makeSyscallInfo("sendfile", Hex, Hex, Hex, Hex),
41: makeSyscallInfo("socket", SockFamily, SockType, SockProtocol),
diff --git a/pkg/sentry/strace/strace.go b/pkg/sentry/strace/strace.go
index 539e665d2..c99c33c33 100644
--- a/pkg/sentry/strace/strace.go
+++ b/pkg/sentry/strace/strace.go
@@ -24,6 +24,7 @@ import (
"syscall"
"time"
+ "gvisor.googlesource.com/gvisor/pkg/abi"
"gvisor.googlesource.com/gvisor/pkg/abi/linux"
"gvisor.googlesource.com/gvisor/pkg/bits"
"gvisor.googlesource.com/gvisor/pkg/eventchannel"
@@ -46,6 +47,22 @@ var LogMaximumSize uint = DefaultLogMaximumSize
// do anything useful with binary text dump of byte array arguments.
var EventMaximumSize uint
+// ItimerTypes are the possible itimer types.
+var ItimerTypes = abi.ValueSet{
+ {
+ Value: linux.ITIMER_REAL,
+ Name: "ITIMER_REAL",
+ },
+ {
+ Value: linux.ITIMER_VIRTUAL,
+ Name: "ITIMER_VIRTUAL",
+ },
+ {
+ Value: linux.ITIMER_PROF,
+ Name: "ITIMER_PROF",
+ },
+}
+
func iovecs(t *kernel.Task, addr usermem.Addr, iovcnt int, printContent bool, maxBytes uint64) string {
if iovcnt < 0 || iovcnt > linux.UIO_MAXIOV {
return fmt.Sprintf("%#x (error decoding iovecs: invalid iovcnt)", addr)
@@ -322,6 +339,8 @@ func (i *SyscallInfo) pre(t *kernel.Task, args arch.SyscallArguments, maximumBlo
output = append(output, futex(uint64(args[arg].Uint())))
case PtraceRequest:
output = append(output, PtraceRequestSet.Parse(args[arg].Uint64()))
+ case ItimerType:
+ output = append(output, ItimerTypes.Parse(uint64(args[arg].Int())))
case Oct:
output = append(output, "0o"+strconv.FormatUint(args[arg].Uint64(), 8))
case Hex:
diff --git a/pkg/sentry/strace/syscalls.go b/pkg/sentry/strace/syscalls.go
index 770a0d2b9..8be4fa318 100644
--- a/pkg/sentry/strace/syscalls.go
+++ b/pkg/sentry/strace/syscalls.go
@@ -150,6 +150,9 @@ const (
// Utimbuf is a pointer to a struct utimbuf.
Utimbuf
+ // Rusage is a struct rusage, formatted after syscall execution.
+ Rusage
+
// CloneFlags are clone(2) flags.
CloneFlags
@@ -165,8 +168,8 @@ const (
// PtraceRequest is the ptrace(2) request.
PtraceRequest
- // Rusage is a struct rusage, formatted after syscall execution.
- Rusage
+ // ItimerType is an itimer type (ITIMER_REAL, etc).
+ ItimerType
)
// defaultFormat is the syscall argument format to use if the actual format is