545 Commits

Author SHA1 Message Date
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
Saagar Jha
955d653b19 Replace read lock with write lock in mm_copy 2020-01-09 23:59:37 -08:00
Theodore Dubois
8d005b114c Stub readahead
Fix #605
2020-01-05 11:13:28 -08:00
Theodore Dubois
8ff84f2ae3 Handle different clock IDs in timerfd_create
Also handle TFD_TIMER_ABSTIME in timerfd_settime.

Fix #591
2020-01-03 20:13:17 -08:00
Theodore Dubois
b9e249b73f Unbreak heap shrink case of brk
Apparently this line of code has never been executed before, because if
it ever were to be executed, you'd get memory corruption.
2020-01-03 19:28:25 -08:00
Theodore Dubois
dd8d3fb9d1 Fix race condition in mem_segv_reason
There's a brief delay between the page fault and calling
mem_segv_reason, and in that window the access could become valid.
2020-01-01 19:36:28 -08:00
Theodore Dubois
7442f2327b Remove obsolete TODO for utime 2019-12-30 00:10:26 -08:00
Theodore Dubois
dbc77285b8 Remove follow_links argument of fd_ops.stat
Only realfs was using it, and it wasn't really necessary there since
path_normalize already followed the last symlink if needed.
2019-12-29 14:18:26 -08:00
Theodore Dubois
1dfb9eba78 Log the select() timeout 2019-12-28 16:57:46 -08:00
Theodore Dubois
be0312e7d8 Reduce overhead in user_read and user_write
Now memcpys an entire page at a time instead of just one byte at time,
skipping most of the calls to mem_ptr. This significantly speeds up
x11vnc because it sends a lot of big buffers over sockets.
2019-12-24 17:55:31 -08:00
Theodore Dubois
7d922884f6 Implement sched_get_priority_max
Close #436
2019-12-22 20:28:14 -08:00
Theodore Dubois
4056571cec Print return of clock_gettime in strace 2019-12-22 19:43:07 -08:00
Theodore Dubois
8579c95a5a Actually use the specified timeout in futex_wait
Fixes #573
2019-12-22 19:22:32 -08:00
Theodore Dubois
4b72c9cb05 Fix kill with process groups 2019-12-22 13:02:01 -08:00
Theodore Dubois
ec756ea38d Don't use the altstack if we're already on the altstack
Fix #583
2019-12-22 11:16:37 -08:00
Theodore Dubois
757f0a6b9d Stub io_setup 2019-12-15 19:12:58 -08: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
07997dc952 Include the version and build numbers in uname -v
Fixed #250
2019-11-25 20:31:13 -08:00
Theodore Dubois
780eeb5489 Allow any negative timeout for epoll and poll to mean infinite
Fixed #571
2019-11-25 17:49:55 -08:00
Theodore Dubois
3eaedbb935 Add some scheduler API stubs
#461
2019-11-25 15:51:12 -08:00