summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2020-05-29Ports: Fix CMake-based portsPaul Redmond
The SDL port failed to build because the CMake toolchain filed pointed to the old root. Now the toolchain file assumes that the Root is in Build/Root. Additionally, the AK/ and Kernel/ headers need to be installed in the root too.
2020-05-29Meta: Add a script check the presence of "#pragma once" in header filesEmanuele Torre
.. and make travis run it. I renamed check-license-headers.sh to check-style.sh and expanded it so that it now also checks for the presence of "#pragma once" in .h files. It also checks the presence of a (single) blank line above and below the "#pragma once" line. I also added "#pragma once" to all the files that need it: even the ones we are not check. I also added/removed blank lines in order to make the script not fail. I also ran clang-format on the files I modified.
2020-05-29Kernel+Userland: Support remounting filesystems :^)Sergey Bugaev
This makes it possible to change flags of a mount after the fact, with the caveats outlined in the man page.
2020-05-29Kernel: Misc tweaksSergey Bugaev
2020-05-29Kernel+Base: Mount root filesystem read-only :^)Sergey Bugaev
We remount /home and /root as read-write, to keep the ability to modify files there. /tmp remains read-write, as it is mounted from a TmpFS.
2020-05-29Kernel: Support read-only filesystem mountsSergey Bugaev
This adds support for MS_RDONLY, a mount flag that tells the kernel to disallow any attempts to write to the newly mounted filesystem. As this flag is per-mount, and different mounts of the same filesystems (such as in case of bind mounts) can have different mutability settings, you have to go though a custody to find out if the filesystem is mounted read-only, instead of just asking the filesystem itself whether it's inherently read-only. This also adds a lot of checks we were previously missing; and moves some of them to happen after more specific checks (such as regular permission checks). One outstanding hole in this system is sys$mprotect(PROT_WRITE), as there's no way we can know if the original file description this region has been mounted from had been opened through a readonly mount point. Currently, we always allow such sys$mprotect() calls to succeed, which effectively allows anyone to circumvent the effect of MS_RDONLY. We should solve this one way or another.
2020-05-29Kernel+LibC: Move O_* and MS_* flags to UnixTypes.hSergey Bugaev
That's where the other similar definitions reside. Also, use bit shift operations for MS_* values.
2020-05-29Kernel: Fix error case in Process::create_user_process()Sergey Bugaev
If we fail to exec() the target executable, don't leak the thread (this actually triggers an assertion when destructing the process), and print an error message.
2020-05-29Kernel: Fix some failing assertionsSergey Bugaev
When mounting Ext2FS, we don't care if the file has a custody (it doesn't if it's a device, which is a common case). When doing a bind-mount, we do need a custody; if none is provided, let's return an error instead of crashing.
2020-05-29Kernel: Always require read access when mmaping a fileSergey Bugaev
POSIX says, "The file descriptor fildes shall have been opened with read permission, regardless of the protection options specified."
2020-05-29Kernel: Pass a Custody instead of Inode to VFS methodsSergey Bugaev
VFS no longer deals with inodes in public API, only with custodies and file descriptions. Talk directly to the file system if you need to operate on a inode. In most cases you actually want to go though VFS, to get proper permission check and other niceties. For this to work, you have to provide a custody, which describes *how* you have opened the inode, not just what the inode is.
2020-05-29Kernel: Pass a FileDescription to File::chmod() and File::chown()Sergey Bugaev
We're going to make use of it in the next commit. But the idea is we want to know how this File (more specifically, InodeFile) was opened in order to decide how chown()/chmod() should behave, in particular whether it should be allowed or not. Note that many other File operations, such as read(), write(), and ioctl(), already require the caller to pass a FileDescription.
2020-05-29Kernel: Report source of synthetic filesystems as "none"Sergey Bugaev
As opposed to the fs name. This matches the new convention we have for specifying it in mount(8).
2020-05-28Kernel: Remove outdated FIXME in InterruptManagement::locate_apic_dataAndreas Kling
2020-05-28Kernel: Stop bootloader from setting video mode with MultibootetaIneLp
Meta: Update INSTALL.md and grub configs for new boot_mode option
2020-05-27Kernel: Introduce "boot_mode" and "init" cmdline optionsSergey Bugaev
Together, they replace the old text_debug option. * boot_mode should be either "graphical" (the default) or "text". We could potentially support other values here in the future. * init specifies which userspace process the kernel should spawn to bootstrap userspace. By default, this is SystemServer, but you can specify e.g. init=/bin/Shell to run system diagnostics.
2020-05-27Kernel: Port VirtualConsole to LibVT :^)Sergey Bugaev
Unfortunately this drops the feature of preserving VGA buffer contents. Resolves https://github.com/SerenityOS/serenity/issues/2399
2020-05-26AK: Rename FileSystemPath -> LexicalPathSergey Bugaev
And move canonicalized_path() to a static method on LexicalPath. This is to make it clear that FileSystemPath/canonicalized_path() only perform *lexical* canonicalization.
2020-05-26Kernel: Introduce "sigaction" pledgeSergey Bugaev
You now have to pledge "sigaction" to change signal handlers/dispositions. This is to prevent malicious code from messing with assertions (and segmentation faults), which are normally expected to instantly terminate the process but can do other things if you change signal disposition for them.
2020-05-26Kernel: fix assertion on readlink() syscallAngel
The is_error() check on the KResultOr returned when reading the link target had a stray ! operator which causes link resolution to crash the kernel with an assertion error.
2020-05-26Kernel: Plumb KResult through FileDescription::read_entire_file() ↵Brian Gianforcaro
implementation. Allow file system implementation to return meaningful error codes to callers of the FileDescription::read_entire_file(). This allows both Process::sys$readlink() and Process::sys$module_load() to return more detailed errors to the user.
2020-05-26Kernel: Clang format file system in prep for changes.Brian Gianforcaro
2020-05-26Kernel: Unmap first MB after jumping above 3GBetaIneLp
2020-05-26Kernel: Create page structures correctly in boot.setaIneLp
2020-05-25Kernel: Fix returning random children from waitid(WNOHANG)Sergey Bugaev
In case WNOHANG was specified, we want to always set should_unblock to true (which we do since commit 4402207b983b6ad4e317ef5affa4a78f10903a26), not wait_finished -- the latter causes us to immediately return this child to our caller, which is not what we want -- perhaps we should return another child which has actually exited or stopped, or nobody at all. To avoid confusion, also rename wait_finished to fits_the_spec. This fixes service keepalive functionality in SystemServer.
2020-05-23Kernel: Use TypedMapping for accessing IOAPIC registersAndreas Kling
2020-05-23Kernel: Add non-const version of TypedMapping::operator->()Andreas Kling
2020-05-23Kernel: Oops, we need to use map_typed_writable() for write access :^)Andreas Kling
2020-05-23Kernel: Use TypedMappings when looking for APIC informationAndreas Kling
2020-05-23Kernel+LibC: Fix various build issues introduced by ssize_tAndreas Kling
Now that ssize_t is derived from size_t, we have to
2020-05-23Kernel: Use TypedMappings in the very unfinished APIC codeAndreas Kling
2020-05-23Kernel+LibC: Let's say that off_t is a ssize_tAndreas Kling
2020-05-23Kernel: Add missing casts when calling AK::min()Andreas Kling
2020-05-23Kernel: Tweak some suspicious casts in InterruptManagementAndreas Kling
This code needs a closer looking-into at some point. It doesn't seem entirely safe to be casting u32's to pointers like it does.
2020-05-23Kernel: Dont't static_assert that size_t is 32-bit :^)Andreas Kling
2020-05-23Kernel: Use a FlatPtr for the "argument" to ioctl()Andreas Kling
Since it's often used to pass pointers, it should really be a FlatPtr.
2020-05-23Kernel: Simplify MP table parser a little bit moreAndreas Kling
Get rid of the ConfigurationTableEntryLength enum and just look at the sizeof() for each entry type.
2020-05-23Kernel: Make dump_backtrace_impl() take base pointer as a FlatPtrAndreas Kling
Since FlatPtr is register width agnostic. :^)
2020-05-22Kernel: Return ESPIPE when seeking an unseekableSergey Bugaev
This is what Dr. POSIX says it should do.
2020-05-22Kernel: Remove some now-unnecessary casts in ProcFSAndreas Kling
Now that we can pass arbitrary integer types to the JSON serialization code, we don't have to cast to u32 as much!
2020-05-22Kernel: Remove outdated FIXME's in the static ACPI parserAndreas Kling
We no longer blindly use PAGE_SIZE here. :^)
2020-05-22Kernel: Simplify scanning BIOS/EBDA and MP parser initializationAndreas Kling
Add a MappedROM::find_chunk_starting_with() helper since that's a very common usage pattern in clients of this code. Also convert MultiProcessorParser from a persistent singleton object to a temporary object constructed via a failable factory function.
2020-05-22Kernel: Add convenient ways to map whole BIOS and EBDA into memoryAndreas Kling
This patch adds a MappedROM abstraction to the Kernel VM subsystem. It's basically the read-only byte buffer equivalent of a TypedMapping. We use this in the ACPI and MP table parsers to scan for interesting stuff in low memory instead of doing a bunch of address arithmetic.
2020-05-22Kernel: Clean up and simplify MP table parsingAndreas Kling
Use map_typed<T> to map physically addressed structs into kernel VM. This is so much easier than doing address arithmetic everywhere. :^)
2020-05-22Ext2FS: Fix indirect-blocks iterationYonatan Goldschmidt
For singly-indirect blocks, "callback" is just "add_block". For doubly-indirect blocks, "callback" is the lambda function iterating on singly-indirect blocks: so instead of adding itself to the list, the doubly-indirect block will add all its childs, but they add themselves again when they run the callback of singly-indirect blocks. And nothing adds the doubly-indirect block itself :( This leads to a double free of all child blocks of the doubly-indirect block, which is the failed assert described in #1549. Closes: #1549.
2020-05-20Kernel: Fix invalid jump in case RDRAND failsAndreas Kling
If RDRAND doesn't give us data, we want to try again, not jump to some low address like 0x80 :^)
2020-05-20Revert "Kernel: Add implementation of operator new and delete to kmalloc.cpp"Andreas Kling
This reverts commit 6d0d8487201eb3cc8d63a1d066a0735a97cdc6e3.
2020-05-20Revert "Kernel: Don't link against libstdc++"Andreas Kling
This reverts commit bde7bc3472e0541583ed333efc42a3bde53881ad.
2020-05-20Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem"Andreas Kling
This reverts commit c1eb744ff0a82cf6c8e3470ac10e2f417c7d9de2.
2020-05-20Kernel: Always inline stac(), clac() and SmapDisablerAndreas Kling
Let's not be paying the function call overhead for these tiny ops. Maybe there's an argument for having fewer gadgets in the kernel but for now we're actually seeing stac() in profiles so let's put that above theoretical security issues.