Commit graph

39249 commits

Author SHA1 Message Date
Idan Horowitz
020c898290 Kernel: Handle SHUT_RDWR in Socket::shutdown
We were previously assuming that the how value was a bitfield, but that
is not the case, so we must explicitly check for SHUT_RDWR when
deciding on the read and write shutdowns.
2022-07-10 14:24:34 +02:00
Idan Horowitz
a6f237a247 Kernel: Accept SHUT_RD and SHUT_WR as shutdown() how values
The previous check for valid how values assumed this field was a bitmap
and that SHUT_RDWR was simply a bitwise or of SHUT_RD and SHUT_WR,
which is not the case.
2022-07-10 14:24:34 +02:00
Karol Kosek
693d34fe3d LibCompress: Write Deflate window size in the Zlib header
Previously we said that the window size was always 512 bytes, which
caused errors during decompressing in apps outside of Serenity that
actually use this information.
Now, the value is always 7 (32 KiB).

Fixes: #14503
2022-07-10 13:52:18 +03:00
MacDue
72a37e5292 LibWeb: Tiebreak corner color on existence of corresponding borders
This fixes the blue border (that should be white/black -- depending
on the theme) between avatars on GitHub commits.
2022-07-10 12:46:57 +02:00
Russell
cfea934cc8 Base: Add uptime(1) manpage 2022-07-10 11:41:45 +01:00
Daniel Bertalan
5c3b182b7e Meta: Teach pick_host_compiler about Homebrew Clang
Homebrew does not add upstream LLVM's install location to $PATH so as
not to conflict with XCode tools, so we should look for it by its
absolute path. LLVM is installed to /opt/homebrew/opt/llvm on ARM Macs,
and is a symlink that points to the latest stable LLVM version.
2022-07-10 12:38:05 +02:00
networkException
710fb11c73 LibGUI: Allow deleting text editor indent selections in non tab cases
Since 00f51d42d2aeb44ec4813ca13be787c2f5ca55ff we would not allow the
deletion for a selection by typing if it would match the conditions to
indent on pressing tab.

As any single line TextEditor would always match the indent conditions,
it was impossible to replace selected text by typing in a TextBox,
PasswordBox or UrlBox.

A missing return, as pointed out in https://github.com/SerenityOS/serenity/pull/13269#discussion_r900866416
was the cause for the additional checks in
TextEditor::insert_at_cursor_or_replace_selection, described in https://github.com/SerenityOS/serenity/pull/13269#discussion_r901009457
With the early return in place the additional checks are not aiding with
the indented behavior but cause the regression described above.

This patch removes the unnecessary conditions.
2022-07-10 12:20:02 +02:00
Linus Groh
071b92e920 LibJS: Fix typos in Temporal spec comments
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/b0411b4
2022-07-10 01:29:28 +02:00
Linus Groh
fb2012dfc7 LibJS: Add Add IsValidISODate assertions
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/46f97ea
2022-07-10 01:22:34 +02:00
Linus Groh
530ea583c1 Meta: Remove accidantally committed 'test' file
Just confirming that js's save(), in fact, still works.
2022-07-10 01:14:18 +02:00
Linus Groh
79fb149b36 js: Add missing built-in functions to help() output 2022-07-10 01:11:52 +02:00
Linus Groh
3c845b0ea4 js: Remove load() built-in function
This is no longer needed now that we have ES modules.
2022-07-10 01:11:52 +02:00
Andreas Kling
89e65e0ea1 LibWeb: Support flex item cross sizing based on intrinsic aspect ratio
This patch implements case B from the "determine the flex base size
and hypothetical main size of each item" from the flexbox algorithm.

https://drafts.csswg.org/css-flexbox-1/#algo-main-item
2022-07-10 00:47:46 +02:00
Andreas Kling
8eb022a57d LibWeb: Don't include flex line margins in inner flex item cross sizes
In cases where flex item cross size is based on the flex line cross
size, the spec specifically says to transfer the *outer* cross size of
the line. We were ignoring the "outer" part.

This patch fixes that by subtracting the cross margins from the size.
2022-07-10 00:04:41 +02:00
Andreas Kling
030dbfd2a9 LibWeb: Improve support for flex-start/end with reversed flex-direction
We now pass the "flex-direction" test from the CSSWG flexbox test suite.
2022-07-10 00:04:41 +02:00
kleines Filmröllchen
41b2d37e8a AK: Always check shift amount in LEB128 read functions
Even shifting 0 by more than the value size is UB.
2022-07-09 22:04:31 +00:00
Andreas Kling
cefc931347 LibWeb: Make sure CSS::ComputedValues has initial size values
Instead of using Optional<LengthPercentage>, we now use LengthPercentage
for these values. The initial values are all `auto`.

This avoids having to check `has_value()` in a ton of places.
2022-07-09 22:16:35 +02:00
Andreas Kling
734ff422ad LibWeb: Add LengthPercentage::is_auto() convenience helper
This lets you ask if a LengthPercentage is `auto` with one call instead
of two, which will make some conditions nicer to express.
2022-07-09 22:16:32 +02:00
Andreas Kling
44025e837f LibGfx: Use float when calculating text width in ScaledFont
This fixes an issue where we'd truncate the fractional part of each
glyph width, often making the returned width slightly too short.
2022-07-09 22:16:18 +02:00
Andreas Kling
80ed7d220c LibGfx: Paint whitespace characters (including &nbsp;) as empty space
This fixes an issue where &nbsp; would sometimes render as "A" in
web content.
2022-07-09 22:16:13 +02:00
Andreas Kling
2217d91b8d AK: Make VERIFY() work in MinSizeRel builds 2022-07-09 22:15:43 +02:00
Lucas CHOLLET
dab814ea11 LibCrypto: Add the [[nodiscard]] qualifier in both BigInteger classes 2022-07-09 15:55:32 +00:00
Maciej
303be38f65 Kernel/Routing: Hide some leftover debugging under a debug flag 2022-07-09 16:53:26 +03:00
Lucas CHOLLET
6f04a3778b FileManager: Change PGID of spawned processes
Processes spawned by FileManager (e.g. through double-click) now set
their PGID to that of the session leader. It allows the filemanage
instance to be killed without propagating the signal to the new process.
2022-07-09 11:41:07 +01:00
Allan Regush
63d06458ca AK: Add equality operators to compare RefPtr to NonNullRefPtr 2022-07-09 09:32:51 +01:00
Allan Regush
ce7d868d6b AK: Add comparison operators to NonnullRefPtr 2022-07-09 09:32:51 +01:00
MacDue
61a703816c LibWeb: Base marker size on font height rather than line height
This fixes the oversized markers on GitHub
2022-07-09 09:28:31 +01:00
kleines Filmröllchen
69218b92a5 LibCore+Userland: Use StringViews when calling Core::System::open
For some reason we used raw char pointers sometimes, which caused at
least one heap buffer overflow detected in fuzzing.
2022-07-09 09:25:20 +01:00
Maciej
7dd3c5c981 Applications: Add a new NetworkSettings application 2022-07-09 09:22:25 +01:00
Maciej
df7b7cbfa4 NetworkServer: Kill running DHCPServer before starting our own
We cannot run two DHCPServers at once, let's just kill the one that was
started previously.
2022-07-09 09:22:25 +01:00
Maciej
8526c3f680 NetworkServer: Clear default gateway route entry before adding 2022-07-09 09:22:25 +01:00
Maciej
20430ffeae route: Support removing entries with unknown gateway 2022-07-09 09:22:25 +01:00
Maciej
bea1668159 Kernel/Net: Support removing route entries with unknown gateway
If you specify gateway as 0.0.0.0, the SIOCDELRT ioctl will remove all
route entries that match all the other arguments.
2022-07-09 09:22:25 +01:00
Maciej
36676a1604 AK: Add IPv4Address::netmask_from_cidr 2022-07-09 09:22:25 +01:00
Ali Mohammad Pur
b85666b3d2 LibRegex: Fix lookup table-based range checks in Compare
The lowercase version of a range is not required to be a valid range,
instead of casefolding the range and making it invalid, check twice with
both cases of the input character (which are the same as the input if
not insensitive).
This time includes an actual test :^)
2022-07-09 01:00:44 +00:00
Brian Gianforcaro
b7c50f7094 Base: Add -ftrivial-auto-var-init to man7/Mitigations.md 2022-07-09 00:53:45 +00:00
Tim Schumacher
a813b941b8 Ports: Add a QEMU port 2022-07-08 22:27:38 +00:00
Tim Schumacher
5835373fc6 Ports: Add a port for pixman 2022-07-08 22:27:38 +00:00
Tim Schumacher
b9f7966e00 LibC: Move stack canary initialization before the global constructors
Once again, QEMU creates threads while running its constructors, which
is a recipe for disaster if we switch out the stack guard while that is
already running in the background.

To solve that, move initialization to our LibC initialization stage,
which is before any actual external initialization code runs.
2022-07-08 22:27:38 +00:00
Tim Schumacher
cf0ad3715e Kernel: Implement sigsuspend using a SignalBlocker
`sigsuspend` was previously implemented using a poll on an empty set of
file descriptors. However, this broke quite a few assumptions in
`SelectBlocker`, as it verifies at least one file descriptor to be
ready after waking up and as it relies on being notified by the file
descriptor.

A bare-bones `sigsuspend` may also be implemented by relying on any of
the `sigwait` functions, but as `sigsuspend` features several (currently
unimplemented) restrictions on how returns work, it is a syscall on its
own.
2022-07-08 22:27:38 +00:00
Tim Schumacher
edbffb3c7a Kernel: Unblock SignalBlocker if a signal was just unmarked as pending
When updating the signal mask, there is a small frame where we might set
up the receiving process for handing the signal and therefore remove
that signal from the list of pending signals before SignalBlocker has a
chance to block. In turn, this might cause SignalBlocker to never notice
that the signal arrives and it will never unblock once blocked.

Track the currently handled signal separately and include it when
determining if SignalBlocker should be unblocking.
2022-07-08 22:27:38 +00:00
Tim Schumacher
cd189999d1 Kernel: Don't let locks of the same owner conflict with each other
Documentation on POSIX locks seems sparse, but this is how the Linux
kernel implementation handles it.
2022-07-08 22:27:38 +00:00
Tim Schumacher
dc6016cd18 Kernel: Don't fail on unlocking nonexistent file locks
I haven't found any POSIX specification on this, but the Linux kernel
appears to handle it like that.

This is required by QEMU, as it just bulk-unlocks all its file locking
bytes without checking first if they are held.
2022-07-08 22:27:38 +00:00
Tim Schumacher
7d3f71a648 Kernel: Do not disable userland access to the RDTSC instruction
Access to RDTSC is occasionally restricted to give malware one less
option to accurately time attacks (side-channels, etc.).

However, QEMU requires access to the timestamp counter for the exact
same reason (which is accurately timing its CPU ticks), so lets just
enable it for now.
2022-07-08 22:27:38 +00:00
Tim Schumacher
9e8c698ae8 Tests: Remove the RDTSC kernel crash test
We will remove the RDTSC instruction restriction to allow QEMU to read
an accurate time, so this will no longer crash and therefore fail the
test.
2022-07-08 22:27:38 +00:00
Tim Schumacher
5efa8e507b Kernel: Implement an axallowed mount option
Similar to `W^X` and `wxallowed`, this allows for anonymous executable
mappings.
2022-07-08 22:27:38 +00:00
Tim Schumacher
6187cf72cc LibM: Implement fma 2022-07-08 22:27:38 +00:00
Tim Schumacher
6c650d1b8d LibC: Add stubs for glob and globfree 2022-07-08 22:27:38 +00:00
Timothy Flynn
f672b4c151 LibUnicode: Remove now-unused Unicode::select_pattern_with_plurality 2022-07-08 20:33:52 +02:00
Timothy Flynn
5b68c1a06c LibJS: Use Intl.PluralRules within Intl.NumberFormat
This also allows removing a bit of a BigInt hack to resolve plurality of
BigInt numbers (because the AOs used in ResolvePlural support BigInt,
wherease the naive Unicode::select_pattern_with_plurality did not).

We use cardinal form here; the number format patterns in the CLDR align
with the cardinal form of the plural rules.
2022-07-08 20:33:52 +02:00