Commit Graph

19 Commits

Author SHA1 Message Date
Tim Schumacher
c85f307e62 LibC: Mark a bunch of functions as cancellation points 2022-07-22 10:07:15 -07:00
sin-ack
c70f45ff44 Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the
StringView users. This is an important step towards the goal of removing
StringView(char const*), as it moves the responsibility of calculating
the size of the string to the user of the StringView (which will prevent
naive uses causing OOB access).
2022-07-12 23:11:35 +02:00
Tim Schumacher
cf0ad3715e Kernel: Implement sigsuspend using a SignalBlocker
`sigsuspend` was previously implemented using a poll on an empty set of
file descriptors. However, this broke quite a few assumptions in
`SelectBlocker`, as it verifies at least one file descriptor to be
ready after waking up and as it relies on being notified by the file
descriptor.

A bare-bones `sigsuspend` may also be implemented by relying on any of
the `sigwait` functions, but as `sigsuspend` features several (currently
unimplemented) restrictions on how returns work, it is a syscall on its
own.
2022-07-08 22:27:38 +00:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Brian Gianforcaro
6fe71970f5 LibC: Add POSIX spec comments for signal APIs 2021-12-21 18:16:48 -08:00
Idan Horowitz
656b1dd6be LibC: Implement sigwait()
This is done internally by just calling the more modern sigtimedwait
syscall and then massaging the results to fit sigwait's interface.
2021-12-12 08:34:19 +02:00
Idan Horowitz
640844c965 LibC: Implement sigwaitinfo()
This is implemented as a simple wrapper around sigtimedwait()
2021-12-12 08:34:19 +02:00
Idan Horowitz
762e047ec9 Kernel+LibC: Implement sigtimedwait()
This includes a new Thread::Blocker called SignalBlocker which blocks
until a signal of a matching type is pending. The current Blocker
implementation in the Kernel is very complicated, but cleaning it up is
a different yak for a different day.
2021-12-12 08:34:19 +02:00
Idan Horowitz
f415218afe Kernel+LibC: Implement sigaltstack()
This is required for compiling wine for serenity
2021-12-01 21:44:11 +02:00
Maciej Zygmanowski
7237972022 LibC: Support getsignalbyname() with full signal name
This allows e.g. to use `kill` with names like -SIGKILL, not only -KILL.
2021-08-22 15:23:25 +02:00
Jean-Baptiste Boric
c972afbea6 LibC: Fix sigsetjmp and siglongjmp 2021-08-18 10:33:48 +02:00
Jean-Baptiste Boric
6165811081 LibC: Expose sig_sysname array 2021-08-18 10:33:48 +02:00
Jean-Baptiste Boric
f2b8b46bb0 LibC: Implement sigsuspend function 2021-08-13 03:16:58 +02:00
Thiago Henrique Hupner
4850cf9069 LibC: Add stub implementation for sigsuspend
Currently, ZSH tries to call this function and it always asserts,
so adding a stub to allow ZSH at least open.
2021-06-09 19:41:23 +01: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
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...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.
2021-02-23 20:56:54 +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
Linus Groh
b42f0b9650 LibC: Change a couple of ASSERT_NOT_REACHED() to TODO()
Just for semantic correctness and better visibility of those
unimplemented stub functions.
2021-01-17 08:43:46 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00