Add extra checks for SiGSEV on PR_void system calls #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When extensions handle system calls they set the system call ID to 0
(PR_void). This is the same as what happens if a system call isn't
understood by proot. On Android unknown system calls result in a SECCOMP
failure (sending SIGSYS), rather than returning ENOSYS.
This changes the behavour of SIGSYS handing to check if the call was
handled by an extension. If the call was handled by an extention the
call should return 0, since it has been handled outside that context. If
it wasn't handled then we should return ENOSYS. This is because either
that system call doesn't exist, or we aren't allowed to call it. Either
way, since the point of proot is to adapt seccomp to other applications,
we should return ENOSYS because as far as the system is concerned that
system call doesn't exist.
Major props to nhinds for writing a bunch of go programs to help narrow
this down to the the SECCOMP filter and the handing of the SISSYS
signal.
This fixes headmelted/codebuilds#97 and CypherpunkArmory/UserLAnd#938