Commit graph

39209 commits

Author SHA1 Message Date
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
Timothy Flynn
6d9b779757 LibJS: Add an overload of ResolvePlural for use without PluralRules
The NumberFormat spec casually indicates the need for a PluralRules
object without explicity saying so, with text such as:

"which may depend on x in languages having different plural forms."

Other implementations actually do create a PluralRules object to resolve
those cases with ResolvePlural. However, ResolvePlural doesn't need much
from PluralRules to operate, so this can be abstracted out for use in
NumberFormat without the need to allocate a PluralRules instance.
2022-07-08 20:33:52 +02:00
Timothy Flynn
1fc87d1529 LibJS: Use Intl.PluralRules within Intl.DurationFormat 2022-07-08 20:33:52 +02:00
Timothy Flynn
232df4196b LibUnicode: Replace NumberFormat::Plurality with Unicode::PluralCategory
To prepare for using plural rules within number & duration format, this
removes the NumberFormat::Plurality enumeration.

This also adds PluralCategory::ExactlyZero & PluralCategory::ExactlyOne.
These are used in locales like French, where PluralCategory::One really
means any value from 0.00 to 1.99. PluralCategory::ExactlyOne means only
the value 1, as the name implies. These exact rules are not known by the
general plural rules, they are explicitly for number / currency format.
2022-07-08 20:33:52 +02:00
Timothy Flynn
cc5c707649 LibJS+LibUnicode: Do not generate the PluralCategory enum
The PluralCategory enum is currently generated for plural rules. Instead
of generating it, this moves the enum to the public LibUnicode header.
While it was nice to auto-discover these values, they are well defined
by TR-35, and we will need their values from within the number format
code generator (which can't rely on the plural rules generator having
run yet). Further, number format will require additional values in the
enum that plural rules doesn't know about.
2022-07-08 20:33:52 +02:00
huttongrabiel
9369610bf4 LibGUI: Unindent selected text on shift+tab press
Selected text is unindented when Shift+Tab is pressed. Select text,
indent it with Tab, then unindent with Shift+Tab.
2022-07-08 11:47:56 +01:00
huttongrabiel
2fbaa7996c LibGUI: Indent selected text on tab press
If selected text is less than a whole line, usual delete/replace takes
place. Otherwise, if the selected text is a whole line or spans
multiple lines, the selection will be indented.
2022-07-08 11:47:56 +01:00
Tim Schumacher
80705a72bd mount: Allow extending fstab via drop-in files in fstab.d 2022-07-08 12:42:23 +02:00
Tim Schumacher
e04155475d mount: Separate mounting by line into a new function 2022-07-08 12:42:23 +02:00
zzLinus
6453f74642 LibGUI: Support typing to search for ComboBox
LibGUI: Fixup missing  one charactor issue
2022-07-08 11:40:19 +01:00
Kenneth Myhra
247951e09c LibWeb: Add URLSearchParams as part of union type for XHR::send()
This patch adds support for URLSearchParams to XHR::send() and
introduces the union type XMLHttpRequestBodyInit.

XHR::send() now has support for String and URLSearchParams.
2022-07-08 12:37:01 +02:00
Yuval
bd74db157a HackStudio: Add the "Copy Full Path" TreeView context menu option
This commit adds support for the option described above.
The option can be seen after a right click on a TreeView item,
and it puts the item's full path in the clipboard.
2022-07-08 11:20:05 +01:00
Yuval
4ef0433be1 HackStudio: Add the "Copy Relative Path" TreeView context menu option
This commit adds support for the option described above.
The option can be seen after a right click on a TreeView item,
and it puts the item's relative path in the clipboard (relative
to the project's root directory).
2022-07-08 11:20:05 +01:00
Tim Schumacher
6978b53ea0 Meta: Don't disable custom Toolchain on SerenityOS
Parts of our build system and scripts rely on the fact that we are
cross-compiling. For now, remove the "try to build natively" part to get
the build running and leave a TODO for later.
2022-07-08 12:04:01 +02:00
Tim Schumacher
92bf442d83 Meta: Provide the correct path for e2fsck on SerenityOS 2022-07-08 12:04:01 +02:00
Tim Schumacher
139f871781 Meta: Use pls instead of sudo on SerenityOS 2022-07-08 12:04:01 +02:00
Tim Schumacher
84e1017272 Userland: Add /usr/local/sbin to PATH by default
`e2fsprogs` adds its tools there.
2022-07-08 12:04:01 +02:00
Liav A
6256bdb075 Ports: Add QOI converter and QOI benchmark utility 2022-07-08 12:01:52 +02:00
Liav A
5fe4feee33 Ports: Add stb header files 2022-07-08 12:01:52 +02:00
Timothy Flynn
bf85bf2a9e LibJS: Use Intl.PluralRules within Intl.RelativeFormat
The Polish test cases added here cover previous failures from test262,
due to the way that 0 is specified to be "many" in Polish.
2022-07-08 11:51:54 +02:00
Timothy Flynn
36abcd820d LibJS: Implement Intl.PluralRules.prototype.select 2022-07-08 11:51:54 +02:00
Timothy Flynn
f11cb7c075 LibJS: Populate pluralCategories in Intl.PluralRules.resolvedOptions 2022-07-08 11:51:54 +02:00
Timothy Flynn
670bd066a5 LibJS: Replace JS::Intl::PluralRules::Type with Unicode::PluralForm
The JS::Intl enum was added when implementing the PluralRules
constructor. Now that LibUnicode has a plural rules implementation,
replace the JS::Intl enum with the analagous Unicode enum.
2022-07-08 11:51:54 +02:00
Timothy Flynn
2982aa0373 LibJS: Mark the NumberFormat parameter of FormatNumericToString as const
Not critical, but in subsequent commits this will be invoked from a
constant context.
2022-07-08 11:51:54 +02:00
Timothy Flynn
8aeacccd82 LibUnicode: Generate a list of available plural categories per locale
Separate lists are generated for cardinal and ordinal form.
2022-07-08 11:51:54 +02:00
Timothy Flynn
ea78bac36d LibUnicode: Parse and generate per-locale plural rules from the CLDR
Plural rules in the CLDR are of the form:

"cs": {
    "pluralRule-count-one": "i = 1 and v = 0 @integer 1",
    "pluralRule-count-few": "i = 2..4 and v = 0 @integer 2~4",
    "pluralRule-count-many": "v != 0 @decimal 0.0~1.5, 10.0, 100.0 ...",
    "pluralRule-count-other": "@integer 0, 5~19, 100, 1000, 10000 ..."
}

The syntax is described here:
https://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax

There are up to 2 sets of rules for each locale, a cardinal set and an
ordinal set. The approach here is to generate a C++ function for each
set of rules. Each condition in the rules (e.g. "i = 1 and v = 0") is
transpiled to a C++ if-statement within its function. Then lookup tables
are generated to match locales to their generated functions.

NOTE: -Wno-parentheses-equality is added to the LibUnicodeData compile
flags because the generated plural rules have lots of extra parentheses
(because e.g. we need to selectively negate and combine rules). The code
to generate only exactly the right number of parentheses is quite hairy,
so this just tells the compiler to ignore the extras.
2022-07-08 11:51:54 +02:00
Liav A
8de395694d Kernel/Storage: Do proper locking & reset in the AHCIController code
The initialize_hba method now calls the reset method to reset the HBA
and initialize each AHCIPort. Also, after full HBA reset we need to turn
on the AHCI functionality of the HBA and global interrupts since they
are cleared to 0 according to the specification in the GHC register.
2022-07-08 01:06:47 +03:00
Liav A
4d36989954 Kernel/Storage: Move Identify page allocation to the AHCIPort class
Instead of doing this in a parent class like the AHCIController, let's
do that directly in the AHCIPort class as that class is the only user of
these sort of physical pages. While it seems like we waste an entire 4KB
of physical RAM for each allocation, this could serve us later on if we
want to fetch other types of logs from the ATA device.
2022-07-08 01:06:47 +03:00
Liav A
bf82c4b81b Kernel/Storage: Rename AHCIPortHandler => AHCIInterruptHandler
This reflects better what this object is all about - handling interrupts
of AHCI ports, and nothing more than that.
2022-07-08 01:06:47 +03:00
Liav A
cc734c106e Kernel/Storage: Simplify AHCIPortHandler class
The way AHCIPortHandler held AHCIPorts and even provided them with
physical pages for the ATA identify buffer just felt wrong.
To fix this, AHCIPortHandler is not a ref-counted object anymore. This
solves the big part of the problem, because AHCIPorts can't hold a
reference to this object anymore, only the AHCIController can do that.
Then, most of the responsibilities are shifted to the AHCIController,
making the AHCIPortHandler a handler of port interrupts only.
2022-07-08 01:06:47 +03:00
Liav A
4169ac4a7b Kernel/Storage: Remove 3 stale methods in AHCIPortHandler class 2022-07-08 01:06:47 +03:00
Liav A
9416dede54 Kernel/AHCI: Don't use UNMAP_AFTER_INIT in header files
Instead, declare such methods and functions in the code itself.
2022-07-08 01:06:47 +03:00
Liav A
d771ca3278 Kernel: Clean up the AHCI code a bit
The AHCI code is not very good at OOM conditions, so this is a first
step towards OOM correctness. We should not allocate things inside C++
constructors because we can't catch OOM failures, so most allocation
code inside constructors is exported to a different function.

Also, don't use a HashMap for holding RefPtr of AHCIPort objects in
AHCIPortHandler because this structure is not very OOM-friendly. Instead
use a fixed Array of 32 RefPtrs, as at most we can have 32 AHCI ports
per AHCI controller.
2022-07-08 01:06:47 +03:00
Tim Schumacher
6677cd6d70 Meta: Don't overwrite newer files when building the root filesystem 2022-07-07 21:49:48 +01:00
Tim Schumacher
5bbd5e7322 Ports: Don't create ccache symlinks for tools we don't have 2022-07-07 19:32:33 +02:00
Andrew Kaster
b1b61c902d WebSocket: Change target name to deconflict with LibWebSocket on Lagom
When compiling with Lagom, we give both LibWebSocket and the WebSocket
IPC service the Lagom:: prefix as an alias, but strip the Lib from all
library target names before applying the prefix. This creates a conflict
when external projects used the aliased name between the server and the
library. Give WebSocket a name that deconflicts it, but keep the binary
name the same, /bin/WebSocket.
2022-07-07 16:50:05 +02:00
Luke Wilde
7fbc354829 Ports: Update OpenSSL to 1.1.1q 2022-07-07 16:30:51 +02:00
Andreas Kling
94509c9844 LibWeb: Use correct margin & padding values in anonymous wrapper boxes
Anonymous wrappers get their non-inherited properties from the initial
state of a new CSS::ComputedValues object. Before this patch, all the
values in their margin and padding LengthBox would be "auto".
2022-07-06 20:31:27 +02:00
Andreas Kling
8abbbdf6fa LibWeb: Cache a pointer to the IFC root in InlineLevelIterator 2022-07-06 20:31:27 +02:00
Andreas Kling
4935055407 LibWeb: Keep the "remaining free space" across flexbox algo steps
Instead of recomputing the "remaining free space" per flex line,
remember it after calculating it during the "resolve flexible lengths"
step so we can reuse it later.
2022-07-06 20:31:24 +02:00
Andreas Kling
83a6be593c LibWeb: Add a 1-entry lookup cache to FormattingState
This makes repeated lookups of the state for the same box much faster
by bypassing the HashMap.
2022-07-06 20:31:22 +02:00