Commit graph

10 commits

Author SHA1 Message Date
Andreas Kling 21a5fb0fa2 LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo().

Since LibCore builds on other systems than SerenityOS, we now have to
make sure that wrappers work with just a standard C library underneath.
2021-11-23 11:33:36 +01:00
Andreas Kling acc2eccede LibSystem: Add wrapper for fstat() 2021-11-23 11:33:36 +01:00
Andreas Kling 3d34216b9a LibSystem: Add ErrorOr<T> wrapper for sigaction() :^) 2021-11-22 19:28:31 +01:00
Andreas Kling 4e530135d5 AK+LibSystem+LibMain: Add Error::from_syscall() for syscall failures
This creates an error that contains the name of the syscall that failed.
This allows error handlers to print out the name of the call if they
want to. :^)
2021-11-22 19:28:31 +01:00
Andreas Kling 317ceb0ee2 LibSystem: Disable stack protector in syscall wrappers on i686
This is a hack to avoid a circular dependency issue with the stack check
failure handler being in LibC.

This is not ideal, and there's most likely a better way to solve this.

That said, LibSystem should not have anything but thin wrappers around
system calls, so stack protectors have limited utility here anyway.
2021-11-22 19:28:31 +01:00
Andreas Kling dc486fa3f9 LibSystem: Add pledge() and unveil() wrappers that return ErrorOr<void>
These will be more ergonomic to use together with TRY(). :^)
2021-11-22 18:34:08 +01:00
Andreas Kling deff554096 Kernel+LibSystem: Add a 4th syscall argument
Let's allow passing 4 function arguments to a syscall. The 4th argument
goes into ESI or RSI.
2021-07-25 14:08:50 +02:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
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 *
2021-04-22 11:22:27 +02:00
Itamar ae67cabe11 CMake: Make libc.a self-contained
Previously, libc.a contained undefined symbols from ssp and libsystem,
which caused static compilation to fail.

We now generate libc.a with a custom CMake rule that combines all
object files from libc, ssp and libsystem to form libc.a

Closes #5758.
2021-03-19 22:55:53 +01:00
Andreas Kling e87eac9273 Userland: Add LibSystem and funnel all syscalls through it
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.
2021-02-05 12:23:39 +01:00