summaryrefslogtreecommitdiff
path: root/Kernel/Coredump.h
AgeCommit message (Collapse)Author
2023-06-04Kernel: Move task-crash related code to the Tasks subdirectoryLiav A
2023-04-08Kernel: Mark a bunch of NonnullRefPtrs also const to ensure immutabilityLiav A
These were easy to pick-up as these pointers are assigned during the construction point and are never changed afterwards. This small change to these pointers will ensure that our code will not accidentally assign these pointers with a new object which is always a kind of bug we will want to prevent.
2023-04-04Kernel: Stop using *LockRefPtr for Process pointersAndreas Kling
The only persistent one of these was Thread::m_process and that never changes after initialization. Make it const to enforce this and switch everything over to RefPtr & NonnullRefPtr.
2023-03-07Kernel: Use non-locking {Nonnull,}RefPtr for OpenFileDescriptionAndreas Kling
This patch switches away from {Nonnull,}LockRefPtr to the non-locking smart pointers throughout the kernel. I've looked at the handful of places where these were being persisted and I don't see any race situations. Note that the process file descriptor table (Process::m_fds) was already guarded via MutexProtected.
2023-01-02Kernel: Turn lock ranks into template parameterskleines Filmröllchen
This step would ideally not have been necessary (increases amount of refactoring and templates necessary, which in turn increases build times), but it gives us a couple of nice properties: - SpinlockProtected inside Singleton (a very common combination) can now obtain any lock rank just via the template parameter. It was not previously possible to do this with SingletonInstanceCreator magic. - SpinlockProtected's lock rank is now mandatory; this is the majority of cases and allows us to see where we're still missing proper ranks. - The type already informs us what lock rank a lock has, which aids code readability and (possibly, if gdb cooperates) lock mismatch debugging. - The rank of a lock can no longer be dynamic, which is not something we wanted in the first place (or made use of). Locks randomly changing their rank sounds like a disaster waiting to happen. - In some places, we might be able to statically check that locks are taken in the right order (with the right lock rank checking implementation) as rank information is fully statically known. This refactoring even more exposes the fact that Mutex has no lock rank capabilites, which is not fixed here.
2022-12-03Kernel+SystemServer: Don't hardcode coredump directory pathLiav A
Instead, allow userspace to decide on the coredump directory path. By default, SystemServer sets it to the /tmp/coredump directory, but users can now change this by writing a new path to the sysfs node at /sys/kernel/variables/coredump_directory, and also to read this node to check where coredumps are currently generated at.
2022-08-31Kernel: Work using copies of specific region data during a coredumpTim Schumacher
This limits our interaction with the "real" region tree (and therefore its lock) to the time where we actually read from the user address space.
2022-08-20Kernel: Make self-contained locking smart pointers their own classesAndreas Kling
Until now, our kernel has reimplemented a number of AK classes to provide automatic internal locking: - RefPtr - NonnullRefPtr - WeakPtr - Weakable This patch renames the Kernel classes so that they can coexist with the original AK classes: - RefPtr => LockRefPtr - NonnullRefPtr => NonnullLockRefPtr - WeakPtr => LockWeakPtr - Weakable => LockWeakable The goal here is to eventually get rid of the Lock* classes in favor of using external locking.
2021-11-08Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>Andreas Kling
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
2021-09-30Kernel: Exclude userspace heap memory from coredumps by defaultAndreas Kling
When a process with a large heap crashes (e.g WebContent), it gets very cumbersome to dump out a huge amount of memory. In the vast majority of cases, we're only interested in generating a nice backtrace from the coredump, so let's have the kernel skip over userspace heap regions when dumping memory for now. This is not ideal, and almost a little bit ugly, but it does make investigating 500 MiB WebContent crashes significantly easier for now.
2021-09-07Kernel: Rename FileDescription => OpenFileDescriptionAndreas Kling
Dr. POSIX really calls these "open file description", not just "file description", so let's call them exactly that. :^)
2021-09-07Kernel: Remove redundant [[nodiscard]] on KResult return valuesAndreas Kling
Both KResult and KResultOr are [[nodiscard]] at the class level, so there's no need to have functions return `[[nodiscard]] KResult`.
2021-09-06Kernel: Don't allocate so much when generating coredumpsAndreas Kling
Instead of creating a bunch of ByteBuffers and concatenating them to generate the "notes" segment, we now simply create a KBufferBuilder and tell each of the notes generator helpers to write into the builder. This allows the code to flow more naturally, with some bonus additional error propagation. :^)
2021-09-06Kernel: Tidy up Coredump constructionAndreas Kling
- Use KResultOr and TRY to propagate errors - Return more specific errors now that they have a path out from here
2021-09-06Everywhere: Use OOM-safe ByteBuffer APIs where possibleAli Mohammad Pur
If we can easily communicate failure, let's avoid asserting and report failure instead.
2021-08-23Everywhere: Core dump => CoredumpAndreas Kling
We all know what a coredump is, and it feels more natural to refer to it as a coredump (most code already does), so let's be consistent.