Commit Graph

425 Commits

Author SHA1 Message Date
jD91mZM2
3ac1416dba First step for ptrace overhaul 2019-07-24 21:42:33 +02:00
Jeremy Soller
e95cb74d0b Resolve cross-scheme links 2019-07-23 21:06:16 -06:00
jD91mZM2
1137692809 WIP(ptrace): Allow setting RIP 2019-07-23 19:55:11 +02:00
jD91mZM2
a7da393cf5 WIP(ptrace): Better support for signals
Signals now cause an event, and there's a way to continue until the
next signal. I can see this being used for detection of `int3`
although I'm not entirely sure as it may prove being too late to stop
abortion of process.
2019-07-21 19:58:32 +02:00
jD91mZM2
7426e48105 WIP(ptrace): Extract repeated arch-specific code to ptrace module 2019-07-21 13:28:31 +02:00
jD91mZM2
4c2d8599d8 Add missing debug definitions
See [strace-redox#ea42589d](ea42589d36)
2019-07-21 10:06:28 +02:00
jD91mZM2
6a3825d408 WIP(ptrace): Only use non-signal stack when using a default handler
This is a curious problem and it's really hard to solve it in a way
that doesn't feel hacky. On one hand, of course you want to be able to
modify and intercept what happens when you use a signal, right? On the
other hand, changes made to the context (especially singlestepping)
while a signal is handled (such as `SIGSTOP`) are not preserved since
the stack is restored after the signal handler was invoked.

I think what we have in this change makes sense anyway, as we don't
really want users modifying registers and other data in the default
signal behavior that occurs **in kernel mode**. Also trying to use
`PTRACE_SINGLESTEP` will set the singlestep flag only if in a
user-mode signal handler, else it will set it on the instruction after
the signal handling, which I guess makes sense since it can't affect
the kernel-mode code that runs the default handler.

I don't know. Help. Pls.
2019-07-20 22:45:33 +02:00
jD91mZM2
8695ecd82b Fix sigaction Undefind Behavior
Rust does not allow a `fn`-pointer to be null. This fixes that, while
luckily doing it in a way that leaves system calls
backwards-compatible :)
2019-07-20 22:41:54 +02:00
jD91mZM2
be867ae5f1 WIP(ptrace): Add ptrace event system for catching child forks 2019-07-20 09:45:07 +02:00
jD91mZM2
3d44242407 WIP(ptrace): Finally add stronger security checks 2019-07-20 09:45:07 +02:00
jD91mZM2
e3d8f23c71 WIP(ptrace): Add dbg! macro and fix waitpid immediately after exit 2019-07-20 09:45:01 +02:00
Jeremy Soller
532ffe25cf Unmounting support 2019-07-18 21:00:36 -06:00
Jeremy Soller
113af69434 Remove scheme if closed 2019-07-18 20:58:06 -06:00
Jeremy Soller
4b2c15f0b9 Remove scheme by ID 2019-07-18 20:57:51 -06:00
Jeremy Soller
5af7f71a99 Fix warning 2019-07-18 20:57:41 -06:00
Jeremy Soller
5a42b6dd76 Add notify_signal method to WaitCondition to simulate being woken by a signal 2019-07-18 19:48:54 -06:00
Jeremy Soller
76e0ed2e37 Make all wait_map members public 2019-07-18 19:48:27 -06:00
Jeremy Soller
bfc559a8a7 Merge branch 'master' of https://gitlab.redox-os.org/redox-os/kernel 2019-07-14 11:17:52 -06:00
Jeremy Soller
6e8729bac2 Disable RTC NMI and do not wait for an entire update cycle before reading time 2019-07-14 11:17:45 -06:00
jD91mZM2
6fbb4fbae1 Ptrace memory reading and floating point registers support 2019-07-07 17:07:04 +00:00
Jeremy Soller
788526a3b3 Bare-bones ptracing functionality
Since even a very basic ptrace can be nice to have, I thought I would split
the, perhaps rather big, ptrace project up in multiple PRs to make as few
changes as necessary in each. This PR contains the initial registry modifying
bits and only a very basic security measure. Letting this out to the community
should be good for spotting bugs and maybe getting some hype ;)
2019-07-02 07:38:26 -06:00
Jeremy Soller
45ea634798 Revert "Merge branch 'ptrace' into 'master'"
This reverts merge request !103
2019-07-02 11:56:11 +00:00
jD91mZM2
effe02bd45 Remove change I am faaairly certain I did NOT add :O
I'm guessing it's some issue after a rebase or something...
2019-07-01 22:50:19 +00:00
Jeremy Soller
42f977e7da Disable debug messages 2019-06-27 16:29:28 -06:00
Jeremy Soller
144ac70b12 Allow access to other thread's TLS with pointers 2019-06-23 20:21:22 -06:00
jD91mZM2
fe705d9b63 Switch to 2018 edition
Most of this was generated by the absolutely extraordinary `cargo fix`
subcommand. There were still 2 errors and a few warnings to patch up,
but compared to the normal 600+ errors, I'd say the fixer did a damn
good job! I'm also amazed that I could still start the VM after this,
I half expected some kinds of runtime failure...
2019-06-21 12:12:01 +02:00
Jeremy Soller
1be77c2ab4 Store sigmask 2019-06-02 18:45:06 -06:00
Jeremy Soller
fcd8ce7e1b Fix event logic for pipes 2019-04-28 13:32:24 -06:00
Jeremy Soller
afa3f38310 Allow seek in root scheme directory listings 2019-04-27 08:13:20 -06:00
Jeremy Soller
afab96fa06 Do not allow unreachable patterns (often a logic issue) 2019-04-27 08:10:49 -06:00
Jeremy Soller
eecc9a442c Fix missing name override option when calling fexec_kernel 2019-04-15 21:01:19 -06:00
Jeremy Soller
126009f83c Keep process name when using interpreter 2019-04-15 21:00:42 -06:00
Jeremy Soller
b66fef0479 Copy TCB if it was not initialized using kernel-allocated TLS 2019-04-15 20:47:27 -06:00
Jeremy Soller
6da3ab283e Clone grants 2019-04-15 20:47:03 -06:00
Jeremy Soller
dc198cef6e Keep track of leaked grants and allow for cloning of grants 2019-04-15 20:42:41 -06:00
Jeremy Soller
d432f7ce8c Add debugging for mprotect 2019-04-14 21:32:31 -06:00
Jeremy Soller
3a0671d20f Fix dropping grants without unmapping if they have no file descriptor (such as those from anonymous maps) 2019-04-14 19:23:23 -06:00
Jeremy Soller
339d68ac8d Remove debugging messages 2019-04-14 19:12:13 -06:00
Jeremy Soller
434e799f2a Place TCB at thread-specific location to avoid overlapping TCBs 2019-04-14 19:05:25 -06:00
Jeremy Soller
21e46b6a55 More cleanup of TLS mapping 2019-04-14 14:50:29 -06:00
Jeremy Soller
9762431a33 Cleanup TLS mapping 2019-04-13 22:00:27 -06:00
Jeremy Soller
8120131897 Add interpreter capability 2019-04-13 21:59:46 -06:00
Jeremy Soller
dc28023be1 Remove unnecessary clone 2019-04-13 21:58:34 -06:00
Jeremy Soller
58f9e5a801 0.1.54 - Add support for cache disable 2019-04-08 17:57:25 -06:00
Jeremy Soller
f042bd5d07 Update for new rust 2019-04-07 10:57:33 -06:00
Jeremy Soller
f36506613b Update funmap support 2019-04-06 20:13:55 -06:00
Noam Kleinburd
129d4e3ae5 Lock resources before checking if we need to clean them.
See the comments deleted by this commit for more details as to how
the race condition could effect the system.
2019-04-01 17:01:29 +03:00
Jeremy Soller
e5cf6efa64 Support specification of stack with clone system call and CLONE_STACK flag 2019-03-31 14:35:45 -06:00
Jeremy Soller
9ccaed7103 Remove bochs breakpoint in kernel 2019-03-31 08:36:55 -06:00
Jeremy Soller
d2095d8d0f Add in-memory logging, retrievable from sys:log 2019-03-17 09:31:34 -06:00