565 Commits

Author SHA1 Message Date
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
Theodore Dubois
103257ccca Make sure all callers of wait_for check the return value
If you don't and you get a signal and ignore the _EINTR, you'll just
spin at 100% CPU. SSH with a control master (used by git annex) appears
to hit this with the unix_got_peer wait.
2020-04-18 20:30:45 -07:00
Theodore Dubois
95f6413813 Guard against zombie tasks in /proc/pid files
Found this while trying to fix git annex. If you interrupt it while it
tries to run ssh using a control master, the init process will die and
then hang during the exit process trying to close its FDs. If you then
run ps, as I did, you get an asan report in proc_pid_stat_show because
task->mm is bad.
2020-04-18 20:02:45 -07:00
Theodore Dubois
5208523924 Fix using the wrong constants for kevent generation 2020-04-12 22:31:06 -07:00
Theodore Dubois
16f1bdee13 Make timerfd_read interruptible 2020-04-12 20:06:23 -07:00
Theodore Dubois
33ea7c8327 Make iosfs unsafe into a mount option 2020-04-12 17:07:47 -07:00
Theodore Dubois
7d58fc8186 Bug fixes and performance improvements 2020-04-12 14:42:06 -07:00
Theodore Dubois
a3e0e9f104 Move realfs functions to fs/real.h 2020-04-12 13:18:41 -07:00
Theodore Dubois
1452a7f70b Dynamically register iOS filesystem 2020-04-12 13:18:41 -07:00
NoahPeeters
68340acd03 Add support for mounting folders from iOS 2020-04-12 13:18:41 -07:00
Theodore Dubois
c1ab200b20 Fix buffer overflow in getgroups 2020-04-11 21:19:37 -07:00
Theodore Dubois
806d1f1a92 Make getgroups(2) actually work
Fixes #660
2020-04-11 19:11:52 -07:00
Theodore Dubois
cedb971dc8 Improve strace logging for poll() 2020-04-11 14:04:30 -07:00
Theodore Dubois
19e7bbd8ec Log using writev instead of dprintf
Makes host strace less noisy.
2020-04-11 13:55:12 -07:00
Theodore Dubois
5b5eca2935 Implement epoll one-shot
Also refactors select/poll/epoll to be implemented on top of
kqueue/epoll instead of poll, for some reason.
2020-04-11 13:54:34 -07:00
Theodore Dubois
93a733b9f5 Make vectorized read/write atomic
This is done by flatting the vector into a malloc buffer, which is
clearly not the best way of doing it, but that's hard to notice over the
inefficiency of the emulator.

Fixes #364
2020-04-06 11:10:44 -07:00
Theodore Dubois
b2dc56fcd8 Waste a weekend fixing other people's broken code
This commit is sponsored by Linode. You can use code ish2020 get $20
off your new account. That could be 4 months free on the $5/month plan!
2020-03-08 16:50:03 -07:00
Saagar Jha
ab850b9768 This was unstaged and I think it fixes something 2020-03-08 16:48:15 -07:00
Saagar Jha
cd2cff1c04 Prevent NUM_SIGS from touching sig_set_ 2020-03-08 23:02:09 +00:00
Saagar Jha
0e642a0995 Prevent signed overflow by using qword_t 2020-03-08 23:02:09 +00:00
Saagar Jha
b33cbacb59 Fix pread/pwrite; make read/write be optional
pread and pwrite have been fixed to return the correct (unchanged) offset. In
addition, both functions have been added to fd_ops and sys_read and sys_write
will use these if they are available; making them (fd_ops's read/write)
effectively optional if there is an implementation of pread and pwrite
available. lseek is no longer optional.
2020-03-08 23:02:09 +00:00
Brian Almeida
910bbc398c Fix lockfile flag checks 2020-02-26 06:52:42 -05:00
Theodore Dubois
dcb19ff33a Don't remove a zombie from its pgroup or session before it's reaped 2020-02-17 13:11:06 -08:00
Theodore Dubois
823647b5a4 Implement read parts of tmpfs 2020-02-17 13:10:03 -08:00
Christopher Albert
4b0c89699c Correct return type for sys_personality 2020-02-17 20:59:41 +01:00
Christopher Albert
e223d8ef50 Correct error code for sys_personality 2020-02-17 20:55:01 +01:00
Christopher Albert
dfb9f66611 Add syscall 136 personality 2020-02-17 15:45:27 +01:00
Theodore Dubois
e17b822519 Make most fs_ops optional, and mark the required ones 2020-02-03 00:43:54 -08:00
Theodore Dubois
6b5a14850c Implement mknodat 2020-02-02 22:35:58 -08:00
Theodore Dubois
0a01c66563 Implement FIONREAD for real files and sockets
Fixes #607
2020-01-20 11:26:12 -08:00
Theodore Dubois
804e38705d Hide noisy EPOLLET log
Issue #608 had so many of those that it was impossible to see anything
else.
2020-01-19 21:51:07 -08:00