68 Commits

Author SHA1 Message Date
Theodore Dubois
c40dff7d15 Fix race between execve and procfs
task->mm may be released and replaced by execve while another thread
uses it to read memory using procfs.

Fixes #1102
2020-12-18 14:56:24 -08:00
Saagar Jha
1d16949fae Implement ptrace 2020-10-11 19:36:01 -07:00
Saagar Jha
8790395b42 Support /proc/pid/auxv 2020-10-11 12:21:37 -07:00
Saagar Jha
bf1603ef2b Put the task pid in the thread name 2020-10-11 12:21:37 -07:00
Theodore Dubois
b57311c3f2 Delete accidental printks 2020-10-10 14:17:29 -07:00
Theodore Dubois
3fee07f618 Make sure the tlb doesn't have an outdated mem pointer 2020-10-10 14:13:05 -07:00
Theodore Dubois
d9695adac6 Allow NULL for envp in execve
Do not take advantage of this nonstandard and nonportable misfeature!
- Michael Kerrisk, execve(2)

Fixes #799
2020-06-25 01:09:21 -07:00
Theodore Dubois
b3f5b9c51a Don't forget to free buffers in the common case of execve 2020-06-07 15:11:55 -07:00
Theodore Dubois
e3c1346586 Squash some GCC warnings that only appear when compiling with optimization 2020-05-30 21:43:15 -07:00
Theodore Dubois
946f9ec598 Some ptraceomatic improvements
Moved some ptraceomatic-satisfying constants to a header, add
sigaltstack
2020-05-30 14:35:12 -07:00
Saagar Jha
a7ba808a76 Name forked tasks 2020-05-26 21:06:46 -07:00
Theodore Dubois
2fcbb62899 Limit the length of execve logs 2020-05-10 12:12:47 -07:00
Theodore Dubois
3cc5ca1d45 Separate args and env in execve logging 2019-11-26 13:38:45 -08:00
Theodore Dubois
996a4b6cbf Add locking around mapping changes in mem_ptr
Fixed #104
2019-11-26 13:05:28 -08:00
Theodore Dubois
dd8e656e98 Refactor execve again to allow empty arguments
Fixed #559
2019-11-17 19:58:10 -08:00
Theodore Dubois
fa2dd142b8 Include starting value of stack in /proc/pid/stat
Helps with #306
2019-11-16 19:57:03 -08:00
Theodore Dubois
2b750f60ac Implement /proc/pid/maps 2019-11-11 01:28:26 -08:00
Theodore Dubois
3925a40201 Increase argv length limit
Fixed #375
2019-11-02 18:00:48 -07:00
Theodore Dubois
32c5046e7c Try to fix memory leaks from mapping files on iOS 2019-08-24 15:13:04 -07:00
Theodore Dubois
ed67d8b8ba VDSO related fixes for ptraceomatic 2019-05-12 09:11:59 -07:00
Theodore Dubois
894c3d2af5 Make the whole boot system thing happen 2019-05-04 23:32:24 -07:00
Theodore Dubois
9f4dd9204c Zero out registers in exec 2019-04-27 16:48:45 -07:00
Theodore Dubois
33fbd2dfd1 Unbreak shebang argument passing 2019-02-09 09:43:16 -08:00
Theodore Dubois
c3217ca7d1 Revolutionize E2BIG 2019-02-07 23:42:30 -08:00
Theodore Dubois
8c5c694693 Fix execve with 256 arguments 2019-02-01 17:37:33 -08:00
Theodore Dubois
f784c6db2d Prevent buffer overflow when debug logging a very long argument list 2019-02-01 17:30:47 -08:00
Theodore Dubois
22b0b0e5f0 Load shared libraries with no interpreter into mmap region 2019-01-31 22:40:03 -08:00
Theodore Dubois
141c201cf3 Use pthread_setname_np to make threads easier to identify in a debugger 2019-01-23 16:52:21 -08:00
Theodore Dubois
f658d6335b Limit the size of logged execve arguments 2019-01-11 16:58:35 -05:00
Theodore Dubois
a0d2a12f3b Implement /proc/pid/cmdline and /proc/pid/exe 2019-01-04 18:53:17 -08:00
Theodore Dubois
5cfec48854 Separate out some components of struct mem into struct mm 2019-01-04 15:17:37 -08:00
Theodore Dubois
137e1a2814 Overhaul fdtable implementation to add locking 2019-01-02 21:50:25 -08:00
Theodore Dubois
97756cb34c Save the euid/egid when executing a setuid/setgid program 2019-01-02 19:21:25 -08:00
Theodore Dubois
1da3faacd4 Handle setuid and setgid programs 2019-01-02 18:58:16 -08:00
Theodore Dubois
14d30a35df Fix potential UAF when handling CLONE_VFORK 2018-12-31 17:29:36 -08:00
Theodore Dubois
87adcbc176 Handle errors in opening a shell script interpreter 2018-12-30 20:28:11 -08:00
Theodore Dubois
377aa9056e Save the name of the program in the task struct 2018-12-24 23:12:19 -08:00
Theodore Dubois
da27277989 Don't crash the app on RNG failure 2018-12-24 12:02:31 -08:00
Theodore Dubois
c3e076a44f Fix segfault when there's an error opening the interpreter 2018-12-07 15:52:18 -08:00
Theodore Dubois
3b4c71f662 Add function to report error and crash 2018-11-29 16:18:18 -08:00
Theodore Dubois
c158cefd16 Fix leak of interp_fd 2018-11-16 16:32:50 -08:00
Theodore Dubois
7659e0861d Return ENOEXEC when an executable is too short 2018-11-15 15:37:02 -08:00
Theodore Dubois
9a3a89252d Fully implement setpgid 2018-11-11 14:40:05 -08:00
Theodore Dubois
928fc7eed0 Add missing locking for vfork exec 2018-11-09 13:02:46 -08:00
Theodore Dubois
aff0e868b0 fixup! Make various memory management things shared between threads 2018-10-07 13:47:01 -07:00
Theodore Dubois
4a8efe8d01 Make various memory management things shared between threads 2018-10-07 13:02:15 -07:00
Theodore Dubois
fd7d640abd Fix a bunch of issues reported by static analyzers 2018-10-01 11:02:10 -07:00
Theodore Dubois
2f16b25413 Implement sigaltstack 2018-09-28 11:16:47 -07:00
Theodore Dubois
e4df2ff817 Return errors from execve 2018-09-24 13:06:38 -07:00
Theodore Dubois
2ee6cafa94 Add flag checking to unicornomatic 2018-08-19 00:22:48 +00:00