Commit Graph

16727 Commits

Author SHA1 Message Date
Ben Wiederhake
363cc09091 Meta: Fix debug-flag detection
Detection broke when we moved from '#ifdef DEBUG_FOO dbgln()' to 'dbgln<DEBUG_FOO>()'.
This patch makes detection more general, which sadly runs into more false-positives.

No rotten code was found, hooray! :^)
2021-02-13 19:50:31 +01:00
Itamar
c2e5bc442d LanguageServers/cpp: Use parser-based autocomplete engine by default 2021-02-13 19:50:09 +01:00
Itamar
715933ce8b HackStudio: Handle crash of the LanguageServer gracefully
Previously, HackStudio exited whenever a LanguageServer crashed.

Now, we disconnect all clients from that language server instance and
show a nice notification.
2021-02-13 19:50:09 +01:00
Itamar
8ace2cfa18 LibCpp: Fix lexing & parsing of non-terminated strings 2021-02-13 19:50:09 +01:00
Itamar
2da5ecba41 LanguageServers/Cpp: Handle autocomplete request on an empty line 2021-02-13 19:50:09 +01:00
Itamar
18a9b66f10 HackStudio: Set icon for 'make is not available' notification 2021-02-13 19:50:09 +01:00
Nick Vella
b671577223 HackStudio: Project templates and New Project dialog
This commit adds a simple project template system to HackStudio,
as well as a pretty New Project dialog, inspired by early VS.NET
and MS Office.
2021-02-13 19:49:30 +01:00
Nick Vella
a6fdc17f3f LibGUI: add 'always_wrap_item_labels' property to IconView.
In some circumstances (like template selection dialogs,) displaying as much
item label as possible, on all items, may be desired.

The default setting is 'false', which matches the default behaviour from before;
only wrapping on hover or selection.
2021-02-13 19:49:30 +01:00
Paul Scharnofske
35a1e12459 AK+Format: Don't cast to size_t when you want u64.
In Serenity, size_t is defined as u32, thus static_cast<size_t>(value)
truncates the value.
2021-02-13 19:47:06 +01:00
Tom
b445f15131 Kernel: Avoid flushing the tlb if there's only one thread
If we're flushing user space pointers and the process only has one
thread, we do not need to broadcast this to other processors as
they will all discard that request anyway.
2021-02-13 19:46:45 +01:00
Andreas Kling
40a5487bab LibELF: Unmap and close the main executable after dynamic load
We don't need to keep the whole main executable in memory after
completing the dynamic loading process. We can also close the fd.
2021-02-13 13:46:20 +01:00
Luke
5b891b0c36 Lagom/Fuzzers: Add RSA key parser fuzzer
First issue: #5317
2021-02-13 11:03:06 +01:00
thankyouverycool
94e494d6d2 FileManager: Add layout options to View menu
File Manager's toolbar, location bar, status bar and folder pane
can now be toggled on/off
2021-02-13 11:01:59 +01:00
thankyouverycool
cb42ba0ab1 FileManager: Save 'Show dotfiles' setting in FileManager.ini 2021-02-13 11:01:59 +01:00
thankyouverycool
f9c1918484 TextEditor: Set wrapping and preview menus to correct defaults 2021-02-13 11:01:59 +01:00
thankyouverycool
5a03b326a7 TextEditor: Add layout options to View menu
Toolbar, status bar, and ruler can now be toggled on/off and their
settings are saved in ~/.config/TextEditor.ini
2021-02-13 11:01:59 +01:00
Andreas Kling
c877612211 Kernel: Round down base of partial ranges provided to munmap/mprotect
We were failing to round down the base of partial VM ranges. This led
to split regions being constructed that could have a non-page-aligned
base address. This would then trip assertions in the VM code.

Found by fuzz-syscalls. :^)
2021-02-13 01:49:44 +01:00
Andreas Kling
af0e52ca54 Kernel: Don't assert on sys$setsockopt() with unexpected level
Just error out with ENOPROTOOPT instead.

Found by fuzz-syscalls. :^)
2021-02-13 01:29:28 +01:00
Andreas Kling
a5def4e98c Kernel: Sanity check the VM range when constructing a Region
This should help us catch bogus VM ranges ending up in a process's
address space sooner.
2021-02-13 01:18:03 +01:00
Andreas Kling
62f0f73bf0 Kernel: Limit the number of file descriptors sys$poll() can handle
Just slap an arbitrary limit on there so we don't panic if somebody
asks us to poll 1 fajillion fds.

Found by fuzz-syscalls. :^)
2021-02-13 01:18:03 +01:00
Andreas Kling
7551090056 Kernel: Round up ranges to page size multiples in munmap and mprotect
This prevents passing bad inputs to RangeAllocator who then asserts.

Found by fuzz-syscalls. :^)
2021-02-13 01:18:03 +01:00
Andreas Kling
e1dbf74f15 LibJS: Add some basic freelist validation for the GC heap
When using the freelist, we now validate that the entries are actual
cell pointers within the current HeapBlock.
2021-02-13 00:40:49 +01:00
Ben Wiederhake
46e5890152 Kernel: Add forgotten 'const' flag 2021-02-13 00:40:31 +01:00
Ben Wiederhake
546cdde776 Kernel: clock_nanosleep's 'flags' is not a bitset
This had the interesting effect that most, but not all, non-zero values
were interpreted as an absolute value.
2021-02-13 00:40:31 +01:00
Ben Wiederhake
e1db8094b6 Kernel: Avoid casting arbitrary user-controlled int to enum
This caused a load-invalid-value warning by KUBSan.

Found by fuzz-syscalls. Can be reproduced by running this in the Shell:

    $ syscall waitid [ 1234 ]
2021-02-13 00:40:31 +01:00
Ben Wiederhake
9452281bec Tests: Merge and extend syscall tests into a syscall fuzzer
This found the previous bugs :^)
2021-02-13 00:40:31 +01:00
Ben Wiederhake
c6027ed7cc Kernel: Refuse excessively long iovec list
If a program attempts to write from more than a million different locations,
there is likely shenaniganery afoot! Refuse to write to prevent kmem exhaustion.

Found by fuzz-syscalls. Can be reproduced by running this in the Shell:

    $ syscall writev 1 [ 0 ] 0x08000000
2021-02-13 00:40:31 +01:00
Ben Wiederhake
987b7f7917 Kernel: Forbid empty and whitespace-only process names
Those only exist to confuse the user anyway.

Found while using fuzz-syscalls.
2021-02-13 00:40:31 +01:00
Ben Wiederhake
4c42d1e35a Kernel: Do not try to print the string that cannot be read
What a silly bug :^)

Found by fuzz-syscalls. Can be reproduced by running this in the Shell:

    $ syscall set_thread_name 14 14 14
2021-02-13 00:40:31 +01:00
Ben Wiederhake
1e630fb78a Kernel: Avoid creating unkillable processes
Found by fuzz-syscalls. Can be reproduced by running this in the Shell:

    $ syscall exit_thread

This leaves the process in the 'Dying' state but never actually removes it.

Therefore, avoid this scenario by pretending to exit the entire process.
2021-02-13 00:40:31 +01:00
Ben Wiederhake
5963f2084e Utilities: Make syscall(1) explain what it's doing 2021-02-13 00:40:31 +01:00
Ben Wiederhake
cb9a9a3e03 Utilities: Enable syscall(1) to use SC_*_params buffers 2021-02-13 00:40:31 +01:00
Ben Wiederhake
244c81bcf2 Utilities: Make syscall(1) use Core::ArgsParser
Note that this should not change the behavior at all.
2021-02-13 00:40:31 +01:00
Ben Wiederhake
b5e5e43d4b Kernel: Fix typo 2021-02-13 00:40:31 +01:00
Ben Wiederhake
caeb41d92b Kernel: Don't crash on syscall with kernel-space argument
Fixes #5198.
2021-02-13 00:40:31 +01:00
Tom
58cf1987bf Themes: Basalt's title text shadow shouldn't be transparent
Fixes pixels bleeding through from behind.
2021-02-13 00:39:33 +01:00
Tom
0138f13bfe WindowServer: Improvements to support alpha channel in window frames
This fixes some issues handling the alpha channel that may be present
in rendered window frames.

Fixes #5303
2021-02-13 00:39:33 +01:00
Andreas Kling
9ae02d4c92 Kernel: Don't use a VLA for outgoing UDP packets
We had the same exact problem as da981578e3 but for UDP sockets.
2021-02-12 23:46:15 +01:00
Andreas Kling
da981578e3 Kernel: Don't use a VLA for outgoing TCP packets
Since the payload size is user-controlled, this could be used to
overflow the kernel stack.

We should probably also be breaking things into smaller packets at a
higher level, e.g TCPSocket::protocol_send(), but let's do that as
a separate exercise.

Fixes #5310.
2021-02-12 23:00:25 +01:00
Sahan Fernando
e47af3044a SystemMonitor: Use system color themes for graph widgets 2021-02-12 22:04:40 +01:00
Linus Groh
feb66564d2 AK: Set DBGLN_NO_COMPILETIME_FORMAT_CHECK for any clang, not just < 12
This currently breaks the OSS-Fuzz build, and attempts to make it build
with clang >= 12 were unsuccessful, so let's just disable dbgln() checks
for any clang version.
2021-02-12 19:19:43 +01:00
Linus Groh
ca69cab532 Revert "AK: Fix build with Clang>=12"
This reverts commit 338bb73289.

This didn't work, the OSS-Fuzz build (using clang 12) is still failing.
We'll just disable dbgln() checks when compiling with any clang for now.
2021-02-12 19:19:43 +01:00
Andreas Kling
29045f84d4 Kernel: Decrease default userspace stack size to 1 MiB
Not sure why this was 4 MiB in the first place, but that's a lot of
memory to reserve for each thread when we're running with 512 MiB
total in the default testing setup. :^)
2021-02-12 19:17:09 +01:00
Andreas Kling
e8d3856736 LibJS: Randomize GC heap block locations
Allocate GC heap blocks with mmap(MAP_RANDOMIZED) for ASLR.

This may very well be too aggressive in terms of fragmentation, and we
can figure out ways to scale that back once it becomes a big problem.

For now, this makes the GC heap a lot less predictable for an attacker.
2021-02-12 19:15:59 +01:00
Andreas Kling
e050577f0a Kernel: Make MAP_RANDOMIZED honor alignment requests
Previously, we only cared about the alignment on the fallback path.
2021-02-12 19:15:59 +01:00
Andreas Kling
4e2802bf91 Kernel: Move region dumps from dmesg to debug log
Also fix a broken format string caught by the new format string checks.
2021-02-12 16:33:58 +01:00
Andreas Kling
1ef43ec89a Kernel: Move get_interpreter_load_offset() out of Process class
This is only used inside the sys$execve() implementation so just make
it a execve.cpp local function.
2021-02-12 16:30:29 +01:00
Andreas Kling
ca1c560161 Base: Don't mark "prot_exec" pledge promise as a SerenityOS extension
OpenBSD also has this promise.
2021-02-12 16:24:40 +01:00
Andreas Kling
c4db224c94 Kernel: Convert klog() => dmesgln() / dbgln() in MemoryManager 2021-02-12 16:24:40 +01:00
Andreas Kling
5af69d6e93 Kernel: Convert klog() to dmesgln() in RangeAllocator 2021-02-12 16:24:40 +01:00