Improve unsupported syscall message
PiperOrigin-RevId: 312104899
This commit is contained in:
parent
c27e334f26
commit
32ab382c80
|
@ -119,7 +119,13 @@ func (c *compatEmitter) emitUnimplementedSyscall(us *spb.UnimplementedSyscall) {
|
|||
}
|
||||
|
||||
if tr.shouldReport(regs) {
|
||||
c.sink.Infof("Unsupported syscall: %s, regs: %+v", c.nameMap.Name(uintptr(sysnr)), regs)
|
||||
name := c.nameMap.Name(uintptr(sysnr))
|
||||
c.sink.Infof("Unsupported syscall %s(%#x,%#x,%#x,%#x,%#x,%#x). It is "+
|
||||
"likely that you can safely ignore this message and that this is not "+
|
||||
"the cause of any error. Please, refer to %s/%s for more information.",
|
||||
name, argVal(0, regs), argVal(1, regs), argVal(2, regs), argVal(3, regs),
|
||||
argVal(4, regs), argVal(5, regs), syscallLink, name)
|
||||
|
||||
tr.onReported(regs)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,12 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/strace"
|
||||
)
|
||||
|
||||
// reportLimit is the max number of events that should be reported per tracker.
|
||||
const reportLimit = 100
|
||||
const (
|
||||
// reportLimit is the max number of events that should be reported per
|
||||
// tracker.
|
||||
reportLimit = 100
|
||||
syscallLink = "https://gvisor.dev/c/linux/amd64"
|
||||
)
|
||||
|
||||
// newRegs create a empty Registers instance.
|
||||
func newRegs() *rpb.Registers {
|
||||
|
@ -36,22 +40,22 @@ func newRegs() *rpb.Registers {
|
|||
}
|
||||
}
|
||||
|
||||
func argVal(argIdx int, regs *rpb.Registers) uint32 {
|
||||
func argVal(argIdx int, regs *rpb.Registers) uint64 {
|
||||
amd64Regs := regs.GetArch().(*rpb.Registers_Amd64).Amd64
|
||||
|
||||
switch argIdx {
|
||||
case 0:
|
||||
return uint32(amd64Regs.Rdi)
|
||||
return amd64Regs.Rdi
|
||||
case 1:
|
||||
return uint32(amd64Regs.Rsi)
|
||||
return amd64Regs.Rsi
|
||||
case 2:
|
||||
return uint32(amd64Regs.Rdx)
|
||||
return amd64Regs.Rdx
|
||||
case 3:
|
||||
return uint32(amd64Regs.R10)
|
||||
return amd64Regs.R10
|
||||
case 4:
|
||||
return uint32(amd64Regs.R8)
|
||||
return amd64Regs.R8
|
||||
case 5:
|
||||
return uint32(amd64Regs.R9)
|
||||
return amd64Regs.R9
|
||||
}
|
||||
panic(fmt.Sprintf("invalid syscall argument index %d", argIdx))
|
||||
}
|
||||
|
|
|
@ -23,8 +23,12 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/strace"
|
||||
)
|
||||
|
||||
// reportLimit is the max number of events that should be reported per tracker.
|
||||
const reportLimit = 100
|
||||
const (
|
||||
// reportLimit is the max number of events that should be reported per
|
||||
// tracker.
|
||||
reportLimit = 100
|
||||
syscallLink = "https://gvisor.dev/c/linux/arm64"
|
||||
)
|
||||
|
||||
// newRegs create a empty Registers instance.
|
||||
func newRegs() *rpb.Registers {
|
||||
|
@ -35,22 +39,22 @@ func newRegs() *rpb.Registers {
|
|||
}
|
||||
}
|
||||
|
||||
func argVal(argIdx int, regs *rpb.Registers) uint32 {
|
||||
func argVal(argIdx int, regs *rpb.Registers) uint64 {
|
||||
arm64Regs := regs.GetArch().(*rpb.Registers_Arm64).Arm64
|
||||
|
||||
switch argIdx {
|
||||
case 0:
|
||||
return uint32(arm64Regs.R0)
|
||||
return arm64Regs.R0
|
||||
case 1:
|
||||
return uint32(arm64Regs.R1)
|
||||
return arm64Regs.R1
|
||||
case 2:
|
||||
return uint32(arm64Regs.R2)
|
||||
return arm64Regs.R2
|
||||
case 3:
|
||||
return uint32(arm64Regs.R3)
|
||||
return arm64Regs.R3
|
||||
case 4:
|
||||
return uint32(arm64Regs.R4)
|
||||
return arm64Regs.R4
|
||||
case 5:
|
||||
return uint32(arm64Regs.R5)
|
||||
return arm64Regs.R5
|
||||
}
|
||||
panic(fmt.Sprintf("invalid syscall argument index %d", argIdx))
|
||||
}
|
||||
|
|
|
@ -1760,7 +1760,7 @@ func TestUserLog(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error opening user log file %q: %v", userLog, err)
|
||||
}
|
||||
if want := "Unsupported syscall: sched_rr_get_interval"; !strings.Contains(string(out), want) {
|
||||
if want := "Unsupported syscall sched_rr_get_interval("; !strings.Contains(string(out), want) {
|
||||
t.Errorf("user log file doesn't contain %q, out: %s", want, string(out))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue