From bed6f8534b1bedaad031682fe052b5a46d9cb3ee Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Tue, 19 Feb 2019 15:48:39 -0800 Subject: Set rax to syscall number on SECCOMP_RET_TRAP. PiperOrigin-RevId: 234690475 Change-Id: I1cbfb5aecd4697a4a26ec8524354aa8656cc3ba1 --- pkg/sentry/kernel/seccomp.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg/sentry/kernel') diff --git a/pkg/sentry/kernel/seccomp.go b/pkg/sentry/kernel/seccomp.go index cec179246..4bed4d373 100644 --- a/pkg/sentry/kernel/seccomp.go +++ b/pkg/sentry/kernel/seccomp.go @@ -75,6 +75,9 @@ func (t *Task) checkSeccompSyscall(sysno int32, args arch.SyscallArguments, ip u // portion of the return value will be passed as si_errno." - // Documentation/prctl/seccomp_filter.txt t.SendSignal(seccompSiginfo(t, int32(result.Data()), sysno, ip)) + // "The return value register will contain an arch-dependent value." In + // practice, it's ~always the syscall number. + t.Arch().SetReturn(uintptr(sysno)) case linux.SECCOMP_RET_ERRNO: // "Results in the lower 16-bits of the return value being passed to -- cgit v1.2.3