Commit graph

20242 commits

Author SHA1 Message Date
Linus Groh
d8a3609aa9 Everywhere: Add a blank line after copyright header where missing 2021-05-15 00:27:09 +01:00
Linus Groh
64c0deb1f1 SpaceAnalyzer: Add separator before quit menu action 2021-05-15 00:24:07 +01:00
Linus Groh
067b880459 SystemMonitor: Make ProcessModel icon column non-sortable
Sorting by icon is neither intuitive nor useful, so let's disable it
(like in GUI::FileSystemModel).
2021-05-15 00:15:09 +01:00
Linus Groh
5ee9aab7e1 Meta: Bump BIOS/MBR boot partition size of grub disk image to 1MiB
As of ~April 2021 the Meta/build-image-grub.sh script no longer works
for me (on Fedora 34) and fails with the following error:

    /usr/sbin/grub2-install: warning: ../grub-core/partmap/msdos.c:403:
    your core.img is unusually large. It won't fit in the embedding
    area.

    /usr/sbin/grub2-install: warning: Embedding is not possible. GRUB
    can only be installed in this setup by using blocklists. However,
    blocklists are UNRELIABLE and their use is discouraged..

    /usr/sbin/grub2-install: error: will not proceed with blocklists.

Changing the size of the boot partition from 32 kiB to 1 MiB (2048
sectors) fixes the issue. This is also described in the following Ubuntu
grub2 bug (as well as 40 duplicates!) from 2012, which suggests the same
fix: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1059827

The Arch Linux wiki also uses 1 MiB in their BIOS/MBR examples for
parted: https://wiki.archlinux.org/title/Parted

I'm not sure why this suddenly stopped working, however I was able to
boot with an image created with this change applied.
2021-05-15 00:57:35 +02:00
Andreas Kling
b31602367e LibELF: Use binary search when looking up symbols :^)
For whatever reason, symbolication was doing an O(n) walk of all the
symbols, despite having sorted them beforehand.

Changing this to a binary_search() makes symbolication noticeably
faster and improves Profiler startup time.
2021-05-15 00:51:23 +02:00
Andreas Kling
ef09f9c825 SystemMonitor: Make sure we set a model before changing column sizes
Changing a view's column metadata requires that a model is set.
2021-05-15 00:50:51 +02:00
Andreas Kling
16221305ad LibELF: Remove sketchy use of "undefined" ELF::Image::Section
We were using ELF::Image::section(0) to indicate the "undefined"
section, when what we really wanted was just Optional<Section>.

So let's use Optional instead. :^)
2021-05-15 00:17:55 +02:00
Mart G
f70d0f03de SpaceAnalyzer: Use fstatat instead of lstat
By using fstatat during file system analyzation instead of lstat, we
reduce the amount of work the kernel has to do for each stat call.

During profiling it came up that the kernel was spending a lot of time
resolving paths. Because each call to stat passed an absolute path the
kernel had to do the same work over and over again.

When using relative paths the kernel only has to resolve the relative
part as it can reuse the already resolved path of the base directory.
2021-05-14 23:32:10 +02:00
Mart G
758085571f LibCore: Expose DirIterator's underlying file descriptor 2021-05-14 23:32:10 +02:00
Mart G
e7310ba45a Kernel+LibC: Add fstatat
The function fstatat can do the same thing as the stat and lstat
functions. However, it can be passed the file descriptor of a directory
which will be used when as the starting point for relative paths. This
is contrary to stat and lstat which use the current working directory as
the starting for relative paths.
2021-05-14 23:32:10 +02:00
Jean-Baptiste Boric
875116c3e5 Utilities: Fix const-correctness inside seq 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
d76987be96 LibC: Move makedev(), major(), minor(), to sys/types.h
It's technically not specified by POSIX, but it appears most Unix-like
systems worth mentioning put those definitions there. Also, it's more
logical since the dev_t type is defined there.
2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
eecf7a2097 LibC: Move mman.h to sys/mman.h
POSIX mandates that it is placed there.
2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
e16894af5a LibC: Do not include errno.h inside unistd.h
POSIX does not mandate this, therefore let's not do it.
2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
7f498769ac LibThread: Port Lock to foreign environments 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
9853a4393c IPCCompiler: Fix declaration of static functions 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
090936e424 Userland: Replace arc4random() with get_random<u32>() 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
5a0468c21f Userland: Migrate from arc4random_uniform() to get_random_uniform() 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
069bf988ed AK: Introduce get_random_uniform()
This is arc4random_uniform(), but inside AK.
2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
ad7cd05fc1 AK: Fix redefinition of macro inside AK/Platform.h 2021-05-14 22:24:02 +02:00
Stephan Unverwerth
2b9ad11bd8 LibGL: Implement glFlush() and glFinish() 2021-05-14 22:15:50 +02:00
Andreas Kling
3429b44161 LibCore: Never connect to InspectorServer if getuid() == 0
Let's just stay on the safe side with this.
2021-05-14 22:12:52 +02:00
Linus Groh
5c05dfecb5 Meta: Remove accidentally committed 'js.js' file 2021-05-14 20:19:59 +01:00
Linus Groh
f512b24b21 AnalogClock: Use YYYY-MM-DD format for window title 2021-05-14 20:17:09 +01:00
Andreas Kling
212e1ba0d4 ImageViewer: Sandbox image decoding using the ImageDecoder service :^)
Instead of parsing untrusted and potentially malicious image files in
the ImageViewer GUI process, take advantage of the ImageDecoder service
that we already have on the system to sandbox the decode.

This prevents bugs in our image decoding libraries from being used as
an exploitation vector when viewing files in ImageViewer.
2021-05-14 21:02:18 +02:00
Andreas Kling
fa0e23009a LibImageDecoderClient: Decoded images with 0 frames are not successful
Previously you could pass anything (e.g a text file) to ImageDecoder and
it would "succeed" in decoding it and give you back a 0-frame result.

Let's consider that state a failure instead.
2021-05-14 21:02:14 +02:00
Andreas Kling
3168a4afe8 ImageViewer: Rename QSWidget => ImageViewer::ViewWidget 2021-05-14 18:37:08 +02:00
Andreas Kling
58d73ea36c Userland: Rename QuickShow => Image Viewer
The old name was a bit too ambiguous. This one is crystal clear. :^)
2021-05-14 18:34:44 +02:00
Andreas Kling
d039542c7c AK: Remove unused STRINGIMPL_DEBUG instrumentation 2021-05-14 17:17:32 +02:00
Andreas Kling
5fd65adb19 Browser: Don't spawn RequestServer and WebSocket in multi-process mode
Single-process Browser forces a connection to these services early on,
to avoid having to unveil their paths. I'm suspicious of the benefits
of this (and the comment about it wasn't even accurate) but let's keep
it for now.

In multi-process mode, there's no need to do this, and in fact it was
causing us to spawn two extra totally unused processes.
2021-05-14 17:17:30 +02:00
Andreas Kling
3ed5a73ede Profiler: Mark model columns as non-sortable
This removes the ability to click on the column headers to resort.
Resorting didn't do anything anyway.
2021-05-14 17:17:17 +02:00
Gunnar Beutner
c22296505c Kernel: Merge do_retransmit_packets() into retransmit_packets() 2021-05-14 16:50:00 +02:00
Gunnar Beutner
08aa3a91e3 Kernel: Try to retransmit lost TCP packets
Previously we didn't retransmit lost TCP packets which would cause
connections to hang if packets were lost. Also we now time out
TCP connections after a number of retransmission attempts.
2021-05-14 16:50:00 +02:00
Gunnar Beutner
9daec809b7 Kernel: Wake up NetworkTask every 500 milliseconds
This wakes up NetworkTask every 500 milliseconds so that it can send
pending delayed TCP ACKs and isn't forced to send all of them early
when it goes to sleep like it did before.
2021-05-14 16:50:00 +02:00
Gunnar Beutner
990b2d0989 Kernel: Don't use delayed ACKs when establishing the connection
When establishing the connection we should send ACKs right away so
as to not delay the connection process. This didn't previously
matter because we'd flush all delayed ACKs when NetworkTask waits
for incoming packets.
2021-05-14 16:50:00 +02:00
Andreas Kling
aea709de31 Meta: Add note about writing commit subjects in the imperative mood 2021-05-14 16:45:27 +02:00
Andreas Kling
3e603b2f32 AK: Make StringView::hash() constexpr
This required moving string_hash() to its own header so that everyone
can see it.
2021-05-14 15:24:32 +02:00
Brian Gianforcaro
9c38475608 Kernel: Add the ability to verify we don't kmalloc under spinlock.
Ideally we would never allocate under a spinlock, as it has many
performance and potentially functionality (deadlock) pitfalls.

We violate that rule in many places today, but we need a tool to track
them all down and fix them. This change introduces a new macro option
named `KMALLOC_VERIFY_NO_SPINLOCK_HELD` which can catch these
situations at runtime via an assert.
2021-05-14 13:28:21 +02:00
Itamar
6329e9fce6 LanguageServer/Cpp: Add tests
The Cpp LanguageServer tests can be run with: CppLanguageServer -t

The tests now only cover some very simple autocomplete and
"find declaration" use cases, but it's a start :)
2021-05-14 13:27:47 +02:00
Itamar
e9fc5d6cc3 LanguageServers: Allow set_declarations_of_document callback to be null 2021-05-14 13:27:47 +02:00
Itamar
545b6af305 LanguageServers/FileDB: Allow m_project_root to be null 2021-05-14 13:27:47 +02:00
Itamar
c49cf23a86 LanguageServers: Remove ClientConnection dependency
We now no longer need to provide a ClientConnection object to construct
AutoCompleteEngine.
2021-05-14 13:27:47 +02:00
Idan Horowitz
687efe6dd6 Documentation: Add a note about enabling the console iPXE command
This command is used in the given script, and in the latest version of
iPXE its disabled by default
2021-05-14 13:25:19 +02:00
Andreas Kling
89febfcd30 Meta: Specify that we use ISO 8601 dates and the metric system 2021-05-14 13:21:47 +02:00
Gunnar Beutner
a8e6cdc0d8 AK: Avoid allocations in ByteBuffer
Creating a ByteBuffer involves two allocations:

-One for the ByteBufferImpl object
-Another one for the actual byte buffer

This changes the ByteBuffer and ByteBufferImpl classes
so only one allocation is necessary.
2021-05-14 12:51:13 +02:00
Andreas Kling
fccfc33dfb AK: Use move semantics to avoid copying in JSON parser
The JSON parser was deep-copying JsonValues left and right, and it was
all totally avoidable. :^)
2021-05-14 11:54:43 +02:00
Andreas Kling
6210d2612e Profiler: Avoid JsonArray copying during perfcore parsing
Use JsonObject::get_ptr() to access array values without copying them.
2021-05-14 11:38:35 +02:00
Andreas Kling
8360079cac LibGUI: Fix logic typo in AbstractTableView::update_row_sizes()
We should skip over non-visible *rows*, not *columns*.
2021-05-14 11:37:24 +02:00
DexesTTP
36a56871c0 LibCrypto: Prevent a signed overflow during BigInt Modular Power
The algorithm isn't explicit about what type this needs to be. But this
passes all of the tests, so that's probably fine.
2021-05-14 11:36:39 +02:00
Brian Gianforcaro
4728f2af80 Kernel: Avoid unnecessary time under lock in TCPSocket::create
Avoid holding the sockets_by_tuple lock while allocating the TCPSocket.
While checking if the list contains the item we can also hold the lock
in shared mode, as we are only reading the hash table.

In addition the call to from_tuple appears to be superfluous, as we
created the socket, so we should be able to just return it directly.
This avoids the recursive lock acquisition, as well as the unnecessary
hash table lookups.
2021-05-14 11:32:50 +02:00