Commit Graph

21089 Commits

Author SHA1 Message Date
Brian Gianforcaro
ab63449ab7 Kernel: Make PerformanceEventBuffer creation API OOM safe 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
8fc6168f21 Kernel: Make Space::create API OOM safe 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
d570048c9e Kernel: Make CoreDump::create API OOM safe 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
32f96eb937 Kernel: Remove usage of adopt_own in MultiProcessorParser 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
af2c3ab524 Kernel: Remove usage of adopt_own in KString 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
f4d7151c3c Kernel: Make KBuffer APIs OOM safe 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
864b1a65e3 Kernel: Make ContiguousVMObject factory API OOM safe 2021-05-29 09:04:05 +02:00
Brian Gianforcaro
cb45b2c001 Kernel: Make AnonymousVMObject::clone() API OOM safe
Propagate allocation failure of m_shared_committed_cow_pages,
and uncommit previously committed COW pages on failure.

This method needs a closer look in terms of error handling, as we
will eventually need to rollback all changes on allocation failure.
Alternatively we could allocate the anonymous object much earlier
and only initialize it once the other steps have succeeded.
2021-05-29 09:04:05 +02:00
Brian Gianforcaro
65d5f81afc Kernel: Make PrivateInodeVMObject factory APIs OOM safe 2021-05-29 09:04:05 +02:00
Linus Groh
d947253c51 LibWeb: Also call page_did_start_loading() for FrameLoader::Type::Reload
Surprisingly this is not used by the browser's page reload functionality
but only JS's location.reload() - that's probably why this hasn't been
noticed yet. Make sure we notify the page client about the load start in
that case as well. :^)
2021-05-29 01:27:06 +01:00
Linus Groh
56e69c4f2e LibWeb: Call page_did_start_loading() before load_resource()
Otherwise we would sometimes (dependent on the load time, I believe) end
up setting the document and eventually calling title change callbacks
before communicating that the page started loading.
2021-05-29 01:17:36 +01:00
Linus Groh
94a56c3aee Browser: Pass Tab::on_title_change title argument as const reference 2021-05-29 01:14:04 +01:00
Linus Groh
507c5b6248 Browser: Remove redundant parameter names from Tab::on_{g,s}et_cookie 2021-05-29 01:12:24 +01:00
Tobias Christiansen
301eb998c6 LibWeb: Improve performance of CSS custom property resolution
By memoizing already resolved custom properties in the DOM::Element,
we achieve a notable speed increase when loading SerenityOS on GitHub.
2021-05-29 00:58:07 +04:30
Tobias Christiansen
3ede1d08f5 LibWeb: Avoid unnecessary String copy in parsing CSS custom properties 2021-05-29 00:58:07 +04:30
Gunnar Beutner
4fca9ee060 Kernel: Allow building the kernel with -O0
Unfortunately the kernel doesn't run with -O0 but at least it can be
successfully built with this change.
2021-05-28 19:52:22 +01:00
Marcus Nilsson
b06d01f040 SystemMonitor: Disable menu items for inaccessible process
Disable the context menu items if user cannot access the process.

Fixes #7486
2021-05-28 18:45:57 +01:00
Jesse Buhagiar
c94e1206bd Meta: Add LibGL to README :^)
Think this is fleshed out and cool enough to warrant being
in the README :^)
2021-05-28 17:55:45 +01:00
Gunnar Beutner
0ee8c1ed27 Ports: Install mbedtls into the right directory and build shared libs
Previously we'd install mbedtls into /lib, /include, etc. Instead we
should install this port into /usr/local/lib.

This also builds shared libraries for this port.
2021-05-28 16:40:02 +01:00
Jesse Buhagiar
2753505962 SystemMonitor: Use u64 for disk sizes
This fixes #7288, which was being caused by unsigned 32-bit integer
overflow
2021-05-28 16:37:25 +01:00
Jesse Buhagiar
786275feb8 LibGUI: Add u64 type to LibGUI::Variant
`uint` has also been more appropriately renamed to
u32.
2021-05-28 16:37:25 +01:00
Gunnar Beutner
9adcfd5726 Kernel: Don't crash when writing a coredump with an unnamed region
Previously we'd try to call ByteBuffer::append(nullptr, 1) when we
came across a VM region that had no name.
2021-05-28 16:48:17 +02:00
Tobias Christiansen
fd6b04055c LibWeb: Resolve custom properties
The way to get the custom properties is pretty weird and this code is
as far from optimized as it gets but somehow it works :^)
2021-05-28 10:45:38 +01:00
Tobias Christiansen
bf9c5ffb3f LibWeb: StyleResolver: Keep track of specificity of matched selector
This way it gets easier to compare matches.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
c4588a2cde LibWeb: Add parsing for custom properties
This parses 'some-property: var(--some-name)' and stores its findings
in a CustomStyleValue.
It also parses the custom properties like '--some-name: some-value' and
puts them into the StyleProperty.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
0d7169b91a LibWeb: Store custom properties in CSSStyleDeclaration
Keep them around when parsing and store them in the CSSStyleDeclaration
when done.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
f0c6160362 LibWeb: Add CustomStyleValue
This extends StyleValue and can hold the identifier of the custom
property.
2021-05-28 10:45:38 +01:00
Tobias Christiansen
8396099e0e LibWeb: Add PropertyID::Custom to code generator 2021-05-28 10:45:38 +01:00
Andreas Kling
9d801d2345 Kernel: Rename Custody::create() => try_create()
The try_ prefix indicates that this may fail. :^)
2021-05-28 11:23:00 +02:00
Andreas Kling
9a827ad3da Kernel: Use a KString for Custody::m_name 2021-05-28 11:21:00 +02:00
Andreas Kling
fc9ce22981 Kernel: Use KString for Region names
Replace the AK::String used for Region::m_name with a KString.

This seems beneficial across the board, but as a specific data point,
it reduces time spent in sys$set_mmap_name() by ~50% on test-js. :^)
2021-05-28 09:37:09 +02:00
Andreas Kling
a1944ec966 Kernel: Add missing AK/Format.h include in KResult.h 2021-05-28 09:37:09 +02:00
Andreas Kling
856f20f91f Kernel: Add try_copy_kstring_from_user()
This is a convenience function that works the same as our old
copy_string_from_user(), but this returns a KString (and can fail!)
2021-05-28 09:37:09 +02:00
Andreas Kling
279383a8f3 Kernel: Add KString, a single-owner string with OOM failure exposion
This is a simple string class for use in the kernel. It encapsulates
a length + character array in a single-allocation object.

Main differences from AK::String:

- Single-owner (no reference counting.)
- Allocation failures are exposed, not hidden.

The basic idea is to allow better and more precise string management
in the kernel.
2021-05-28 09:37:09 +02:00
Gunnar Beutner
377b06c8ac Kernel: Ignore duplicate SYN packets
When receiving a SYN packet for a connection that's in the "SYN
received" state we should ignore the duplicate SYN packet instead of
closing the connection. This can happen when we didn't accept the
connection in time and our peer has sent us another SYN packet because
it thought that the initial SYN packet was lost.
2021-05-28 08:01:00 +02:00
Gunnar Beutner
3fc75088a2 Kernel: Release packet buffer in TCPSocket::send_tcp_packet
Previously we wouldn't release the buffer back to the network adapter
in all cases. While this didn't leak the buffer it would cause the
buffer to not be reused for other packets.
2021-05-28 08:00:45 +02:00
Gunnar Beutner
547eb4973a Profiler: Use a more reasonable default event mask
Previously Profiler (e.g. when started via the context menu in
SystemMonitor) would request logging _all_ event types. While this
might be useful at a later point in time the lack of event type
filtering in the profile viewer makes this less useful because
showing different event types in the same timeline shows an inaccurate
picture of what was really going on.

Some event types (like kmalloc) happen more frequently than others
(e.g. CPU samples) and while they don't carry the same weight they
would still dominate the samples graph.

This changes the Profiler app to just do CPU sampling for now.
2021-05-28 08:00:14 +02:00
Andrew Kaster
1ecf2dad4b LibJS: Poison unused heap blocks until they are re-allocated
This is the coarsest grained ASAN instrumentation possible for the LibJS
heap. Future instrumentation could add red-zones to heap block
allocations, and poison the entire heap block and only un-poison used
cells at the CellAllocator level.
2021-05-28 07:59:41 +02:00
Andrew Kaster
212365130d AK: Add platform macros to detect presence of AddressSanitizer
The ASAN_[UN]POISON_MEMORY_REGION macros can be used to manually notify
the AddressSanitizer runtime about the reachability of instrumented code
accessing a memory region. This is most useful for manually managed
heaps and arenas that do not go directly to malloc or alligned_alloc.
2021-05-28 07:59:41 +02:00
Gunnar Beutner
5e1c1eb840 LibGfx: Make sure we use unique class names
Previously there were different definitions for classes with the
same name. This is a violation of the C++ ODR.
2021-05-28 07:59:05 +02:00
Gunnar Beutner
1f57cc5957 UE: Make sure signal_trampoline_dummy is not optimized away with -flto
This adds __attribute__((used)) to the function declaration so the
compiler doesn't discard it. It also makes the function NEVER_INLINE
so that we don't end up with multiple copies of the function. This
is necessary because the function uses inline assembly to define some
unique labels.
2021-05-28 07:59:05 +02:00
Idan Horowitz
ffaf27e4b6 LibJS: Add inline capacity to BlockAllocator's blocks Vector
There's no need to dynamically allocate a constant sized vector :^)
2021-05-28 00:07:24 +01:00
Paweł Łukasik
ab17ba0ab5 Keymaps: Fix for missing mapping for the polish ć,Ć character 2021-05-27 22:57:49 +02:00
Brendan Coles
6aa766f8ca HexEditor: Add 'Find All' option to Find Dialog to find all matches 2021-05-27 22:57:17 +02:00
Tim Schumacher
d7797c8bf8 Userland: Treat inet_pton returning 0 as an error
The POSIX man-page states that inet_pton returns 0 if the input is not a
valid IPv4 dotted-decimal string or a valid IPv6 address string. This is
also how it is implemented in SerenityOS.

This means that we should treat a return value of 0 as an error to avoid
using an invalid address (or 0.0.0.0).
2021-05-27 22:56:21 +02:00
Marcus Nilsson
f7667901ed Solitaire: Start timer when first card is moved
Starts the game timer when the first card is clicked or moved instead of
when a new game is started.

Fixes #7489
2021-05-27 22:55:37 +02:00
Gunnar Beutner
bacb2dea70 AK: Convince GCC that m_outline_capacity isn't being read
Previously GCC came to the conclusion that we were reading
m_outline_capacity via ByteBuffer(ByteBuffer const&) -> grow()
-> capacity() even though that could never be the case because
m_size is 0 at that point which means we have an inline buffer
and capacity() would return inline_capacity in that case without
reading m_outline_capacity.

This makes GCC inline parts of the grow() function into the
ByteBuffer copy constructor which seems sufficient for GCC to
realize that m_outline_capacity isn't actually being read.
2021-05-27 22:39:25 +02:00
Liav A
c1a4dfeffb Kernel/Graphics: Remove unnecessary derived FramebufferDevice classes
It seems like overly-specific classes were written for no good reason.
Instead of making each adapter to have its own unique FramebufferDevice
class, let's generalize everything to keep implementation more
consistent.
2021-05-27 22:39:13 +02:00
Andreas Kling
b8fd845885 LibJS: Update mmap name after recycling a HeapBlock :^)
Fixes #7507.
2021-05-27 21:24:58 +02:00
Tim Schumacher
58bc10b947
Kernel: Make dup2() return the fd even if old & new are the same (#7506) 2021-05-27 21:14:57 +02:00