Commit graph

21024 commits

Author SHA1 Message Date
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
Andrew Kaster
dda8afcb90 Kernel: Add ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS option to set Og and ggdb3
When debugging kernel code, it's necessary to set extra flags. Normal
advice is to set -ggdb3. Sometimes that still doesn't provide enough
debugging information for complex functions that still get optimized.
Compiling with -Og gives the best optimizations for debugging, but can
sometimes be broken by changes that are innocuous when the compiler gets
more of a chance to look at them. The new CMake option enables both
compile options for kernel code.
2021-05-27 10:21:30 +02:00
Andrew Kaster
7fb05c5c23 Kernel: Explicitly initialize bools in IOAPIC mapping
The compiler couldn't convince itself that these are always initialized
when compiling with Og. They are always initialized before use, because
the only branch where they weren't had VERIFY_NOT_REACHED.
2021-05-27 10:21:30 +02:00
Andrew Kaster
86e3010043 Kernel: Pass trampolines instead of lambdas to create_kernel_process
With -Og, all calls to create_kernel_process were triggering -Wnonnull
when creating these lambdas that get implicitly converted to function
pointers. A different design of create_kernel_process to use
AK::Function instead might avoid this awkward behavior.
2021-05-27 10:21:30 +02:00
Andrew Kaster
6459c5a713 AK: Explicitly initialize buffer member in ByteBuffer
When compiling the Kernel with Og, the compiler complains that
m_outline_capacity might be uninitialized when calling capacity()

Note that this fix is not really what we want. Ideally only outline
buffer and outline capacity would need initialized, not the entire
inline buffer. However, clang considers the class to not be
default-constructible if we make that change, while gcc accepts it.
2021-05-27 10:21:30 +02:00
ry-sev
8146543a43 LibGUI+TextEditor: Add the calculation of selected words
This moves the calculation of selected words that was originally
in the TextEditor application to TextEditor in LibGUI.
This allows all applications with text editors to get
this number without having to calculating it themselves.
2021-05-27 09:05:39 +01:00
Max Wipfli
074813e441 Keymaps: Add German (Switzerland) keymap layout
This adds a `de-ch` keyboard layout.
2021-05-27 09:02:13 +01:00
Gunnar Beutner
afbab621aa Toolchain: Use set -o pipefail to the toolchain build script
Previously the buildstep function would obscure error codes because
the return value of the function was the exit code for the sed command
which caused us to continue execution even though one of the build
steps had failed.

With set -o pipefail the return value of the buildstep function is
the real command's exit code.
2021-05-27 08:58:37 +01:00
Erik Biederstadt
3ea256b1c6 3DFileViewer: Add view menu
The view menu contains:
1. A fullscreen option (also accessed by pressing F11).
2. Rotation axis controls (x, y, z, or any combination)
3. Rotation speed controls (No rotation, slow, normal, or fast)
2021-05-27 08:57:13 +01:00
Gunnar Beutner
1ce32ef675 Kernel: Let the user read/write more than one page from/to dev files
Previously reads and writes to /dev/zero, /dev/full, /dev/null and
/dev/random were limited to 4096 bytes.

This removes that restriction so that users can enjoy more zero bytes
in their buffers.
2021-05-27 09:30:19 +02:00
Max Wipfli
a272c04c8a
Base: Make desktop shortcuts owned by anon (#7495)
This fixes #7492.
2021-05-27 08:52:46 +02:00
Andreas Kling
993211f184 Ports: Bump curl to 7.77.0 :^) 2021-05-27 08:48:29 +02:00
Gunnar Beutner
49dd4e5193 Kernel: Block when writing to TCP sockets when the send window is full
Previously we'd just dump those packets into the network adapter's
send queue and hope for the best. Instead we should wait until the peer
has sent TCP ACK packets.

Ideally this would parse the TCP window size option from the SYN or
SYN|ACK packet, but for now we just assume the window size is 64 kB.
2021-05-26 23:09:28 +02:00
Gunnar Beutner
b436dd138b Kernel: Avoid allocations when sending IP packets
Previously we'd allocate buffers when sending packets. This patch
avoids these allocations by using the NetworkAdapter's packet queue.

At the same time this also avoids copying partially constructed
packets in order to prepend Ethernet and/or IPv4 headers. It also
properly truncates UDP and raw IP packets.
2021-05-26 23:09:28 +02:00
Gunnar Beutner
f8310b7796 Kernel: Move packet allocation into helper methods 2021-05-26 23:09:28 +02:00
Andreas Kling
c739b3cafa Help: Tweak splitter spacing in main UI layout
This doesn't look perfect, but it's slightly better than unmodified.
2021-05-26 22:41:26 +02:00
Andreas Kling
7a24a60e72 LibGUI: Paint some knurling in the middle of GUI::Splitter
This makes splitters stand out visually so you can actually spot them.
Before this, you had to guess/know where they were, which was weird.

The look of the knurling is the same as GUI::ResizeCorner, to build on
the established visual language.
2021-05-26 22:17:47 +02:00
Andreas Kling
89272e810a LibGUI: Have GUI::Splitter track all grabbable areas
Instead of computing the grabbable areas on the fly in mouse event
handlers, we now figure out which parts of the splitter are grabbable
when something moves around, and then remember it.

This makes the code a lot easier to follow.
2021-05-26 22:17:47 +02:00
Andreas Kling
25468fdcf7 Playground: Start out with a GUI::Frame on the right hand side
This looks a lot nicer than starting with a plain GUI::Widget.
2021-05-26 22:17:47 +02:00
Samuel Kelemen
49999006ef LibGfx: remove constexpr, add noexcept on interpolate method
This removes `constexpr` from the interpolate method in Color.h and adds
`noexcept`. The roundf call cannot be constexpr on clang. This is the
only incompatibility preventing serenity from building under clang. I
tested this on OSX Big Sur 11.3 and 11.3.1, and everything works with
this change.
2021-05-27 00:01:38 +04:30
Brian Gianforcaro
2045782a6e Kernel: Switch VMObject to IntrusiveList from InlineLinkedList 2021-05-26 20:24:32 +02:00
Brian Gianforcaro
e6f73d69a2 Kernel: Switch Region to IntrusiveList from InlineLinkedList 2021-05-26 20:24:32 +02:00
Brian Gianforcaro
e0da61f9d6 Kernel: Switch LocalSocket to IntrusiveList from InlineLinkedList 2021-05-26 20:24:32 +02:00
Brian Gianforcaro
493d4d1cd7 Kernel: Switch Inode to IntrusiveList from InlineLinkedList 2021-05-26 20:24:32 +02:00