Commit Graph

16738 Commits

Author SHA1 Message Date
Andreas Kling
1593219a41 Kernel: Map signal trampoline into each process's address space
The signal trampoline was previously in kernelspace memory, but with
a special exception to make it user-accessible.

This patch moves it into each process's regular address space so we
can stop supporting user-allowed memory above 0xc0000000.
2021-02-14 01:33:17 +01:00
Andreas Kling
3551198f99 Website: Add vakzz's exploit & writeup to the bounty page 2021-02-14 01:33:17 +01:00
Andreas Kling
ffdfbf1dba Kernel: Fix wrong sizeof() type in sys$execve() argument overflow check 2021-02-14 00:15:01 +01:00
Andreas Kling
34a83aba71 Kernel: Convert klog() => dbgln()/dmesgln() in Arch/i386/CPU.cpp 2021-02-13 21:51:16 +01:00
Andreas Kling
dc42b4565b LibIPC: Oops, fix busted dbgln() format string (thanks, checker!) 2021-02-13 20:37:05 +01:00
Andreas Kling
05bb11f482 LibIPC: Make received file descriptors close-on-exec by default
I noticed that programs running in the terminal had an open file
descriptor for the system theme buffer, inherited from the Terminal.

Let's be nice and always mark incoming fds with FD_CLOEXEC.
2021-02-13 20:13:51 +01:00
Linus Groh
2ed7f75e95 LibJS: Return empty value on exception in Date.parse(), not NaN
This is discarded anyway, so let's not confuse ourselves by returning a
NaN number value that's not going to be used.
2021-02-13 19:58:51 +01:00
Linus Groh
db340ae7aa LibJS: Add missing exception check in Date() constructor 2021-02-13 19:58:51 +01:00
Tom
ddbd88d5c6 LibGfx: Enable Painter::blit to apply opacity and mix alpha channels
This enables us to properly render windows that use both opacity and
alpha channels.
2021-02-13 19:57:31 +01:00
Jean-Baptiste Boric
9ce0639383 Kernel: Use divide_rounded_up inside write_block_list_for_inode 2021-02-13 19:56:49 +01:00
Jean-Baptiste Boric
869b33d6dd Kernel: Support triply indirect blocks for BlockListShape computation 2021-02-13 19:56:49 +01:00
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