Commit Graph

10 Commits

Author SHA1 Message Date
Yichao Yu d8bf141fea
Change restart_original_syscall to not use chained syscall (#297)
If we are simply restarting a syscall, there's no need to do anything afterwards
to restore any register values so we don't really need to keep a record of it ourselves
in the chain syscall list.

By simply resetting the PC and the arguments, we avoid issue #292 for this function
when we get a signal before we run the restarted syscall and confused syscall
from the signal handler as the one we restarted (chained).
2021-10-05 16:34:41 -04:00
Yichao Yu 464d242f8c
Fix waitpid on zombies (#291)
When the ptracer waits on a non-immediate child,
the information is only available in the zombies list and we need to handle those ourselves.

Expands the tracee lookup of the wait enter to include zombies of the tracee to handle this.

The new test mimicing the testing operation from gdb's `linux_check_ptrace_features`.
2021-10-04 17:06:55 -04:00
Yichao Yu e5a1af0818
Enable github action for testing (#287)
* Enable github action for testing

Add a `QUIET_LOG` option for the test makefile to allow printing the full log
while still having a nice summary of the test results.

Co-authored-by: Lucas Ramage <lucas.ramage@infinite-omicron.com>
2021-10-02 15:00:07 -04:00
Yichao Yu d0a8b690b6
Fix event handling on newer kernels (#288)
The event handler for the old kernel may still be called on new kernels.
This causes issues since the two event handlers maintains their own global states
unaware of each other.

In particular, execve+ptrace handling from the loader of the tracee
will issue an `execve(0x1, ...)` to signal proot of the start addresses.
This triggers a `SIGTRAP` to the tracee for the tracer to handle.
However, the event handler expect one initial `SIGTRAP` to have special meaning
and if the wrong event handler is called, it will incorrectly assume this `SIGTRAP`
is the special one and acts incorrectly. (In this case, causing the signaling `execve`
to run again and set the addresses incorrectly.)
2021-10-02 14:51:06 -04:00
Yichao Yu 595585dbef
Make sure `/bin` is in PATH during test (#274)
On ArchLinux, where `/bin` is no longer in `PATH` by default
this fixes about 10 test failures.
2021-10-01 10:41:08 -04:00
Jakub Zakrzewski 83b213a915 Add a testcase.
When running under seccomp, sometimes sysexit handlers fail to execute.
This is possible when the first syscall a process makes,
before seccomp is enabled, gets handled in the SIGTRAP path.
However the conditions for this to occur seem fairly random,
so we fork out many processes to make it likely that at least
some hit this problem.

This problem may be related to issue #106.
2021-09-07 17:55:20 -04:00
Lucas Ramage afbde91b46
Add Dockerfiles for testing (#228) 2020-06-09 11:37:40 -04:00
Lucas Ramage d51d629221 Limit testsuite to five minutes
Fixes Travis from erroring out.
Also remove disabled tests.

Bug: https://github.com/proot-me/proot/issues/202
2020-04-02 17:40:12 +00:00
Lucas Ramage ffd03afe41 Temporarily disable tests
These two tests hang up Travis indefinitely

Bug: https://github.com/proot-me/proot/issues/202
2020-01-08 15:46:18 -05:00
Lucas Ramage 2658363d39 Fix missing GNUmakefile
This reverts commit 05bdc8bfd9.
2019-12-19 16:19:18 -05:00