Commit Graph

21069 Commits

Author SHA1 Message Date
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
Gunnar Beutner
97d0ebba20 LibJS: Make sure aligned_alloc() doesn't return a null pointer
The previous VERIFY() call checked that aligned_alloc() didn't return
MAP_FAILED. When out of memory aligned_alloc() returns a null pointer
so let's check for that instead.
2021-05-27 21:13:57 +02:00
Andreas Kling
14585a9cba LibJS: Remove unused HeapBlock::operator delete() 2021-05-27 20:07:34 +02:00
Andreas Kling
606b483231 LibJS: Make BlockAllocator use free() on non-Serenity platforms
If we use aligned_alloc() to allocate, we have to use free() to free.
2021-05-27 20:06:47 +02:00
Andreas Kling
9b699bad94 LibJS: Rename Allocator => CellAllocator
Now that we have a BlockAllocator as well, it seems appropriate to name
the allocator-that-allocates-cells something more specific to match.
2021-05-27 19:56:12 +02:00
Andreas Kling
e9081a2644 LibJS: Recycle up to 64 HeapBlocks to improve performance :^)
This patch adds a BlockAllocator to the GC heap where we now cache up to
64 HeapBlock-sized mmap's that get recycled when allocating HeapBlocks.

This improves test-js runtime performance by ~35%, pretty cool! :^)
2021-05-27 19:56:04 +02:00
Linus Groh
d2149c153c PDFViewer: Reset current page number to 1 when opening a file
Also use set_current_number() instead of set_text(), so we don't have to
create a string from the number ourselves.
2021-05-27 18:49:49 +01:00
Linus Groh
a8d47d648c PDFViewer: Enable previous/next buttons conditionally
Instead of having both always enabled once a document is loaded, update
them on each page change and disable if appropriate.
2021-05-27 18:47:44 +01:00
Linus Groh
dbb0ee0704 PDFViewer: Fix previous/next page toolbar button icons
go-up.png and go-down.png don't exist (and would look silly here, with
the buttons being next to each other horizontally). Use go-back.png and
go-forward.png instead.
2021-05-27 18:43:23 +01:00
Linus Groh
b1e368ef87 Base: Move test PDFs from /res/pdf to /home/anon/Documents/pdf 2021-05-27 18:13:09 +01:00
Linus Groh
ffad5b1706 3DFileViewer: Add separator before quit menu action 2021-05-27 18:11:03 +01:00
Linus Groh
6b0c2d5de6 PDFViewer: Add a Help menu 2021-05-27 18:10:34 +01:00
Linus Groh
cde5107f3d PDFViewer: Add separator before quit menu action 2021-05-27 18:09:37 +01:00
Linus Groh
209bfbaaa4 PDFViewer: Show app name as "PDF Viewer" when a file is loaded 2021-05-27 18:08:49 +01:00
Linus Groh
f930837ed7 SoundPlayer: Show app name as "Sound Player" when a file is loaded 2021-05-27 18:07:52 +01:00
Tim Schumacher
e87a9a7f9f Tests: Add tests for LexicalPath dirname handling 2021-05-27 18:21:36 +04:30
Tim Schumacher
0aaa992c1c LexicalPath: Reset dirname if it's empty
dirname ends up empty if the canonical path only contains one element.

Reset it to the default for relative/absolute paths if that is the case.
2021-05-27 18:21:36 +04:30
Marcus Nilsson
c906987651 Utilites: Make dd truncate output file
Make dd truncate the output file as Gnu-dd does by default.
Fixes #7497
2021-05-27 15:19:06 +02:00
Andrew Kaster
fae7c436e6 Shell: Disable the valid test as it has a high failure rate on target
Tracked by #7336
2021-05-27 15:18:03 +02:00
Andrew Kaster
480802805f LibGfx: Copy into a u32 in LZWDecoder::next_code() instead of casting
This results in unaligned reads sometimes, depending on the layout of
the underlying buffer. Caught by UBSAN.
2021-05-27 15:18:03 +02:00
Andrew Kaster
74da0f24f0 LibC: Use u32 in arc4random instead of char[4]
There's no alignment requirements on a char[4] buffer, so this was
causing unaligned reads that were caught by UBSAN.
2021-05-27 15:18:03 +02:00