summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2021-01-20Kernel+LibC: Turn errno codes into a strongly typed enumAndreas Kling
..and allow implicit creation of KResult and KResultOr from ErrnoCode. This means that kernel functions that return those types can finally do "return EINVAL;" and it will just work. There's a handful of functions that still deal with signed integers that should be converted to return KResults.
2021-01-20Kernel: Make BlockBasedFS read/write functions return a KResultAndreas Kling
This way, if something goes wrong, we get to keep the actual error. Also, KResults are nodiscard, so we have to deal with that in Ext2FS instead of just silently ignoring I/O errors(!)
2021-01-20Kernel: Set "pledge_violation" coredump metadata in REQUIRE_PROMISE()Linus Groh
Similar to LibC storing an assertion message before aborting, process death by pledge violation now sets a "pledge_violation" key with the respective pledge name as value in its coredump metadata, which the CrashReporter will then show.
2021-01-19Kernel: Allow sys$chmod() to change the sticky bitAndreas Kling
We were incorrectly masking off the sticky bit when setting file modes.
2021-01-19Kernel: Implement the same symlink protection as LinuxAndreas Kling
Path resolution will now refuse to follow symlinks in some cases where you don't own the symlink, or when it's in a sticky world-writable directory and the link has a different owner than the directory. The point of all this is to prevent classic TOCTOU bugs in /tmp etc. Fixes #4934
2021-01-19Kernel: Implement the same hard link protection as LinuxAndreas Kling
sys$link() will now fail to create hard links in some cases where you don't own or have write access to the link target. Work towards #4934
2021-01-19Boot: Fix undefined Multiboot behaviorsJean-Baptiste Boric
Both ESP and GDTR are left undefined by the Multiboot specification and OS images must not rely on these values to be valid. Fix the undefined behaviors so that booting with PXELINUX does not triple-fault the CPU.
2021-01-18Kernel+LibC: Add _SC_TTY_NAME_MAXLinus Groh
2021-01-17Kernel: Assert on attempt to mark inode metadata dirty on read-only FSAndreas Kling
2021-01-17Kernel: Remove /proc/PID/vmobjectsAndreas Kling
This file was useful for debugging a long time ago, but has bitrotted at this point. Instead of updating it, let's just remove it since nothing is using it.
2021-01-17Kernel: Remove unused /proc/mm fileAndreas Kling
This was a file I used very early on to dump information about kernel VM objects. It's long since superseded by other JSON-based files.
2021-01-17Kernel: Unbreak /proc/PID/root symlinkAndreas Kling
The generator callback for this file was mistakenly returning false on success, which caused the kernel to fail sys$readlink() with ENOENT.
2021-01-17Kernel: Some futex improvementsTom
This adds support for FUTEX_WAKE_OP, FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET, FUTEX_REQUEUE, and FUTEX_CMP_REQUEUE, as well well as global and private futex and absolute/relative timeouts against the appropriate clock. This also changes the implementation so that kernel resources are only used when a thread is blocked on a futex. Global futexes are implemented as offsets in VMObjects, so that different processes can share a futex against the same VMObject despite potentially being mapped at different virtual addresses.
2021-01-17Kernel: Add safe atomic functionsTom
This allows us to perform atomic operations on potentially unsafe user space pointers.
2021-01-17Kernel: Limit exec arguments and environment to 1/8th of stack eachAndreas Kling
This sort-of matches what some other systems do and seems like a generally sane thing to do instead of allowing programs to spawn a child with a nearly full stack.
2021-01-17Ext2FS: Update block group directory count after directory removalAndreas Kling
When freeing an inode, we were checking if it's a directory *after* wiping the inode metadata. This caused us to forget updating the block group descriptor with the new directory count.
2021-01-17Kernel: Remove a bunch of no-longer-necessary SmapDisablersAndreas Kling
We forgot to remove the automatic SMAP disablers after fixing up all this code to not access userspace memory directly. Let's lock things down at last. :^)
2021-01-17Kernel: Prune uninteresting kernel frames from profiling samplesAndreas Kling
Start capturing the sample stacks at the EIP/EBP of the pre-empted thread instead of capturing EBP in the sampling function itself.
2021-01-17Kernel+Userland: Remove shared buffers (shbufs)Andreas Kling
All users of this mechanism have been switched to anonymous files and passing file descriptors with sendfd()/recvfd(). Shbufs got us where we are today, but it's time we say good-bye to them and welcome a much more idiomatic replacement. :^)
2021-01-17Kernel: Remove sys$shbuf_seal() and userland wrappersAndreas Kling
There are no remaining users of this syscall so let it go. :^)
2021-01-16Kernel: Remove some unused code in the SharedBuffer classAndreas Kling
2021-01-16Kernel+Userland: Remove sys$shbuf_allow_all() and userland wrappersAndreas Kling
Nobody is using globally shared shbufs anymore, so let's remove them.
2021-01-16Kernel+LibC: Make sys$getcwd truncate the result silentlyBen Wiederhake
This gives us the superpower of knowing the ideal buffer length if it fails. See also https://github.com/SerenityOS/serenity/discussions/4357
2021-01-16Kernel: Make realpath return silently truncated dataBen Wiederhake
For context, see https://github.com/SerenityOS/serenity/discussions/4357
2021-01-16Kernel: Remove unused 'ImmutableBufferArgument'Ben Wiederhake
2021-01-16Kernel: execve: find_elf_interpreter_for_executable: Fix dbglnBrendan Coles
2021-01-16Kernel+LibC+WindowServer: Remove unused thread/process boost mechanismAndreas Kling
The priority boosting mechanism has been broken for a very long time. Let's remove it from the codebase and we can bring it back the day someone feels like implementing it in a working way. :^)
2021-01-16Kernel: Remove unused syscall sys$minherit()Andreas Kling
This is no longer used. We can bring it back the day we need it.
2021-01-16Kernel: Remove sys$shbuf_set_volatile() and userland wrappersAndreas Kling
There are no remaining users of this syscall so let's remove it! :^)
2021-01-16Kernel: Fix inverted logic in KResultOrBen Wiederhake
This silly inversion has survived so long because we don't exercise the 'unhappy paths' enough. :^)
2021-01-16Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect. This commit touches some dbg() calls which are enclosed in macros. This should be fine because with the new constexpr stuff, we ensure that the stuff actually compiles.
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: Prevent threads from being destructed between die() and finalize()Linus Groh
Killing remaining threads already happens in Process::die(), but coredumps are only written in Process::finalize(). We need to keep a reference to each of those threads to prevent them from being destructed between those two functions, otherwise coredumps will only ever contain information about the last remaining thread. Fixes the underlying problem of #4778, though the UI will need refinements to not show every thread's backtrace mashed together.
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-15Kernel: Make Process::allocate_region*() return KResultOr<Region*>Andreas Kling
This allows region allocation to return specific errors and we don't have to assume every failure is an ENOMEM.
2021-01-15Kernel: Make sys$anon_create() require the "stdio" promise if pledgedAndreas Kling
2021-01-15Kernel: Fix bogus negation of alloc_fd() error in sys$anon_create()Andreas Kling
Thanks to Idan for spotting this!
2021-01-15Kernel: Add anonymous files, created with sys$anon_create()Andreas Kling
This patch adds a new AnonymousFile class which is a File backed by an AnonymousVMObject that can only be mmap'ed and nothing else, really. I'm hoping that this can become a replacement for shbufs. :^)
2021-01-15Kernel: Make Locker remember whether the lock is heldTom
This allows temporarily unlocking a lock or re-locking it, and it will only unlock if it is still being held. Fixes #4352
2021-01-14ProcFS: Ignore directories in refresh_data().Mart G
2021-01-12Kernel: Use current process EUID in doing profiling access controlAndreas Kling
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling
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-11Kernel: Remove /proc/mountsAndreas Kling
Everyone was already using /proc/df which has all the info anyway.
2021-01-11Kernel: Remove /proc/inodesAndreas Kling
There was nothing interesting in this file.
2021-01-11Kernel: Only send SIGTTOU if TTY termios has TOSTOP flagAndreas Kling
Fixes #4909
2021-01-11Kernel: Add dedicated "ptrace" pledge promiseAndreas Kling
The vast majority of programs don't ever need to use sys$ptrace(), and it seems like a high-value system call to prevent a compromised process from using. This patch moves sys$ptrace() from the "proc" promise to its own, new "ptrace" promise and updates the affected apps.
2021-01-11Kernel: Remove MM_DEBUG debug spam codeAndreas Kling
This was too spammy to ever actually be used anyway.
2021-01-11Kernel: Convert a bunch of String::format() => String::formatted()Andreas Kling
2021-01-11Everywhere: Fix incorrect uses of String::format and StringBuilder::appendfSahan Fernando
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.