Commit Graph

16351 Commits

Author SHA1 Message Date
Linus Groh
ec57c6c836 Meta: Fix sync-local.sh file check
Missing '{'. Thanks to @BenWiederhake for noticing!
2021-01-30 22:49:02 +01:00
Andreas Kling
f3e85e43c7 LibWeb: Handle WebContent process crashes gracefully :^)
The OOPWV will now detect WebContent process crashes/disconnections and
simply create a new WebContent process in its place. We also generate a
little error page with a link to the crashing URL so you can reload and
try again.

This a huge step forward for OOPWV since it now has a feature that IPWV
can never replicate. :^)
2021-01-30 18:27:39 +01:00
AnotherTest
322936115e LibProtocol: Bump download stream buffer to PAGE_SIZE
I think this should scale based on the network speed (or download
rate?), but for the time being, 4K seems to be good-enough.
2021-01-30 14:12:14 +01:00
AnotherTest
904e1002b8 pro: Use a rolling average for the download rate calculation
This makes it jump around less, and give a decent-ish representation of
download speed.
2021-01-30 14:12:14 +01:00
AnotherTest
bdda1600d0 WebServer: Stream the downloaded files
...instead of reading them into memory first.
This makes it possible to download large files from WebServer.
2021-01-30 14:12:14 +01:00
Brendan Coles
58abdde2e4 Inspector: Allow browsing inspection data in UI after process exits 2021-01-30 14:10:10 +01:00
Matteo Sozzi
f80b40b411 HackStudio: do not toggle_index in open_project
When opening a new project `m_prject_tree_view->toggle_index()` is not
needed because `m_project_tree_view->set_model()` already updates the
indexes.
2021-01-30 14:08:41 +01:00
Andreas Kling
d9c5fdf5d5 LibGUI: Handle Window::hide() during Application teardown better
If a window is being torn down during app shutdown, the global
application pointer may be nulled out already. So let's handle that
case gracefully in Window::hide().
2021-01-30 14:03:53 +01:00
Andreas Kling
5bf9999652 LibELF: Add a bunch of overflow checks in ELF validation 2021-01-30 13:54:24 +01:00
Andreas Kling
90343eeaeb Revert "Kernel: Return -ENOTDIR for non-directory mount target"
This reverts commit b7b09470ca.

Mounting a file on top of a file is a valid thing we support.
2021-01-30 13:52:12 +01:00
Andreas Kling
dc17e01c99 AK: Allow Checked += Checked, and other such operations
The overflow state from both Checkeds is OR'ed in the result.
2021-01-30 13:52:12 +01:00
Linus Groh
6b7c96589b Everywhere: Add missing parent window to about dialogs
Partially addresses #5177.
2021-01-30 13:42:39 +01:00
Linus Groh
1a2b693242 HexEditor: Fix about dialog icon 2021-01-30 13:42:39 +01:00
Linus Groh
5b43419a63 SystemMonitor: Handle PCIDB::Database::open() failure gracefully
No need to dereference the nullptr, let's just show raw IDs instead.
2021-01-30 13:42:15 +01:00
Andreas Kling
9b0ca75f84 LibWeb: Add Frame::ViewportClient and use it for Layout::ImageBox
Image boxes want to know whether they are inside the visible viewport.
This is used to pause/resume animations, and to update the purgeable
memory volatility state.

Previously we would traverse the entire layout tree on every resize,
calling a helper on each ImageBox. Make those boxes register with the
frame they are interested in instead, saving us all that traversal.

This also makes it easier for other parts of the code to learn about
viewport changes in the future. :^)
2021-01-30 12:29:11 +01:00
Andreas Kling
1c6f278677 LookupServer: Unbreak reverse DNS lookups
We were ignoring everything but A records in DNS responses. This broke
reverse lookups which obviously want the PTR records.

Fix this by filtering on the requested record type instead of always A.
2021-01-30 12:06:51 +01:00
Andreas Kling
489d413fc7 LookupServer: Be a little more robust in case accept() fails 2021-01-30 11:55:21 +01:00
Andreas Kling
5cbc9d5724 LookupServer: Don't create Core::Object on the stack 2021-01-30 11:43:09 +01:00
Andreas Kling
553361d83f LibC: Protect the atexit() handler list when not writing to it
Remap the list of atexit handlers as read-only while we're not actively
writing to it. This prevents an attacker from using a memory write
primitive to gain code execution via the atexit list.

This is based on a technique used in OpenBSD. :^)
2021-01-30 10:41:36 +01:00
Andreas Kling
123c37e1c0 Kernel: Fix mix-up between MAP_STACK/MAP_ANONYMOUS in prot validation 2021-01-30 10:30:17 +01:00
Andreas Kling
e55ef70e5e Kernel: Remove "has made executable exception for dynamic loader" flag
As Idan pointed out, this flag is actually not needed, since we don't
allow transitioning from previously-executable to writable anyway.
2021-01-30 10:06:52 +01:00
Andreas Kling
5b37c0a71a LibC: Convert remaining String::format() to formatted()/number() 2021-01-30 09:29:51 +01:00
Ben Wiederhake
ec91f8ad1d LibELF: Avoid quadratic memory usage weakness
Section names are referred to by offset and length. We do not check
(and probably should not check) whether these names overlap in any way.
This opened the door to many sections (in this example: about 2700)
forcing ELF::Image::m_sections to contain endless copies of the same
huge string (in this case: 882K).

Fix this by loading only the first PAGE_SIZE bytes of each name.
Since section names are only relevant for relocations and debug
information and most section names are hard-coded (and far below 4096
bytes) anyway, this should be no restriction at all for 'normal'
executables.

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29187
2021-01-30 09:25:02 +01:00
Ben Wiederhake
4332dfb964 LibGfx: Fix dynamic bitmasks in BMPs
I overlooked a corner case where we might call the built-in ctz() on zero.

Furthermore, the calculation of the shift was wrong and the results were often
unusable.

Both issue were caused by a forgotten 36daeee34f.
This time I made sure to look at bmpsuite_files first, and now they look good.

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28985
2021-01-30 09:23:18 +01:00
Ben Wiederhake
648f153951 Lagom/Fuzzers: Recommend enabling UBSan, extend instructions 2021-01-30 09:23:18 +01:00
Ben Wiederhake
1cbc01e288 Lagom: Don't include Shell/main.cpp
This caused some confusion: Apparently, clang has no trouble overriding Shell's
main, and this issue only surfaced when I tried to build the fuzzers with
wrong configuration (i.e., without the clang-injected 'main').

The diff is suggested by, and work of, @alimpfard.
2021-01-30 09:23:18 +01:00
Jorropo
8f8bbd1bcd
DynamicLoader: load_program_headers use variables to store regions (#5173)
Previously regions were stored in a vector and then a pointer to
regions in this vector were taken and stored. The problem is the vector
were still appended after pointers were taken, if enough regions were
present the vector would grow so large that it needed a resize, this
cause his memory to moved and now the previous pointers are now
pointing to old memory we just freed.

Fixes #5160
2021-01-30 09:21:54 +01:00
Linus Groh
a3da5bc925 Meta: Expect sync-local.sh script at repository root
This used to be in Kernel/, next to the build-root-filesystem.sh script,
which was then moved to Meta/ during the transition to CMake but has the
working directory set to Build/, effectively expecting it there - which
seems silly.

TL;DR: Very confusing. Use an explicit path relative to SERENITY_ROOT
instead and update the .gitignore files.
2021-01-30 09:18:46 +01:00
Linus Groh
c7ca0a5fef Base: Add missing "ß" to DE keymap 2021-01-29 23:21:07 +01:00
Linus Groh
8fa8dda97c Base: Add missing umlauts to DE keymap 2021-01-29 23:21:07 +01:00
Linus Groh
b1b015c052 Base: Fix missing "£" in GB keymap
Shift+3 is "£", not "#".
2021-01-29 23:21:07 +01:00
Linus Groh
f70a364a83 Base: Reformat some keymaps
This is in line with all the other ones, and makes finding the same keys
in each map array a little easier.
2021-01-29 23:21:07 +01:00
Andreas Kling
4ab2ff95ce ls: Lazily align the number of hard links in ls output :^)
Fixes #5155
2021-01-29 23:05:02 +01:00
Ben Wiederhake
0558c74e30 WindowServer: Constrain geometry label on move/resize to desktop
Fixes #5063.
2021-01-29 22:49:12 +01:00
Ben Wiederhake
cf586311a6 WindowServer: Split double-duty Window::normalize_rect()
This commit:
- merges the two(!) places that defined independently the minimum size of a window.
- splits Window::normalize_rect(), which was originally just a function to apply
  the minimum size requirement, and has taken on the additional job of nudging
  windows back onto the desktop.

This inadvertantly fixes a crash that happens when a malicious program creates a
window of size (0, 0). Now, a window at [0,0 50x50] is created instead.
2021-01-29 22:49:12 +01:00
Ben Wiederhake
79f534ef12 WindowServer: Allow superdrags to hide the titlebar
Fixes #5105.
2021-01-29 22:49:12 +01:00
Ben Wiederhake
e200824125 WindowServer: Count titlebar towards visible/grabbable area
This had lead to some surprising asymmetry at the bottom of the screen.
2021-01-29 22:49:12 +01:00
Ben Wiederhake
3fd5aec187 WindowServer: Properly determine where a window may be
This also fixes weird behavior of WindowManager::desktop_rect().
None of the callers seem to ever expect an empty Rect, so return a non-empty Rect.
2021-01-29 22:49:12 +01:00
Linus Groh
af605afb27 Ports: Update neofetch to 7.1.0 2021-01-29 22:48:58 +01:00
Linus Groh
34902f18ce Ports: Revert neofetch shebang patch change
Looks like this was a search & replace from 0bf5669, but it doesn't
actually work in Serenity.
2021-01-29 22:48:58 +01:00
Andreas Kling
7449c1b27f ImageDecoder+LibImageDecoder+LibWeb: Support animations in ImageDecoder
The ImageDecoder service now returns a list of image frames, each with
a duration value.

The code for in-process image decoding is removed from LibWeb, an all
image decode requests are sent out-of-process to ImageDecoder. :^)

This won't scale super well to very long and/or large animations, but
we can work on improving that separately. The main goal here is simply
to stop doing any image decoding inside LibWeb.

Fixes #5165.
2021-01-29 22:38:22 +01:00
Andreas Kling
449d56ef74 LibGfx: Don't use Gfx::Painter in GIF decoder
Painter currently tries to load fonts, which won't work if we're in a
tightly pledged process.

It was only used to fill a rect with transparent pixels, so just do
that manually instead.
2021-01-29 22:30:12 +01:00
Andreas Kling
a8c823f242 Kernel: Bump the number of fd's that can be queued on a local socket 2021-01-29 22:11:59 +01:00
Andreas Kling
0324144e2a LibWeb: Update the ICB's idea of the viewport rect after Frame resize
This makes animations start if they are uncovered by a resize.
2021-01-29 22:03:04 +01:00
Luke
40de84ba67 Kernel/Storage: Rewrite IDE disk detection and disk access
This replaces the current disk detection and disk access code with
code based on https://wiki.osdev.org/IDE

This allows the system to boot on VirtualBox with serial debugging
enabled and VMWare Player.

I believe there were several issues with the current code:
- It didn't utilise the last 8 bits of the LBA in 24-bit mode.
- {read,write}_sectors_with_dma was not setting the obsolete bits,
  which according to OSdev wiki aren't used but should be set.
- The PIO and DMA methods were using slightly different copy
  and pasted access code, which is now put into a single
  function called "ata_access"
- PIO mode doesn't work. This doesn't fix that and should
  be looked into in the future.
- The detection code was not checking for ATA/ATAPI.
- The detection code accidentally had cyls/heads/spt as 8-bit,
  when they're 16-bit.
- The capabilities of the device were not considered. This is now
  brought in and is currently used to check if the device supports
  LBA. If not, use CHS.
2021-01-29 21:20:38 +01:00
Linus Groh
f9b1a9e60c LibJS: Let RegExp.string get RegExp.prototype from the global object directly
We can't assume that RegExp on the global object is still the original
constructor, or an object at all.

This makes '--RegExp<</<</</,/</x/' work. :^)

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29740
2021-01-29 20:50:22 +01:00
Andreas Kling
d0c5979d96 Kernel: Add "prot_exec" pledge promise and require it for PROT_EXEC
This prevents sys$mmap() and sys$mprotect() from creating executable
memory mappings in pledged programs that don't have this promise.

Note that the dynamic loader runs before pledging happens, so it's
unaffected by this.
2021-01-29 18:56:34 +01:00
Jorropo
df30b3e54c
Kernel: RangeAllocator randomized correctly check if size is in bound. (#5164)
The random address proposals were not checked with the size so it was
increasely likely to try to allocate outside of available space with
larger and larger sizes.

Now they will be ignored instead of triggering a Kernel assertion
failure.

This is a continuation of: c8e7baf4b8
2021-01-29 17:18:23 +01:00
Andreas Kling
51df44534b Kernel: Disallow mapping anonymous memory as executable
This adds another layer of defense against introducing new code into a
running process. The only permitted way of doing so is by mmapping an
open file with PROT_READ | PROT_EXEC.

This does make any future JIT implementations slightly more complicated
but I think it's a worthwhile trade-off at this point. :^)
2021-01-29 14:52:34 +01:00
Andreas Kling
af3d3c5c4a Kernel: Enforce W^X more strictly (like PaX MPROTECT)
This patch adds enforcement of two new rules:

- Memory that was previously writable cannot become executable
- Memory that was previously executable cannot become writable

Unfortunately we have to make an exception for text relocations in the
dynamic loader. Since those necessitate writing into a private copy
of library code, we allow programs to transition from RW to RX under
very specific conditions. See the implementation of sys$mprotect()'s
should_make_executable_exception_for_dynamic_loader() for details.
2021-01-29 14:52:27 +01:00