Brendan Coles
9ca34c3047
UserspaceEmulator: Implement profiling, disown, purge syscalls
2020-12-21 09:57:51 +01:00
Andreas Kling
71d92cef17
UserspaceEmulator: Add lazy caching of debug info for shared libraries
...
Keep the debug symbols for shared libraries in memory after we opened
them the first time. This dramatically speeds up symbolication of
backtraces when running dynamically linked programs in UE.
2020-12-20 15:45:39 +01:00
Brendan Coles
c8fb00fe4d
UserspaceEmulator: Implement geteuid, getegid, ptsname syscalls
2020-12-17 00:02:03 +01:00
Brendan Coles
a46e48089d
UserspaceEmulator: Implement beep syscall
2020-12-16 17:27:20 +01:00
Itamar
72ca45e300
UserspaceEmulator: Support dynamically loaded programs
...
When loading dynamic objects, the emulator loads the interpreter,
generates an auxiliary vector and starts executing the loader.
Additionally, this commits also makes the MallocTracer and backtrace
symbolication work for dynamically loaded programs.
2020-12-14 23:05:53 +01:00
Ben Wiederhake
809a8ee693
UserspaceEmulator: Implement readlink syscall
2020-12-08 09:37:30 +01:00
Simon Danner
751e759be2
UserspaceEmulator: Implement clock_nanosleep
2020-11-23 18:41:42 +01:00
Simon Danner
09b095e62a
UserspaceEmulator: Add support for watch_file
2020-11-22 10:53:58 +01:00
Andreas Kling
da413a464a
UserspaceEmulator: Inline some very hot functions
...
This improves the browser's load time on welcome.html by ~2%.
2020-11-19 21:46:01 +01:00
Andreas Kling
ae81ced21c
UserspaceEmulator: Emulate the sys$get_stack_bounds() syscall
2020-11-13 11:05:46 +01:00
Andreas Kling
013c7ccd73
UserspaceEmulator: Don't audit accesses within realloc(), malloc_size()
...
These functions access malloc-related memory outside of UE's accounting
boundaries, so just ignore them.
2020-11-08 01:15:02 +01:00
AnotherTest
290e7957b7
UserspaceEmulator: Add support for setsid
2020-10-25 10:13:03 +01:00
AnotherTest
fcc38422c6
UserspaceEmulator: Add support for set_thread_name
...
It should be noted that creating threads is still not supported.
2020-10-25 10:13:03 +01:00
AnotherTest
617c5ba045
UserspaceEmulator: Add support for fchown
2020-10-25 10:13:03 +01:00
AnotherTest
41aa78f6de
UserspaceEmulator: Add support for chmod
2020-10-25 10:13:03 +01:00
AnotherTest
b1d36243e5
UserspaceEmulator: Add support for setgroups
2020-10-25 10:13:03 +01:00
AnotherTest
457e00f319
UserspaceEmulator: Add support for sched_(g s)etparam
2020-10-25 10:13:03 +01:00
AnotherTest
aee0df19c1
UserspaceEmulator: Add support for emulating SC_mount
2020-10-25 10:13:03 +01:00
AnotherTest
9afe9069a9
UserspaceEmulator: Optionally write reports to the debug log
...
...and take a flag '--report-to-debug' that determines this behaviour.
2020-10-25 10:13:03 +01:00
asynts
e089855af0
UserspaceEmulator: Remove remaining printf calls.
2020-10-04 17:04:55 +02:00
Andreas Kling
709581e141
UserspaceEmulator: Implement the getsid() syscall
2020-09-28 23:34:55 +02:00
Nico Weber
b36a2d6686
Kernel+LibC+UserspaceEmulator: Mostly add recvmsg(), sendmsg()
...
The implementation only supports a single iovec for now.
Some might say having more than one iovec is the main point of
recvmsg() and sendmsg(), but I'm interested in the control message
bits.
2020-09-17 17:23:01 +02:00
Nico Weber
f0018aca1d
UserspaceEmulator: Intercept sendto()
...
With this, `ue /bin/ntpquery` can be used to test sendto() and
recvfrom() in ue. (It eventually hits an unimplemented FILD_RM64,
but not before doing emulated network i/o and printing response
details.)
2020-09-15 23:29:51 +02:00
Andreas Kling
57dd3b66c5
Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()
...
This doesn't need to be its own syscall either. :^)
2020-08-30 13:21:24 +02:00
Andreas Kling
f857f3ce4c
Kernel+LibC+UE: Implement usleep() via sys$clock_nanosleep()
...
This doesn't need to be its own syscall. Thanks @BenWiederhake for
the idea. :^)
2020-08-30 10:45:51 +02:00
Luke
694b86a4bf
LibDebug: Move everything into the "Debug" namespace
2020-08-25 09:46:06 +02:00
Andreas Kling
65f2270232
Kernel+LibC+UserspaceEmulator: Bring back sys$dup2()
...
This is racy in userspace and non-racy in kernelspace so let's keep
it in kernelspace.
The behavior change where CLOEXEC is preserved when dup2() is called
with (old_fd == new_fd) was good though, let's keep that.
2020-08-15 11:11:34 +02:00
Andreas Kling
bf247fb45f
Kernel+LibC+UserspaceEmulator: Remove sys$dup() and sys$dup2()
...
We can just implement these in userspace, so yay two less syscalls!
2020-08-15 01:30:22 +02:00
Andreas Kling
fae9c9f81f
UserspaceEmulator: Add the dup2 syscall
2020-08-07 18:46:56 +02:00
Andreas Kling
5dce5fa7c2
UserspaceEmulator: Add the chdir syscall
2020-08-07 18:44:51 +02:00
Andreas Kling
5a5b687014
UserspaceEmulator: Add the getpgid() and waitid() syscalls
...
With this, you can now kinda sorta run the shell in UserspaceEmulator!
2020-08-07 16:51:08 +02:00
Andreas Kling
93b1e54237
UserspaceEmulator: Add the setpgid syscall
2020-08-07 16:34:50 +02:00
Andreas Kling
e0e3e5b9b1
UserspaceEmulator: Add the access syscall
2020-08-05 22:34:50 +02:00
Andreas Kling
c497603177
UserspaceEmulator: Add the getcwd syscall
2020-08-05 22:34:50 +02:00
Andreas Kling
b187a42e53
UserspaceEmulator: Add the ttyname syscall
2020-08-05 22:34:50 +02:00
Andreas Kling
3717a00290
UserspaceEmulator: Add the getpgrp syscall
2020-08-05 22:34:50 +02:00
Andreas Kling
8dea25d974
UserspaceEmulator: Add support for UNIX signals :^)
...
The emulator will now register signal handlers for all possible signals
and act as a translation layer between the kernel and the emulated
process.
To get an accurate simulation of signal handling, we duplicate the same
trampoline mechanism used by the kernel's signal delivery system, and
also use the "sigreturn" syscall to return from a signal handler.
Signal masking is not fully implemented yet, but this is pretty cool!
2020-08-05 22:34:50 +02:00
Andreas Kling
c7e4c0734b
UserspaceEmulator: Use a report() function instead of dbgprintf()
...
Ultimately we'll want to make it a bit easier to add more reporting.
This at least makes it easier to redirect the logging.
2020-07-31 20:56:48 +02:00
Andreas Kling
b8d3dbcf2d
UserspaceEmulator: Add syscalls: stat(), realpath(), gethostname()
...
This is enough to run /bin/ls :^)
2020-07-28 00:03:25 +02:00
Andreas Kling
0b287c18b9
UserspaceEmulator: Implement the execve() syscall :^)
...
This virtual syscall works by exec'ing the UserspaceEmulator itself,
with the emulated program's provided arguments as the arguments to the
new UserspaceEmulator instance.
This means that we "follow" exec'ed programs and emulate them as well.
In the future we might want to make this an opt-in (or opt-out, idk)
behavior, but for now it's what we do.
This is really quite cool, I think! :^)
2020-07-27 19:10:18 +02:00
Andreas Kling
b9b74e355a
UserspaceEmulator: Implement the fork() syscall :^)
2020-07-27 19:10:18 +02:00
Andreas Kling
d9f933df7b
UserspaceEmulator: Implement the setuid() and setgid() syscalls
...
Note that running a setuid program (e.g /bin/ping) in UE does not
actually run uid=0. You'll have to run UE itself as uid=0 if you want
to test programs that do setuid/setgid.
2020-07-27 16:32:30 +02:00
Andreas Kling
368cea4094
UserspaceEmulator: Implement the accept() and setsockopt() syscalls
...
It's now possible to run LookupServer in UE (by setting up SystemServer
to run the service inside UE.) No bugs found, but very cool! :^)
2020-07-27 16:28:40 +02:00
Andreas Kling
f097ed6ada
UserspaceEmulator: Transfer the environment to the emulated process
2020-07-27 15:57:12 +02:00
Andreas Kling
0f91dfa139
UserspaceEmulator: Show file and line numbers in backtraces :^)
...
This was super easy thanks to the awesome LibDebug work by @itamar8910!
2020-07-21 19:08:01 +02:00
Andreas Kling
a49c794725
UserspaceEmulator: Add the get_dir_entries() syscall + an ioctl() stub
2020-07-18 17:57:40 +02:00
Andreas Kling
b17d175379
UserspaceEmulator: Add the usleep() syscall
2020-07-16 21:38:01 +02:00
Andreas Kling
441918be7e
UserspaceEmulator: Capture backtraces of malloc/free events
...
This lets us show backtraces for each leaked mallocation in the leak
report at the end. :^)
2020-07-16 19:21:45 +02:00
Andreas Kling
67cdbe1925
UserspaceEmulator: Cache the location and size of "malloc" and "free"
...
This allows us to quickly skip some auditing checks while we're inside
malloc/free themselves.
2020-07-16 00:24:11 +02:00
Andreas Kling
33e3e8d63d
UserspaceEmulator: Add the getrandom() syscall
2020-07-15 23:44:51 +02:00