Saagar Jha
5c223f552f
Fix warnings
2020-11-11 00:27:44 -08:00
Theodore Dubois
d0b4ee9113
Implement CLOCK_REALTIME_COARSE for dig 9.15.6
...
Fixes #891
2020-10-24 11:12:20 -07:00
Theodore Dubois
9173dd65fd
Make getpgid less confusing
2020-10-11 20:13:18 -07:00
Saagar Jha
1d16949fae
Implement ptrace
2020-10-11 19:36:01 -07:00
Saagar Jha
91c4ff6d47
Fix getpgid
2020-10-11 12:21:37 -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
Saagar Jha
a9d70a1677
construct_task returns a pointer, not an integer
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
f0d770bef4
Handle ENOTSUP separately when it's different from EOPNOTSUPP
2020-08-23 13:54:36 -07:00
Theodore Dubois
93ab1bbfaa
Don't crash if the root can't be opened
...
#808
2020-07-06 16:29:58 -07:00
Theodore Dubois
6f6c26d232
Make sure brk doesn't clobber existing mappings
...
This was causing the random node segfaults. Node does manual ASLR, so it
would randomly pick an address for a memory mapping near the brk region,
then later something would raise the brk and clobber that mapping,
replacing it with zeroes. Shortly afterward something would crash on a
null pointer.
Took a lot of digging around in rr to find this. The crash is never
directly connected to the brk call, of course. I set a watchpoint on the
pointer that got clobbered and saw it had been zero since the page was
mapped, but it took setting a watchpoint on the pointer to that pointer
to find that when it was mapped before that and was valid at that point.
At this point I'm ready to say node is fixed! #90
2020-07-03 12:58:10 -07:00
Theodore Dubois
0032099894
Improve the debug dump functions
...
dump_maps doesn't overflow the buffer anymore. dump_stack lets you
specify how many lines of output you want.
2020-06-27 18:46:15 -07:00
Theodore Dubois
de8e84883a
Stub sched_getattr
...
Fixes #798
2020-06-27 18:46:15 -07:00
Theodore Dubois
18176b6931
Implement setre[ug]id
...
Fixes #770
2020-06-27 11:59:50 -07:00
Theodore Dubois
aef9e79d04
Fix UAF whenever FUTEX_REQUEUE is used
2020-06-25 19:24:52 -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
aa8810cb8f
Implement FIOCLEX/FIONCLEX
...
Node seems to use these archaic phrasings of CLOEXEC. This fixes the
Node inspector immediately closing any connections it gets. #90
2020-06-25 01:01:27 -07:00
Theodore Dubois
260931d714
Implement SA_RESETHAND_
...
Fixes ctrl-c sometimes sending Node's signal handler into an infinite
loop. #90
2020-06-25 00:42:06 -07:00
Theodore Dubois
f7ecc41f65
Implement FUTEX_REQUEUE
...
Fixes #472 and node hanging on exit (#90 )
2020-06-25 00:17:22 -07:00
Theodore Dubois
68e599e5f7
Merge pull request #782 from saagarjha/master
...
Handle zero-length mmaps correctly
2020-06-17 22:46:08 -07:00
Theodore Dubois
a7c910761a
Add filesystem management
...
#695
2020-06-17 10:04:03 -07:00
Saagar Jha
0754471d2d
Handle zero-length mmaps correctly
2020-06-15 19:16:54 -07:00
Theodore Dubois
95dc3f5290
Add a dump_maps function similar to dump_stack
2020-06-13 10:08:42 -07:00
Theodore Dubois
023d692f58
Better handle unknown errors
...
They now get logged instead of causing a crash. The program seeing the
error might even print the error number if we're lucky.
2020-06-13 10:03:48 -07:00
Theodore Dubois
640017278e
Fix locking issues with CPU refactor
...
There was a deadlock when cpu_run called cpu_step_to_interrupt with mem
read-locked, and it would write-lock mem to clean up jetsam.
2020-06-09 00:35:53 -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
Saagar Jha
5557974dc5
Add more debugging checks for improper locking
2020-06-06 23:52:12 -07:00
Theodore Dubois
b7ea9ff58b
Implement timer_delete
...
#687
2020-06-05 20:52:19 -07:00
Theodore Dubois
d75abc611f
Stub splice()
...
I was running ./configure for https://github.com/redneb/ghc-alt-libc and
spotted a bad syscall in the linker, this was an easy fix
2020-06-05 20:52:05 -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
e846501d12
Fix some warnings seen on Travis
2020-05-30 20:23:04 -07:00
Theodore Dubois
6ae017062c
Squash a ton of warnings, including with gcc
2020-05-30 17:31:55 -07:00
Theodore Dubois
fcb0599aa5
Squash some warnings
...
arch_prctl was never useful for anything, _GNU_SOURCE is needed for
pthread_setname_np, no one uses vdso-transplant so it's cool with being
exploited through argv, I'll get to tmpfs_umount one day
2020-05-30 14:41:11 -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
Saagar Jha
c68e5ecf78
Fix some locking
2020-05-26 21:06:42 -07:00
Theodore Dubois
f5db347ac3
Hack around Darwin sometimes returning POLLPRI on pipes
...
elinks would call select(), assume from the result that some internal
pipe had closed, and just exit.
2020-05-22 22:30:50 -07:00
Theodore Dubois
186335f8ab
Stub ioprio_{get,set}
...
#721
2020-05-22 20:41:00 -07:00
Theodore Dubois
f38d232756
Implement edge-triggered epoll
...
#698
2020-05-22 20:18:34 -07:00
Theodore Dubois
3795b289a5
Implement timer_create and timer_settime
...
Fixes #707
2020-05-10 12:12:47 -07:00
Theodore Dubois
2fcbb62899
Limit the length of execve logs
2020-05-10 12:12:47 -07:00
Theodore Dubois
6075b01e3d
Handle timeout values that are valid on Linux but valid on Mac
...
Fixes emacs #711
2020-05-09 10:49:31 -07:00
Theodore Dubois
c40ded9d4e
Fix wait4(WNOHANG) returning garbage instead of 0
...
This broke running shell commands in the background with &.
2020-05-04 00:08:29 -07:00
Theodore Dubois
d5de7ad218
Implement waitid
...
Go uses waitid with WNOWAIT to wait for child processes.
For #57
2020-05-03 18:31:28 -07:00
Theodore Dubois
f52386d205
Add strace for fchmod, fchown, and select results
2020-04-22 10:28:55 -07:00
Theodore Dubois
961140a1cc
Add forgotten string.h include
2020-04-18 20:33:30 -07:00
Theodore Dubois
222aeafb63
Use the tty lock to increment the tty refcount when forking
...
Found from a tsan report.
2020-04-18 20:30:58 -07:00
Theodore Dubois
8c99957d4b
Catch errors from pthread_rwlock functions
...
Also fix an error that happened when initializing the new lock from
mm_copy.
Found when git clone over ssh started crashing for no apparent reason.
2020-04-18 20:30:58 -07:00