Idan Horowitz
39ecb832e4
Kernel: Don't try to dispatch urgent signals for kernel crashes
...
If we crashed in the kernel there's no point to sending a signal to the
active process, we're going to panic soon anyway.
2021-12-06 19:36:42 +01:00
Idan Horowitz
548488f050
Kernel: Terminate current thread immediately on unhandled urgent signal
...
If we're sending an urgent signal (i.e. due to unexpected conditions)
and the Process did not setup any signal handler, we should immediately
terminate the Thread, to ensure the current trap frame is preserved for
the impending core dump.
2021-12-06 19:36:42 +01:00
Andreas Kling
0f9ca51c76
Kernel: Remove unused Inode::preopen_fd()
2021-12-06 19:22:16 +01:00
Ben Wiederhake
0e6e1092f0
Kernel: Make ptrace return an error on error
...
Returning 'result.error().code()' erroneously creates an
ErrorOr<FlatPtr> of the positive errno code, which breaks our
error-returning convention.
This seems to be due to a forgotten minus-sign during the refactoring in
9e51e295cf
. This latent bug was never
discovered, because currently the error-handling paths are rarely
exercised.
2021-12-05 22:59:09 +01:00
Ben Wiederhake
0f8483f09c
Kernel: Implement new ptrace function PT_PEEKBUF
...
This enables the tracer to copy large amounts of data in a much saner
way.
2021-12-05 22:59:09 +01:00
Ben Wiederhake
3e223185b3
Kernel+strace: Remove unnecessary indirection for PEEK
...
Also, remove incomplete, superfluous check.
Incomplete, because only the byte at the provided address was checked;
this misses the last bytes of the "jerk page".
Superfluous, because it is already correctly checked by peek_user_data
(which calls copy_from_user).
The caller/tracer should not typically attempt to read non-userspace
addresses, we don't need to "hot-path" it either.
2021-12-05 22:59:09 +01:00
Sam Atkins
c6a97ea843
Kernel: Mark kernel smart-pointer classes as [[nodiscard]]
...
And cast the unused return values to void.
2021-12-05 15:31:03 +01:00
Sam Atkins
907feb84a0
Kernel: Cast unused smart-pointer return value to void
2021-12-05 15:31:03 +01:00
Idan Horowitz
b2464cf4c0
Kernel: Define PT_WRITE_I and PT_WRITE_D
...
These are aliases for PT_POKE that are used in some *BSDs.
2021-12-05 12:53:29 +01:00
Idan Horowitz
265764ff2f
Kernel: Add support for the POLLWRBAND poll event
2021-12-05 12:53:29 +01:00
Idan Horowitz
f2fef049e1
Kernel: Define the POLLRDNORM alias for POLLIN
...
This flag is equivalent to POLLIN.
2021-12-05 12:53:29 +01:00
Idan Horowitz
05aa764402
Kernel: Define the POLLWRNORM alias for POLLOUT
...
This is defined by posix to be equivalent to POLLOUT
2021-12-05 12:53:29 +01:00
Idan Horowitz
8074157c10
Kernel: Add the IPPROTO_{IGMP, IPIP, RAW} protocol macros
...
These are not implemented currently, but are required for some ports to
compile.
2021-12-05 12:53:29 +01:00
Idan Horowitz
2860637ff3
Kernel: Add the IP_{BLOCK_SOURCE, UNBLOCK_SOURCE, OPTIONS} macros
...
These are not implemented currently, but are required for some ports to
compile.
2021-12-05 12:53:29 +01:00
Idan Horowitz
d18b3eb53d
Kernel: Add the SO_OOBINLINE SOL_SOCKET-level option macro
...
This is not actually implemented, as we don't have any support for
out-of-band right now, but this is required for some ports to compile.
2021-12-05 12:53:29 +01:00
Idan Horowitz
613ade9dec
Kernel: Implement the SO_DONTROUTE SOL_SOCKET-level option
2021-12-05 12:53:29 +01:00
Idan Horowitz
641498954f
Kernel: Implement the SO_ACCEPTCONN SOL_SOCKET-level option
2021-12-05 12:53:29 +01:00
Idan Horowitz
a0e2fedc20
Kernel: Stub out the SO_DEBUG SOL_SOCKET-level option
2021-12-05 12:53:29 +01:00
Idan Horowitz
e521ffd156
Kernel: Add support for the MSG_WAITALL sys$recvmsg flag
2021-12-05 12:53:29 +01:00
Idan Horowitz
5514d60d8d
Kernel: Add support for the MSG_DONTROUTE sys$sendmsg flag
2021-12-05 12:53:29 +01:00
Idan Horowitz
0a36d1459a
Kernel: Return EINVAL on unsupported LocalSocket ioctl
...
ENOTTY is used to signify that no ioctl interface is provided at all,
but LocalSockets do support the FIONREAD ioctl.
2021-12-05 12:53:29 +01:00
Daniel Bertalan
294cb3cef4
Kernel: Wrap x86 assembly behind ARCH(...)
in Syscall.h
...
Unlike GCC, Clang parses assembly eagerly, and immediately rejects
inline assembly that's not for the right architecture.
2021-12-04 11:59:59 -08:00
Daniel Bertalan
9b90f1fed5
Kernel: Do not do integer to pointer conversion in constexpr functions
...
Creating pointers from arbitrary values is not a valid thing to do in
constexpr functions. Furthermore, this functions is always called with
runtime values anyways, so there's no use in having it be constexpr.
Instead, make it ALWAYS_INLINE.
2021-12-04 11:59:59 -08:00
Daniel Bertalan
8e2d0c8d5c
Kernel: Do not return a null ref in Processor::current
on aarch64
...
Clang rejects binding a reference to a null pointer at compile-time.
Let's just crash explicitly, instead of waiting for a null dereference
to mess things up.
2021-12-04 11:59:59 -08:00
Idan Horowitz
711a7104f3
Kernel: Handle invalid stack pointer during signal dispatch
...
Instead of crashing the kernel, we simply terminate the process.
2021-12-01 21:44:11 +02:00
Idan Horowitz
40f64d7379
Kernel: Dispatch handle-able signals instead of crashing if possible
...
This matches the behaviour of the other *nixs and allows processes to
try and recover from such signals in userland.
2021-12-01 21:44:11 +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
Idan Horowitz
d5d0eb45bf
Kernel: Clear up some comments in the sys$mprotect implementation
2021-12-01 21:44:11 +02:00
Idan Horowitz
f27bbec7b2
Kernel: Move incorrect early return in sys$mprotect
...
Since we're iterating over multiple regions that interesect with the
requested range, just one of them having the requested access flags
is not enough to finish the syscall early.
2021-12-01 21:44:11 +02:00
Idan Horowitz
a9e436c4a3
Kernel: Replace usages of SIGSTKFLT with SIGSEGV
...
SIGSTKFLT is a signal that signifies a stack fault in a x87 coprocessor,
this signal is not POSIX and also unused by Linux and the BSDs, so let's
use SIGSEGV so programs that setup signal handlers for the common
signals could still handle them in serenity.
2021-12-01 21:44:11 +02:00
Idan Horowitz
4ca39c7110
Kernel: Move the expand_range_to_page_boundaries helper to MemoryManager
...
This helper can (and will) be used in more parts of the kernel besides
the mmap-family of syscalls.
2021-12-01 21:44:11 +02:00
Idan Horowitz
ff6b43734c
Kernel: Add Region::clear_to_zero
...
This helper method can be used to quickly and efficiently zero out a
region.
2021-12-01 21:44:11 +02:00
Idan Horowitz
5f95a1a7b7
LibC: Define the MADV_DONTNEED madvise advice macro
...
This isn't actually implemented at the moment, but it is required for
wine to compile
2021-12-01 21:44:11 +02:00
Idan Horowitz
fc13d0782f
LibC: Make the madvise advice field a value instead of a bitfield
...
The advices are almost always exclusive of one another, and while POSIX
does not define madvise, most other unix-like and *BSD systems also only
accept a singular value per call.
2021-12-01 21:44:11 +02:00
Idan Horowitz
48f92f6482
LibC: Add the SIGFPE si_code macros
2021-12-01 21:44:11 +02:00
James Mintram
224b865fda
Kernel: Add an x86 include check+error in x86/TSS.h
2021-12-01 11:22:04 -08:00
James Mintram
b08eb37b11
Kernel: Add an x86 include check+error in x86/TrapFrame.h
2021-12-01 11:22:04 -08:00
James Mintram
80cdfee10a
Kernel: Add an x86 include check+error in x86/Spinlock.h
2021-12-01 11:22:04 -08:00
James Mintram
34b341e35d
Kernel: Add an x86 include check+error in x86/RegisterState.h
2021-12-01 11:22:04 -08:00
James Mintram
1dc1412dee
Kernel: Add an x86 include check+error in x86/ProcessorInfo.h
2021-12-01 11:22:04 -08:00
James Mintram
e20884dc0c
Kernel: Add an x86 include check+error in x86/Processor.h
2021-12-01 11:22:04 -08:00
James Mintram
eb33df0c30
Kernel: Add an x86 include check+error in x86/PageFault.h
2021-12-01 11:22:04 -08:00
James Mintram
17fb2adf61
Kernel: Add an x86 include check+error in x86/PageDirectory.h
2021-12-01 11:22:04 -08:00
James Mintram
70a18a2271
Kernel: Add an x86 include check+error in x86/MSR.h
2021-12-01 11:22:04 -08:00
James Mintram
bffc3da9d7
Kernel: Add an x86 include check+error in x86/ISRStubs.h
2021-12-01 11:22:04 -08:00
James Mintram
1e5b82f0c6
Kernel: Add an x86 include check+error in x86/IO.h
2021-12-01 11:22:04 -08:00
James Mintram
b9ae6daa02
Kernel: Add an x86 include check+error in x86/Inerrupts.h
2021-12-01 11:22:04 -08:00
James Mintram
ed2aa96511
Kernel: Add an x86 include check+error in x86/InerruptDisabler.h
2021-12-01 11:22:04 -08:00
James Mintram
62d86afee9
Kernel: Add an x86 include check+error in x86/DescriptorTable.h
2021-12-01 11:22:04 -08:00
James Mintram
db1fbdabf9
Kernel: Add an x86 include check+error in x86/CPUID.h
2021-12-01 11:22:04 -08:00