summaryrefslogtreecommitdiff
path: root/Kernel/CoreDump.cpp
AgeCommit message (Collapse)Author
2021-02-08Kernel: Reorganize ptrace implementation a bitAndreas Kling
The generic parts of ptrace now live in Kernel/Syscalls/ptrace.cpp and the i386 specific parts are moved to Arch/i386/CPU.cpp
2021-02-08Kernel: Factor address space management out of the Process classAndreas Kling
This patch adds Space, a class representing a process's address space. - Each Process has a Space. - The Space owns the PageDirectory and all Regions in the Process. This allows us to reorganize sys$execve() so that it constructs and populates a new Space fully before committing to it. Previously, we would construct the new address space while still running in the old one, and encountering an error meant we had to do tedious and error-prone rollback. Those problems are now gone, replaced by what's hopefully a set of much smaller problems and missing cleanups. :^)
2021-01-28Kernel: Generate coredump backtraces from "threads for coredump" listAndreas Kling
This broke with the change that gave each process a list of its own threads. Since threads are removed slightly earlier from that list during process teardown, we're not able to use it for generating coredump backtraces. Fortunately we have the "threads for coredump" list for just this purpose. :^)
2021-01-23Kernel: Create core dumps with S_IFREG set (regular file)Andreas Kling
Otherwise, the VFS will refuse to create the file.
2021-01-15Kernel: Store process arguments and environment in coredumpsLinus Groh
Currently they're only pushed onto the stack but not easily accessible from the Process class, so this adds a Vector<String> for both.
2021-01-15Kernel+LibELF+LibCoreDump+CrashReporter: Use JSON for ProcessInfoLinus Groh
This is in preparation of adding (much) more process information to coredumps. As we can only have one null-terminated char[] of arbitrary length in each struct it's now a single JSON blob, which is a great fit: easily extensible in the future and allows for key/value pairs and even nested objects, which will be used e.g. for the process environment, for example.
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2021-01-10Kernel+SystemServer+CrashDaemon: Better control where we put core dumpsAndreas Kling
SystemServer now creates the /tmp/coredump and /tmp/profiler_coredumps directories at startup, ensuring that they are owned by root, and with basic 0755 permissions. The kernel will also now refuse to put core dumps in a directory that doesn't fulfill the following criteria: - Owned by 0:0 - Directory with sticky bit not set - 0755 permissions Fixes #4435 Fixes #4850
2021-01-03Kernel+LibELF: Store termination signal in coredump ProcessInfoLinus Groh
2020-12-30Kernel: Embed a Metadata notes entry in coredumpsLinus Groh
2020-12-30Kernel: Embed a ProcessInfo notes entry in coredumpsLinus Groh
2020-12-27Kernel: CoreDump::write_program_headers: set NOTE p_memsz to p_fileszBrendan Coles
2020-12-27Kernel: Lock target process when generating core dumpAndreas Kling
Dumping core can happen at the end of a profiling run, and in that case we have to protect the target process and take the lock while iterating over its region map. Fixes #4509.
2020-12-25Kernel+LibC: Introduce a "dumpable" flag for processesAndreas Kling
This new flag controls two things: - Whether the kernel will generate core dumps for the process - Whether the EUID:EGID should own the process's files in /proc Processes are automatically made non-dumpable when their EUID or EGID is changed, either via syscalls that specifically modify those ID's, or via sys$execve(), when a set-uid or set-gid program is executed. A process can change its own dumpable flag at any time by calling the new sys$prctl(PR_SET_DUMPABLE) syscall. Fixes #4504.
2020-12-22Kernel: Abort core dump generation if any substep failsAndreas Kling
And make an effort to propagate errors out from the inner parts. This fixes an issue where the kernel would infinitely loop in coredump generation if the TmpFS filled up.
2020-12-21Everywhere: Switch from (void) to [[maybe_unused]] (#4473)Lenny Maiorani
Problem: - `(void)` simply casts the expression to void. This is understood to indicate that it is ignored, but this is really a compiler trick to get the compiler to not generate a warning. Solution: - Use the `[[maybe_unused]]` attribute to indicate the value is unused. Note: - Functions taking a `(void)` argument list have also been changed to `()` because this is not needed and shows up in the same grep command.
2020-12-15Kernel: Remove harmless OOB ELF header access in core dump generationAndreas Kling
2020-12-15Kernel: Don't take LexicalPath as argumentAndreas Kling
LexicalPath is a big and heavy class that's really meant as a helper for extracting parts of a path, not for storage or passing around. Instead, pass paths around as strings and use LexicalPath locally as needed.
2020-12-14Kernel: Pass full path of output coredump file to CoreDumpItamar
2020-12-14LibELF: Refactor coredump notes section structuresItamar
2020-12-14Kernel: Generate a coredump file when a process crashesItamar
When a process crashes, we generate a coredump file and write it in /tmp/coredumps/. The coredump file is an ELF file of type ET_CORE. It contains a segment for every userspace memory region of the process, and an additional PT_NOTE segment that contains the registers state for each thread, and a additional data about memory regions (e.g their name).