Commit graph

17612 commits

Author SHA1 Message Date
Linus Groh
d0427b610c Documentation: Update build path in BuildInstructions.md
Build/ is now /Build/i686/. No need to mention other targets just yet.
2021-03-11 21:01:29 +01:00
Linus Groh
07f25ca6be Documentation: Clean up BuildInstructions.md a bit
- Fix headings
- Consistent & more accurate code block language specifiers
- Add some newlines where appropriate
- Remove the strange "run ninja but actually you don't have to run ninja
  as ninja install takes care of that" part
- Don't repeat specific build commands in "Ports" section
- Reword "Keymap" section to more generic "Customize disk image"
2021-03-11 21:01:29 +01:00
Linus Groh
e93a147f26 Meta: Remove old CLion-specific files
This is not needed anymore, and likely outdated anyway.
2021-03-11 21:01:29 +01:00
Andreas Kling
6e2a29d038 WindowServer: Don't open system menu on super key press while dragging 2021-03-11 19:00:24 +01:00
Andreas Kling
38f11cc1ba Everywhere: Rename "logo" key to "super" key
This seems to be the most common way to refer to this key, so let's
call it what people actually call it.
2021-03-11 18:55:16 +01:00
Andreas Kling
822d7da6cc Base: Make the default prompt a different color for root 2021-03-11 18:55:16 +01:00
Vyacheslav Pukhanov
4b99dbe644 FileManager: Accept TreeView drop event 2021-03-11 18:54:52 +01:00
Andreas Kling
cd745baa86 Meta: Add KMALLOC_DEBUG to all_the_debug_macros 2021-03-11 15:38:35 +01:00
Andreas Kling
b1e0e2ad4a Kernel: Suppress logging during kmalloc heap expansion
The system is extremely sensitive to heap allocations during heap
expansion. This was causing frequent OOM panics under various loads.

Work around the issue for now by putting the logging behind
KMALLOC_DEBUG. Ideally dmesgln() & friends would not reqiure any
heap allocations, but we're not there right now.

Fixes #5724.
2021-03-11 15:28:42 +01:00
AnotherTest
eb1ca965c7 LibLine: Cleanup the suggestions before inserting a new code point
Otherwise `reposition_cursor()` will move the cursor one character too
far to the right, and since we don't redraw the entire buffer when
the character is inserted at the end, the mistake won't be immediately
fixed by a complete redraw.
Fixes #5722
2021-03-11 14:47:56 +01:00
Andreas Kling
9853a9bc8a Kernel: Always protect process data immediately after construction 2021-03-11 14:46:48 +01:00
Andreas Kling
49a0f40ff0 Kernel: Inherit the dumpable flag on sys$fork()
This regressed at some point recently. All children were non-dumpable
until manually opting into it.
2021-03-11 14:35:37 +01:00
Andreas Kling
1608ef37d8 Kernel: Move process termination status/signal into protected data 2021-03-11 14:24:08 +01:00
Andreas Kling
4916b5c130 Kernel: Move process thread lists into protected data 2021-03-11 14:21:49 +01:00
Andreas Kling
1b2ea12062 AK: Add basic const iteration to IntrusiveList 2021-03-11 14:21:49 +01:00
Andreas Kling
b7b7a48c66 Kernel: Move process signal trampoline address into protected data 2021-03-11 14:21:49 +01:00
Andreas Kling
08e0e2eb41 Kernel: Move process umask into protected data :^) 2021-03-11 14:21:49 +01:00
Andreas Kling
90c0f9664e Kernel: Don't keep protected Process data in a separate allocation
The previous architecture had a huge flaw: the pointer to the protected
data was itself unprotected, allowing you to overwrite it at any time.

This patch reorganizes the protected data so it's part of the Process
class itself. (Actually, it's a new ProcessBase helper class.)

We use the first 4 KB of Process objects themselves as the new storage
location for protected data. Then we make Process objects page-aligned
using MAKE_ALIGNED_ALLOCATED.

This allows us to easily turn on/off write-protection for everything in
the ProcessBase portion of Process. :^)

Thanks to @bugaevc for pointing out the flaw! This is still not perfect
but it's an improvement.
2021-03-11 14:21:49 +01:00
Andreas Kling
4fcc637e29 Kernel: Add MAKE_ALIGNED_ALLOCATED helper macro
This macro inserts operator new/delete into a class, allowing you
to very easily specify a specific heap alignment.
2021-03-11 14:21:49 +01:00
Andreas Kling
96fb3d4a11 Kernel: Add MemoryManager::set_page_writable_direct()
This helper function goes directly to the page tables and makes a
virtual address writable or non-writable.
2021-03-11 14:21:49 +01:00
Andreas Kling
40f2abf7c3 Kernel: Allow kmalloc_aligned() alignment up to 4096
This allows us to get kmalloc() memory aligned to the VM page size.
2021-03-11 14:21:49 +01:00
Andreas Kling
a7b6282086 Kernel: Silence debug spam about chown and symlink during boot 2021-03-11 14:21:49 +01:00
Ben Wiederhake
c436c3e13d Toolchain: Remove unnecessary file from commit
This file is never read by gcc, and the filename looks like it was never meant to be added.
2021-03-11 12:32:53 +01:00
Ben Wiederhake
f38a6b18b5 crash: Fix more typos in check logic
These caused no test to run for '-f' and mmap to fail, respectively.
2021-03-11 12:32:53 +01:00
Ben Wiederhake
798dea7a49 crash: Fix typo in check logic
The remainder of the code assumes that the mmap was successful,
so the 'unexpected error' case is that we see MAP_FAILED.
2021-03-11 12:32:53 +01:00
Ben Wiederhake
bceb98e2df Userland: Remove superfluous headers
Userland has no reason to access 'kmalloc'.
2021-03-11 12:32:53 +01:00
Ben Wiederhake
2cd0793578 xargs: Fix boring memory leak
It's only 1K (BUFSIZ), and it's immediately before xargs finishes anyway.
However, I ran into it and know how to fix it, so let's clean this up.
2021-03-11 12:32:53 +01:00
Ben Wiederhake
292871c4bc UserspaceEmulator: Handle MAP_FIXED with invalid addresses better
Old behavior: Crash due to VERIFY, unless we're completely and entirely out of
memory (m_available_ranges being empty), in which case it would return -ENOMEM.

New behavior: Return ENOMEM (and don't crash). In the case of nullptr,
also emit a helpful diagnostic.

Note that MAP_FIXED with nullptr is technically okay, but tends to be a sign
that something went wrong.

Also, this should improve mmap performance marginally, as it pulls the check out
of a loop that does not modify any parts of the check.

UE is now self-hosting! Fixes #5709.

However, this still needs some love: "ue UserspaceEmulator true" spits out tons
of error messages, probably false-positives, and takes about 229 seconds to run.
Then again, true-in-ue-in-ue-in-Qemu is three levels of emulation, so no wonder
it takes a long time! :D
2021-03-11 08:54:54 +01:00
Ben Wiederhake
22d9bd0c45 UserspaceEmulator: Do not pass MAP_FIXED to Kernel
Since there is usually no correlation between guest memory-layout and UE memory-layout,
this option does not make any sense. Especially since we provide nullptr.
2021-03-11 08:54:54 +01:00
Ben Wiederhake
d5925f33aa UserspaceEmulator: Implement set_process_name syscall 2021-03-11 08:54:54 +01:00
Ben Wiederhake
ec8e3edd05 UserspaceEmulator: Split large file into logical pieces 2021-03-11 08:54:54 +01:00
Luke
4477a0d6fd LibWeb: Remove FIXME in is_javascript_mime_type_essence_match
This was misleading. The spec just wants us to check a string matches
a string in the JavaScript MIME type essence list. It doesn't want us
to parse the string as a MIME type to then use its essence for the
check.

Renames "mime_type" to "string" to make this less misleading.
2021-03-11 08:30:02 +01:00
Tom
929c90f8c8 Meta: Add gdb command to serenity.sh
This uses tmux for a split screen setup, which makes it easy do debug
the kernel while viewing the QEMU output in the same terminal.
2021-03-11 08:29:23 +01:00
Andreas Kling
de6c5128fd Kernel: Move process pledge promises into protected data 2021-03-10 22:50:00 +01:00
Andreas Kling
37ad880660 Kernel: Move process "dumpable" flag into protected data 2021-03-10 22:42:07 +01:00
Andreas Kling
3d27269f13 Kernel: Move process parent PID into protected data :^) 2021-03-10 22:30:02 +01:00
Andreas Kling
d677a73b0e Kernel: Move process extra_gids into protected data :^) 2021-03-10 22:30:02 +01:00
Andreas Kling
cbcf891040 Kernel: Move select Process members into protected memory
Process member variable like m_euid are very valuable targets for
kernel exploits and until now they have been writable at all times.

This patch moves m_euid along with a whole bunch of other members
into a new Process::ProtectedData struct. This struct is remapped
as read-only memory whenever we don't need to write to it.

This means that a kernel write primitive is no longer enough to
overwrite a process's effective UID, you must first unprotect the
protected data where the UID is stored. :^)
2021-03-10 22:30:02 +01:00
Andreas Kling
839d2d70a4 Kernel: Add non-const KBuffer::impl() getter 2021-03-10 22:30:02 +01:00
Andreas Kling
a77ecac900 fuzz-syscalls: Mark sys$emuctl() as someone who returns ENOSYS
This syscall is only relevant inside UserspaceEmulator and the kernel
will just return ENOSYS for it.
2021-03-10 16:36:11 +01:00
Andreas Kling
9b5c9efd73 Kernel: Build with -Wvla
Now that all use of VLA's (variable-length arrays) has been purged from
the kernel, let's make sure we don't reintroduce them.
2021-03-10 16:33:55 +01:00
Andreas Kling
e58a600d52 Kernel: Remove VLA usage in Ext2FS block traversal code
This was using up to 12KB of kernel stack in the triply indirect case
and looks generally spooky. Let's just allocate a ByteBuffer for now
and take the performance hit (of heap allocation). Longer term we can
reorganize the code to reduce the majority of the heap churn.
2021-03-10 16:33:47 +01:00
Andreas Kling
3dbb9c8448 Kernel: Turn a VLA into a statically-sized array in dump_backtrace() 2021-03-10 16:23:11 +01:00
Andreas Kling
ced8dfa037 UserspaceEmulator: Remove debug spam about tracked malloc blocks 2021-03-10 15:21:26 +01:00
Brendan Coles
0e18c7ffda Documentation: Add Serenity installation guide for VMware 2021-03-10 11:59:32 +01:00
Andreas Kling
54f6436598 Kernel: Convert klog() => dmesgln() in TCPSocket 2021-03-09 23:06:47 +01:00
Andreas Kling
b007bc07b7 Kernel: Convert klog() => dmesgln() in MemoryManager 2021-03-09 22:44:04 +01:00
Andreas Kling
232738fb7a Kernel: Use dbgln_if() and PANIC() in Thread.cpp 2021-03-09 22:35:51 +01:00
Andreas Kling
c67d550df1 Kernel: Convert klog() => dmesgln() in IPv4Socket 2021-03-09 22:25:09 +01:00
Andreas Kling
b12734cf13 Kernel: Convert klog() => dmesgln() in PageDirectory 2021-03-09 22:10:41 +01:00