Liav A
ecee76b741
Kernel: Change Ext2FS to be backed by a file instead of a block device
...
In contrast to the previous patchset that was reverted, this time we use
a "special" method to access a file with block size of 512 bytes (like
a harddrive essentially).
2020-04-06 15:36:36 +02:00
Liav A
a7d708e47d
Kernel: Don't enumerate blocks of ext2 symlinks by default
...
Also, we assert if we encounter a block that is bigger than blocks
count in the superblock.
Fixes #1608 .
2020-04-05 15:27:31 +02:00
Andreas Kling
1d468ed6d3
AK: Stop allowing implicit downcast with RefPtr and NonnullRefPtr
...
We were allowing this dangerous kind of thing:
RefPtr<Base> base;
RefPtr<Derived> derived = base;
This patch changes the {Nonnull,}RefPtr constructors so this is no
longer possible.
To downcast one of these pointers, there is now static_ptr_cast<T>:
RefPtr<Derived> derived = static_ptr_cast<Derived>(base);
Fixing this exposed a ton of cowboy-downcasts in various places,
which we're now forced to fix. :^)
2020-04-05 11:19:00 +02:00
Andreas Kling
53d0ca2ad8
Kernel: Strip SUID+SGID bits from file when written to or chowned
...
Fixes #1624 .
2020-04-04 19:46:55 +02:00
Andreas Kling
54cb1e36b6
Kernel: Enforce file system veil on file creation
...
Fixes #1621 .
2020-04-04 16:41:39 +02:00
Andreas Kling
c2a8bbcb59
Revert "Kernel: Change Ext2FS to be backed by a file instead of a block device"
...
This reverts commit 6b59311d4b
.
Reverting these changes since they broke things.
Fixes #1608 .
2020-04-03 21:29:03 +02:00
Liav A
6b59311d4b
Kernel: Change Ext2FS to be backed by a file instead of a block device
...
This ensures that we can mount image files as virtual disks without the
need of implementing gross hacks like loopback devices :)
2020-04-02 12:03:08 +02:00
Liav A
2f2016f51d
Kernel: Remove unnecessary printf specifier
2020-04-02 12:03:08 +02:00
Andreas Kling
7d862dd5fc
AK: Reduce header dependency graph of String.h
...
String.h no longer pulls in StringView.h. We do this by moving a bunch
of String functions out-of-line.
2020-03-23 13:48:44 +01:00
Shannon Booth
81adefef27
Kernel: Run clang-format on files
...
Let's rip off the band-aid
2020-03-22 01:22:32 +01:00
Alex Muscar
d013753f83
Kernel: Resolve relative paths when there is a veil ( #1474 )
2020-03-19 09:57:34 +01:00
marprok
3cbc2f4381
Ext2FS: Reset the found_a_group flag
2020-03-12 12:35:00 +01:00
Andreas Kling
3803196edb
Kernel: Get rid of SmapDisabler in sys$fstat()
2020-03-10 13:34:24 +01:00
Andreas Kling
fa9fba6901
Kernel: Add missing #includes now that <AK/StdLibExtras.h> is smaller
2020-03-08 13:06:51 +01:00
Liav A
f3f8b88d8f
Kernel: Fix syntax error in FIFO_DEBUG
2020-03-06 22:29:24 +01:00
Andreas Kling
c6693f9b3a
Kernel: Simplify a bunch of dbg() and klog() calls
...
LogStream can handle VirtualAddress and PhysicalAddress directly.
2020-03-06 15:00:44 +01:00
Andreas Kling
75a6b27f73
Ext2FS: Remove unused allocate_block()
...
We only use allocate_blocks() now. If you want a single block, you can
just call allocate_blocks() with a count of 1.
2020-03-06 11:22:23 +01:00
Liav A
7ef5d222f1
Kernel: Change data in /proc/interrupts to be more richer
...
Also, during interrupt handlers' enumeration, we call all interrupts
handlers that are not UnhandledInterruptHandler.
2020-03-06 11:19:51 +01:00
Andreas Kling
8bb361889c
AK: Remove Optional::operator bool()
...
This was causing some obvious-in-hindsight but hard to spot bugs where
we'd implicitly convert the bool to an integer type and carry on with
the number 1 instead of the actual value().
2020-03-06 10:32:58 +01:00
Liav A
f0ca29eb4b
Kernel: Run clang-format on various files
2020-03-02 22:23:39 +01:00
Liav A
0fc60e41dd
Kernel: Use klog() instead of kprintf()
...
Also, duplicate data in dbg() and klog() calls were removed.
In addition, leakage of virtual address to kernel log is prevented.
This is done by replacing kprintf() calls to dbg() calls with the
leaked data instead.
Also, other kprintf() calls were replaced with klog().
2020-03-02 22:23:39 +01:00
Andreas Kling
7cd1bdfd81
Kernel: Simplify some dbg() logging
...
We don't have to log the process name/PID/TID, dbg() automatically adds
that as a prefix to every line.
Also we don't have to do .characters() on Strings passed to dbg() :^)
2020-02-29 13:39:06 +01:00
Andreas Kling
5f7056d62c
Kernel: Expose the VMObject type of each Region in /proc/PID/vm
2020-02-28 23:25:40 +01:00
Andreas Kling
8fbdda5a2d
Kernel: Implement basic support for sys$mmap() with MAP_PRIVATE
...
You can now mmap a file as private and writable, and the changes you
make will only be visible to you.
This works because internally a MAP_PRIVATE region is backed by a
unique PrivateInodeVMObject instead of using the globally shared
SharedInodeVMObject like we always did before. :^)
Fixes #1045 .
2020-02-28 23:25:00 +01:00
Andreas Kling
aa1e209845
Kernel: Remove some unnecessary indirection in InodeFile::mmap()
...
InodeFile now directly calls Process::allocate_region_with_vmobject()
instead of taking an awkward detour via a special Region constructor.
2020-02-28 20:29:14 +01:00
Andreas Kling
07a26aece3
Kernel: Rename InodeVMObject => SharedInodeVMObject
2020-02-28 20:07:51 +01:00
Liav A
b0d40e9495
Ext2Filesystem: Use dbg() instead of dbgprintf()
2020-02-27 13:05:12 +01:00
Liav A
67994cd87e
ProcFS: Use dbg() instead of dbgprintf()
2020-02-27 13:05:12 +01:00
Liav A
03592a80fc
FIFO: Use dbg() instead of dbgprintf()
2020-02-27 13:05:12 +01:00
Andreas Kling
d5fe839166
Kernel: Remove unused artifacts of the Custody cache
...
We'll probably want some kind of Custody caching in the future, but as
it's not used at the moment, let's simplify things a bit.
2020-02-26 15:25:53 +01:00
Andreas Kling
7f9a86b495
ProcFS: Expose the physical page map of each region in /proc/PID/vm
...
You can now see the state of each underlying physical page slot in a
VM region.
2020-02-25 23:06:40 +01:00
Andreas Kling
ceec1a7d38
AK: Make Vector use size_t for its size and capacity
2020-02-25 14:52:35 +01:00
Liav A
fe664965c2
Kernel: Change get_sharing_devices_count() in GenericInterruptHandler
...
The new method' name is sharing_devices_count().
The Serenity Coding Style tends to not accept the word "get" in
methods' names if possible.
2020-02-24 11:27:03 +01:00
Liav A
80eea6cd8b
Kernel: Create an entry for viewing interrupts in ProcFS
2020-02-24 11:27:03 +01:00
Andreas Kling
0763f67043
AK: Make Bitmap use size_t for its size
...
Also rework its API's to return Optional<size_t> instead of int with -1
as the error value.
2020-02-24 09:56:07 +01:00
Andreas Kling
97e9deccf0
Ext2FS: Add Missing HashMap.h include
2020-02-22 16:37:51 +01:00
Andreas Kling
3e973bfe14
Kernel: Make FileDescription slab-allocated
2020-02-22 14:37:58 +01:00
Andreas Kling
6428669a37
Kernel: Make Custody slab-allocated
2020-02-22 14:33:51 +01:00
Andreas Kling
983b4bd9f2
Kernel+ProfileViewer: Move symbolication to userspace for time profiles
...
This makes the time profiles look like the memory profiles so we can
use the userspace symbolication code in ProfileViewer.
2020-02-22 10:09:54 +01:00
Andreas Kling
b6887bd9cd
Ext2FS: The max current block count of a file is size/block_size
...
Turns out that i_blocks does not take block list holes into account.
2020-02-21 19:07:23 +01:00
Andreas Kling
59c052a72a
Ext2FS: Allow holes in block lists
...
Linux creates holes in block lists for all-zero content. This is very
reasonable and we can now handle that situation as well.
Note that we're not smart enough to generate these holes ourselves yet,
but now we can at least read from such files.
2020-02-21 17:50:51 +01:00
Sergey Bugaev
1d2986ea15
Kernel: Fix a panic in VFS::rename()
...
If we get an -ENOENT when resolving the target because of some part, that is not
the very last part, missing, we should just return the error instead of panicking
later :^)
To test:
$ mkdir /tmp/foo/
$ mv /tmp/foo/ /tmp/bar/
Related to https://github.com/SerenityOS/serenity/issues/1253
2020-02-20 19:13:20 +01:00
Sergey Bugaev
3439498744
Kernel: Support trailing slashes in VFS::mkdir()
...
This is apparently a special case unlike any other, so let's handle it
directly in VFS::mkdir() instead of adding an alternative code path into
VFS::resolve_path().
Fixes https://github.com/SerenityOS/serenity/issues/1253
2020-02-20 19:13:20 +01:00
Andreas Kling
88b9fcb976
AK: Use size_t for ByteBuffer sizes
...
This matches what we already do for string types.
2020-02-20 13:20:34 +01:00
Andreas Kling
a7dbb3cf96
Kernel: Use a FixedArray for a process's extra GIDs
...
There's not really enough of these to justify using a HashTable.
2020-02-18 11:35:47 +01:00
Andreas Kling
48f7c28a5c
Kernel: Replace "current" with Thread::current and Process::current
...
Suggested by Sergey. The currently running Thread and Process are now
Thread::current and Process::current respectively. :^)
2020-02-17 15:04:27 +01:00
Andreas Kling
635ae70b8f
Kernel: More header dependency reduction work
2020-02-16 02:15:33 +01:00
Andreas Kling
16818322c5
Kernel: Reduce header dependencies of Process and Thread
2020-02-16 02:01:42 +01:00
Andreas Kling
e28809a996
Kernel: Add forward declaration header
2020-02-16 01:50:32 +01:00
Andreas Kling
a356e48150
Kernel: Move all code into the Kernel namespace
2020-02-16 01:27:42 +01:00