629 Commits

Author SHA1 Message Date
Theodore Dubois
a3f58a23ae Move emu/memory.[ch] to kernel/
A long time ago, for linux, emu and kernel were separated into separate
library targets, but for some reason memory.c was kept in emu/ despite
only being linked into kernel. Now's a good time to move it where it
belongs.
2024-11-07 21:38:17 -08:00
Theodore Dubois
e7ba8f306f Add real implementation of statx
Fixes #2418
2024-10-20 18:24:12 -07:00
Theodore Dubois
9830c547a3 Explicitly stub some syscalls used by new versions of alpine 2024-10-19 22:40:52 -07:00
Theodore Dubois
fc4ee06a6d Ignore negative FD numbers passed to poll()
Fixes #2401
2024-10-19 22:39:59 -07:00
tbodt
75f77fe1a6
Inline the important contents of twitter links 2024-10-19 20:21:17 -07:00
John Hood
6e5cdaff5f Shutdown more cleanly when init dies.
Using SIGKILL on iSh itself was never going to end well.  :)
2024-05-13 01:41:03 -04:00
John Hood
ebaba89e11 Add another very simple log destination-- fprintf to stderr 2024-05-11 12:55:32 -04:00
John Hood
5b10c751e1 Fix timeout bug in pselect().
select() takes a timeval, but pselect() takes a timespec, So large
nanosecond fractions were getting passed as microseconds to select()
and causing havoc.  An earlier fix for Emacs somewhat limited the
damage by converting excessively large microsecond values into a +1s
increment.
2024-03-09 07:17:43 -05:00
John Hood
cd29315fe4 Add support for kprintf via syslog() and MacOS os_log().
This seems moderately successful, I was able to get logging out of the
CLI build with syslog().  I may marely have been having trouble with
logging on my Mac.
2024-03-09 06:39:00 -05:00
John Hood
eea6921f26 Move convert_time{spec,val} to time.h 2024-03-09 06:39:00 -05:00
Saagar Jha
f8a7e44ccf Use ENOSYS for suscalls in lieu of sending SIGSYS 2023-10-29 01:19:00 -07:00
Theodore Dubois
3d3f41e27f Dump stacl in sigill and sigsegv diagnostics 2023-05-04 20:48:42 -07:00
Theodore Dubois
fac779486c Silence membarrier stub 2023-05-04 18:58:58 -07:00
Theodore Dubois
a17fe7c02b Unlock sighand->lock on all codepaths of rt_sigtimedwait 2023-05-02 21:56:05 -07:00
Theodore Dubois
c99cb7b01b Implement SIGEV_THREAD_ID 2023-05-02 21:55:49 -07:00
Saagar Jha
7be7e0d9b7 Replace chatty syscall stubs with silent variant
These syscalls have fallbacks in musl which we do implement but they are
only invoked after they return ENOSYS, which fills dmesg with lots of
spam.
2022-10-23 19:15:02 -07:00
Theodore Dubois
6da3e79fc3 Return the number of bytes written from sched_getaffinity
37e18b7bf3/src/sched/affinity.c (L21)
2022-09-03 10:19:05 -07:00
Saagar Jha
8900a4927f Expose ptrace-assisted writes 2022-08-23 20:08:19 -07:00
Theodore Dubois
85d565f55d Properly handle an invalid pid passed to setpgid 2022-02-27 16:13:56 -08:00
Theodore Dubois
3bc308a435 Fix deadlock in emulator between mem->lock and jetsam_lock 2022-02-27 16:13:46 -08:00
Theodore Dubois
59f1a763d1 Fix crash when trying to kill a task in the middle of exiting 2022-01-30 11:23:16 -08:00
Mike Miller
012a72b394 Print the process name as well as the pid when informing about 'stub syscall'
Remove spurious blank line

Cleanup commit history

One more try to clean up the commit history

Treat missing syscalls the same as stubbed one for logging

Treat missing syscalls the same as stubbed ones
2022-01-03 15:20:41 -08:00
Theodore Dubois
33279d5e38 Fix infinite loop in sigtimedwait 2021-12-13 19:59:30 -08:00
Theodore Dubois
e737c8fd7f Achieve terminal output 2021-09-05 10:00:47 -07:00
Theodore Dubois
6a265001ff
Merge pull request #1527 from ish-app/linux 2021-08-15 10:13:55 -07:00
GuanZhang
7d09643aee Stub missing syscall 364, also added comment for syscall 383
This fixes #1324 on master which is currently running alpinelinux v3.14
2021-06-29 12:18:57 +09:00
Theodore Dubois
f2054ad900 Split out a bit of fakefs 2021-06-27 09:52:24 -07:00
Saagar Jha
cb89be5259 Stub faccessat2
This fixes #1471.
2021-06-27 00:44:45 -07:00
Theodore Dubois
6856314381 Make sure new threads start with a clear TLB
Previously tlb_refresh would compare the specified MMU with the
uninitialized garbage value. If a new process is started and reuses
enough things (host stack, memory pointer) it will also reuse the old
garbage TLB entries and thus summon nasal demons.
2021-06-14 22:13:55 -07:00
Theodore Dubois
31117299fb Fix symbol clash with Linux's printk 2020-12-20 16:35:23 -08:00
Theodore Dubois
093041a882 Make it possible to include emu/jit.h in the kernel 2020-12-20 16:35:23 -08:00
Theodore Dubois
9bc2afb30e Refactor for linux 2020-12-20 16:35:22 -08:00
Theodore Dubois
6bf0c62e4a Automate taking app store screenshots
It works sometimes, at least
2020-12-19 18:16:07 -08:00
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
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