Age | Commit message (Collapse) | Author |
|
|
|
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
|
|
This error code was a hack for catching error handling mistakes in the
kernel. It's no longer used anywhere.
|
|
|
|
The actual length of the resulting string is encoded in the return
value; treating the entire buffer as a string leads to reading
uninitialized memory.
|
|
This feature was introduced in version 4.17 of the Linux kernel, and
while it's not specified by POSIX, I think it will be a nice addition to
our system.
MAP_FIXED_NOREPLACE provides a less error-prone alternative to
MAP_FIXED: while regular fixed mappings would cause any intersecting
ranges to be unmapped, MAP_FIXED_NOREPLACE returns EEXIST instead. This
ensures that we don't corrupt our process's address space if something
is already at the requested address.
Note that the more portable way to do this is to use regular
MAP_ANONYMOUS, and check afterwards whether the returned address matches
what we wanted. This, however, has a large performance impact on
programs like Wine which try to reserve large portions of the address
space at once, as the non-matching addresses have to be unmapped
separately.
|
|
|
|
|
|
|
|
In particular, strace can now stomach memory errors while copying
invalid strings.
Example with a valid string:
dbgputstr("95.976 traceme(38:38) Well, Hello Friends!") = 55
Example with an invalid string:
dbgputstr(Error(errno=14){0x00012345, 678b}) = -14 EFAULT
(ANSI escapes removed for readability.)
|
|
This necessarily introduces some usages (and benefits!) of the new
ErrorOr<> pattern. To keep commits atomic, I do not yet rewrite the
entire program to use ErrorOr<> correctly.
|
|
These are required to compile a port.
|
|
|
|
|
|
|
|
|
|
This isn't a complete conversion to ErrorOr<void>, but a good chunk.
The end goal here is to propagate buffer allocation failures to the
caller, and allow the use of TRY() with formatting functions.
|
|
|
|
In particular, strace now supports all O_*, MSG_*, MAP_*, and PROT_*
flags, as well as a more context-dependent default value (e.g.
"PROT_NONE").
|
|
|
|
|
|
We create a base class called GenericFramebufferDevice, which defines
all the virtual functions that must be implemented by a
FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other
FramebufferDevice implementations inherit from it.
The most important consequence of rearranging the classes is that we now
have one IOCTL method, so all drivers should be committed to not
override the IOCTL method or make their own IOCTLs of FramebufferDevice.
All graphical IOCTLs are known to all FramebufferDevices, and it's up to
the specific implementation whether to support them or discard them (so
we require extensive usage of KResult and KResultOr, together with
virtual characteristic functions).
As a result, the interface is much cleaner and understandable to read.
|
|
By default strace outputs all system calls the monitored process
invokes, but it's sometimes useful to either exclude some calls, or to
include only some others.
This commit adds two new command line options to specify two
exclusion/inclusion command-delimited lists of system calls. These are
then used to decide if an intercepted system call should be displayed in
the output or not.
|
|
|
|
All these take no arguments so there's no formatting to be done.
|
|
|
|
This is useful in general, but adding it is what finally helped
uncovering #10438.
|
|
|
|
These are exit, realpath and getrandom. This required a bit of extra
infrastructure to deal with exit's void return type.
|
|
These include mmap, munmap, mprotect and mmap_set_name.
|
|
The formatting of these functions is not complete, but gives already
very good information to the user.
|
|
This commit introduces the main infrastructure used for turning register
values into user-facing values that can be printed by strace. This
includes the ability to copy data from a particular memory address in
the traced process. On top of this, (partial) formatting has been added
for the most common I/O operations (open, read, write, lseek, close,
stat, fstat).
|
|
Moving the formatting of strace's output into a separate function will
allow us to introduce more complexity into the formatting logic without
touching the main body of the program.
The new function uses a switch statement to select how to format the
arguments and result depending on the syscall. At this point we only
include the default formatting, where the registers are simply dumped,
but later on we can add specializations for each system call we want to
support.
|
|
We're using software context switches so calling this struct tss is
somewhat misleading.
|
|
|
|
|
|
Also convert outln(stderr, ...) to warnln(...)
|
|
...and make it an enum class so people don't omit "OpenMode".
|
|
Fixes #7014.
|
|
There are no other clients of this weird API, so let's get rid of it.
Now that we call IODevice::write() instead, we can also handle errors.
|
|
...while we open the output file.
|
|
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
|
|
Good-bye LogStream. Long live AK::Format!
|
|
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)
Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.
We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
|
|
This achieves two things:
- Programs can now intentionally perform arbitrary syscalls by calling
syscall(). This allows us to work on things like syscall fuzzing.
- It restricts the ability of userspace to make syscalls to a single
4KB page of code. In order to call the kernel directly, an attacker
must now locate this page and call through it.
|
|
|