Commit graph

21197 commits

Author SHA1 Message Date
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
Andrew Kaster 1a0eed705c DHCPClient: Avoid unaligned access when parsing options
Just casting a void* to a T* and dereferencing it is not particularly
safe. Also UBSAN was complaining. Use memcpy into a default constructed
T instead and require that the T be trivially copyable.
2021-05-27 15:18:03 +02:00
Andrew Kaster 723b8586ec CI: Enable UBSAN for on-target tests
Note that until UBSAN is made deadly by default in LibSanitizer, UBSAN
warnings will not fail the build.

Also remove BUILD_LAGOM=ON from the NORMAL_DEBUG build as it's
unnecessary and extends the build time for no benefit when building with
sanitizers
2021-05-27 15:18:03 +02:00
Andrew Kaster 4a5a1e8648 Userland: Port UBSAN implementation to userspace
Take Kernel/UBSanitizer.cpp and make a copy in LibSanitizer.

We can use LibSanitizer to hold other sanitizers as people implement
them :^).

To enable UBSAN for LibC, DynamicLoader, and other low level system
libraries, LibUBSanitizer is built as a serenity_libc, and has a static
version for LibCStatic to use. The approach is the same as that taken in

Note that this means now UBSAN is enabled for code generators, Lagom,
Kernel, and Userspace with -DENABLE_UNDEFINED_SANTIZER=ON. In userspace
however, UBSAN is not deadly (yet).

Co-authored-by: ForLoveOfCats <ForLoveOfCats@vivaldi.net>
2021-05-27 15:18:03 +02:00
Andrew Kaster 505f84daae Kernel+AK: Move UBSanitizer to AK, and to AK namespace
In preparation for copying UBSanitizer to userspace, move the header to
AK :^)
2021-05-27 15:18:03 +02:00
Andrew Kaster a223ef3c4f Tests: Use ByteBuffer::create_zeroed in TestDeflate instead of memset
The round trip compress test wants the first half of the byte buffer to
be filled with random data, and the second half to be all zeroes. The
strategy of using memset on ByteBuffer::offset_pointer confuses
__builtin_memset_chk when building with -fsanitize=undefined. It thinks
that the buffer is using inline capacity when we can prove to ourselves
pretty easily that it's not. To avoid this, just create the buffer
zeroed to start, and then fill the first half with the random data.
2021-05-27 15:18:03 +02:00
Ali Mohammad Pur 0e4431af33 Meta: Run the Wasm spec tests in CI
Since LibWasm is still not capable of passing all of the spec tests,
ignore failing tests, only fail the build if some segfault/abort/etc
occurs.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur 13c1514889 LibTest: Do not cleanly exit when abort() is called
Instead, do the cleanup, remove the signal handler, and abort() again.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur 578bf6c45e LibWasm: Avoid excessive pop()-then-push() on the stack
Also make the stack a lot bigger, since we now have only one of these
instead of one per function call.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur c022b6d74e AK: Add a way to slice from the end of a span 2021-05-27 17:28:41 +04:30
Ali Mohammad Pur 477ab6dc4c LibWasm: Let the interpreter itself manage the call frame 2021-05-27 17:28:41 +04:30
Ali Mohammad Pur 85794f8244 LibWasm: Add a copy assignment operator to Value 2021-05-27 17:28:41 +04:30
Ali Mohammad Pur c5df55a8a2 LibWasm: Make Interpreter a virtual interface
This allows multiply different kinds of interpreters to be used by the
runtime; currently a BytecodeInterpreter and a
DebuggerBytecodeInterpreter is provided.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur f91fa79fc5 LibWasm: Use the current configuration to run call ops
This should make it easier to implement multiple types of interpreters
on top of a configuration, and also give a small speed boost in not
initialising as many Stack objects.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur b2bd5132c4 Meta: Correctly parse numeric literals in wasm tests
This was previously parsing them as hex numbers, causing tests to fail.
With this fix, 88% of the generated tests are passing :^)
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur bc936a5fac LibWasm: Make Frame a value type as well
This means stack operations will no longer do extra allocations.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur 73eb0785e0 LibWasm: Don't put values and labels in OwnPtrs
Doing that was causing a lot of malloc/free traffic, but since there's
no need to have a stable pointer to them, we can just store them by
value.
This makes execution significantly faster :^)
2021-05-27 17:28:41 +04:30
Arjan Zuidema c7bc1f59d8 file: Output directory when path is a directory
Before file would output 'text/html' when the path was a directory.
2021-05-27 13:18:23 +01:00
Gunnar Beutner e17a5dc2b9 DHCPClient: Rename struct members for InterfaceDescriptor
Public members shouldn't have an "m_" prefix.
2021-05-27 15:53:49 +04:30
Gunnar Beutner 106def9de7 DHCPClient: Remove unused #includes 2021-05-27 15:53:49 +04:30
Gunnar Beutner c73116b2e2 DHCPClient: Resend DHCP packets when we don't receive an answer
Previously we'd only only send one DHCP request for network interfaces
which were up when DHCPClient started. If that packet was lost we'd
never send another request for those interfaces.

Also, if an interface were to appear after DHCPClient started (not
that that is possible at the moment) we wouldn't send requests for
that interface either.
2021-05-27 15:53:49 +04:30
Andreas Kling 2952c86f38 Profiler: Don't try to create a DisassemblyModel for invalid indices
This fixes a null dereference when toggling the "top functions" mode
while a top-level process node was selected.
2021-05-27 11:45:29 +02:00
Andrew Kaster 2ec302ea22 Meta/CI: Add ENABLE_ALL_DEBUG_FACILITIES CMake option
This option replaces the use of ENABLE_ALL_THE_DEBUG_MACROS in CI runs,
and enables all debug options that might be broken by developers
unintentionally that are only used in specific debugging situations.
2021-05-27 10:21:30 +02:00