Commit graph

24658 commits

Author SHA1 Message Date
stelar7
8264511d32 LibWeb: Dont try to parse "data" urls as links 2021-07-23 14:18:17 +02:00
Brian Gianforcaro
204d5ff8f8 Kernel: Reduce useful ROP gadgets by zeroing used function registers
GCC-11 added a new option `-fzero-call-used-regs` which causes the
compiler to zero function arguments before return of a function. The
goal being to reduce the possible attack surface by disarming ROP
gadgets that might be potentially useful to attackers, and reducing
the risk of information leaks via stale register data. You can find
the GCC commit below[0].

This is a mitigation I noticed on the Linux KSPP issue tracker[1] and
thought it would be useful mitigation for the SerenityOS Kernel.

The reduction in ROP gadgets is observable using the ropgadget utility:

    $ ROPgadget --nosys --nojop --binary Kernel | tail -n1
    Unique gadgets found: 42754

    $ ROPgadget --nosys --nojop --binary Kernel.RegZeroing | tail -n1
    Unique gadgets found: 41238

The size difference for the i686 Kernel binary is negligible:

    $ size Kernel Kernel.RegZerogin
        text    data     bss     dec      hex filename
    13253648 7729637 6302360 27285645 1a0588d Kernel
    13277504 7729637 6302360 27309501 1a0b5bd Kernel.RegZeroing

We don't have any great workloads to measure regressions in Kernel
performance, but Kees Cook mentioned he measured only around %1
performance regression with this enabled on his Linux kernel build.[2]

References:
[0] d10f3e900b
[1] https://github.com/KSPP/linux/issues/84
[2] https://lore.kernel.org/lkml/20210714220129.844345-1-keescook@chromium.org/
2021-07-23 14:18:04 +02:00
davidot
4ef9edbff7 LibWeb: Fix that empty event handlers return null instead of crashing 2021-07-23 14:15:28 +02:00
Linus Groh
080112eb82 LibJS: Implement Temporal.PlainDateTime.prototype.getISOFields() 2021-07-23 08:18:11 +01:00
Linus Groh
18fd0d4011 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainDate() 2021-07-23 08:18:11 +01:00
Linus Groh
61b2780853 LibJS: Fix return type of PlainDateTime::iso_{milli,micro,nano}second() 2021-07-23 08:18:11 +01:00
Andreas Kling
082ed6f417 Kernel: Simplify VMObject locking & page fault handlers
This patch greatly simplifies VMObject locking by doing two things:

1. Giving VMObject an IntrusiveList of all its mapping Region objects.
2. Removing VMObject::m_paging_lock in favor of VMObject::m_lock

Before (1), VMObject::for_each_region() was forced to acquire the
global MM lock (since it worked by walking MemoryManager's list of
all regions and checking for regions that pointed to itself.)

With each VMObject having its own list of Regions, VMObject's own
m_lock is all we need.

Before (2), page fault handlers used a separate mutex for preventing
overlapping work. This design required multiple temporary unlocks
and was generally extremely hard to reason about.

Instead, page fault handlers now use VMObject's own m_lock as well.
2021-07-23 03:24:44 +02:00
Andreas Kling
64babcaa83 Kernel: Remove unused MAP_SHARED_ZERO_PAGE_LAZILY code path 2021-07-23 03:24:44 +02:00
Gunnar Beutner
59007bba84 Hearts: Avoid redrawing the UI unnecessarily 2021-07-23 02:34:59 +02:00
Andreas Kling
3f9e018d9a CrashDaemon: Remove BACKTRACE_DEBUG debugging code
This thing seems to work fine, no need to hang on to old debug code.
2021-07-22 23:34:33 +02:00
Andreas Kling
cdae397e6a DynamicLoader: Don't truncate dynamic section address on x86_64 2021-07-22 23:34:33 +02:00
Andreas Kling
e44a41d0bf Kernel: Convert Region to east-const style 2021-07-22 23:34:33 +02:00
Peter Elliott
bf16591c07 Assistant: Only open one Assistant at once
I found myself accidentally opening two assistants at once with the
Window+Space shortcut. Since only one assistant window is usable at the
same time, I made assistant only spawn 1 instance at most.
2021-07-22 23:34:15 +02:00
Peter Elliott
fdcfd2816e LibCore: Add LockFile, a filesystem based mutex
This API wraps flock(2) and also handles the file creation and deletion
when the LockFile goes out of scope.
2021-07-22 23:34:15 +02:00
Hendiadyoin1
7da12f0faf UserspaceEmulator: Move to using the new SoftFPU 2021-07-22 23:33:21 +02:00
Hendiadyoin1
45d0f84a27 UserspaceEmulator: Implement SoftFPU instructions
This implements almost all instructions related to the FPU, including
all MMX instructions as well.
A lot of these were copied and adjusted from the SoftCPU implementation.

The next big milestone would be QNan detection and ShadowValue handling.
2021-07-22 23:33:21 +02:00
Hendiadyoin1
09a1a0b319 UserspaceEmulator: Sketch out a SoftFPU interface 2021-07-22 23:33:21 +02:00
Hendiadyoin1
1d74742c29 AK: Add char SIMD types
These are used in intrinsics, which do not recognize any signed version
of the char type
2021-07-22 23:33:21 +02:00
Hendiadyoin1
eb6af29421 LibX86: Add missing MovD and MovQ instructions
These are placeholders for now
2021-07-22 23:33:21 +02:00
Hendiadyoin1
efa42c4d45 LibX86: Use names closer to the spec for the Modrm
This gets rid of a lot of magic number shifts and ands.
2021-07-22 23:33:21 +02:00
Sam Atkins
68193c365f LibWeb: Resolve CSS text-decoration from value list
This detects and resolves these in the text-decoration property, in any
order:

- text-decoration-color
- text-decoration-line
- text-decoration-style

Only the solid underline renders, but all three sub-properties are
assigned correctly.
2021-07-22 23:09:01 +02:00
Sam Atkins
29b61123a4 LibWeb: Resolve background properties from ValueListStyleValue
As before, there are several sub-properties that we do not support, and
we ignore anything after the first comma.
2021-07-22 23:09:01 +02:00
Sam Atkins
6e08b200d4 LibWeb: Implement ImageStyleValue parsing
Later we will want to make a distinction between URL and Image values,
but this works for now.
2021-07-22 23:09:01 +02:00
Sam Atkins
82f3228dd2 LibWeb: Resolve CSS font property from value list
The font property now resolves into its various parts:

- font-family
- font-weight
- font-size
- font-style
- line-height

The font-variant and font-stretch parts are left unparsed since LibWeb
doesn't know how to render those.

Added `fonts.html` as a test for various forms of `font` declarations,
based on the examples in the spec.
2021-07-22 23:09:01 +02:00
Sam Atkins
a44d7670ab LibWeb: Resolve CSS list-style from value list
This resolves the three sub-properties, appearing in any order:

- list-style-image
- list-style-position
- list-style-type

Added `list-style-position` values to support this, though they are not
yet used in rendering.
2021-07-22 23:09:01 +02:00
Sam Atkins
b693a22c2d LibWeb: Resolve CSS flex/flex-flow from value list
Also moved the 'flex' code in StyleResolver to be next to
the 'flex-flow' code, because that seemed more reasonable.
2021-07-22 23:09:01 +02:00
Sam Atkins
7abfb18656 LibWeb: Implement CSS color parsing from Tokens
This was broken when we switched away from using StringStyleValues.
While I was at it, I have implemented hsl/a() and the percentage
syntax for rgb/a().

As a bonus, added `colors.html` as a test page for the various CSS
color syntaxes, since nothing was testing rgb() or rgba() before.

Much of the parsing code in LibGFX/Color.h seems to be centered
around CSS color values, but this is not used by the new Parser.
(And can't be used, because it requires a String value and we have
a list of Tokens of some kind instead.) Maybe that should be removed
from there when the new CSS parser is operational.
2021-07-22 23:09:01 +02:00
Sam Atkins
fabbd06de4 LibGfx: Implement Color::from_hsl/hsla()
This is required by CSS, and implemented based on the CSS standard's
algorithm.
2021-07-22 23:09:01 +02:00
Sam Atkins
4853c89c42 LibWeb: Handle ValueListStyleValues in StyleResolver
This implements a lot of cases, but not all of them. The following
need more infrastructure first:

- Flex
- FlexFlow
- Background
- BackgroundImage
- BackgroundRepeat
- ListStyle and parts
- Font

Also, colors are not parsed correctly. This will be handled next.
2021-07-22 23:09:01 +02:00
Sam Atkins
6e0376361a LibWeb: Expose StyleValue parsing method in CSS Parser
Now that StyleResolver is going to deal with StyleComponentValueRules,
it will need to be able to parse those into StyleValues, using
`parse_css_value()`.

Also added StyleValue::is_builtin_or_dynamic(), which returns true for
values that are valid anywhere - things like `initial` and `inherit`,
along with `var()`, `attr()` and `calc()` - which we want to test for
easily.
2021-07-22 23:09:01 +02:00
Sam Atkins
57d34f1966 LibWeb: Convert StyleResolver.{h,cpp} to east const 2021-07-22 23:09:01 +02:00
Sam Atkins
d72ce7b989 LibWeb: Generate a ValueListStyleValue when parsing CSS values
We skip whitespace tokens while doing this. As far as I can tell,
whitespace is not useful once we get to this point, and it legally
may or may not appear between any two tokens. By not including it
in the ValueListStyleValue, we make the "if it has 3 parts"-type
checks a lot more straightforward.
2021-07-22 23:09:01 +02:00
Sam Atkins
4a03279539 LibWeb: Add CSS ValueListStyleValue
As the new CSS parser tokenizes its input, we can no longer easily
rely on a StringStyleValue for multi-value properties. (eg, border)
ValueListStyleValue lets us wrap all of the ComponentValues that
the Parser produced for one declaration, as a single StyleValue, to
then be parsed into StyleValues by the StyleResolver.

Originally, I wanted it to be a list of StyleValues, but several
properties use syntax that makes use of non-StyleValue tokens, eg:
```css
/* Syntax using a / */
font: 12px/14px sans-serif;
/* Multiple values separated by commas */
background: url(catdog.png), url(another-image.jpg), blue;
```
Passing the ComponentValue tokens themselves means that all that
information is carried over. The alternative might be to create a
StyleValue subclass for each property and parse them fully inside
the Parser. (eg, `FontStyleValue`)

I decided against `ListStyleValue` as a name, to avoid confusion
with list styles. It's not ideal, but names are hard.
2021-07-22 23:09:01 +02:00
Karol Kosek
8c2be4b3dc LibAudio: Implement loaded_samples() in the FLAC Loader
This makes aplay show current playback position.
2021-07-22 22:57:05 +02:00
Karol Kosek
01e1e2c2c5 LibAudio: Read custom block sizes and sample rates as big endian
This fixes stucking in a loop at the end of the file, as
(a) custom block sizes are usually placed there, as the remaining
size might not be simply calculated as a power of two, and
(b) the number of bytes to read was incorrect (the program said
the block size was 32525, where flac -a said it's actually 3200).

Unfortunately, I couldn't trigger the bug for the sample rates,
so it may be not true, but I'd doubt it, giving the fact that flac
almost everywhere uses big endian numbers.
2021-07-22 22:57:05 +02:00
Karol Kosek
69c7b66f06 LibAudio: Don't read too much bytes in FLAC
This fixes crash when reading the end of the file.

The logic is mostly borrowed from WavLoader.
2021-07-22 22:57:05 +02:00
Ali Mohammad Pur
73fc2b3748 AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith concept
This makes it so these algorithms are usable with arbitrary iterators,
as opposed to just instances of AK::SimpleIterator.
This commit also makes the requirement of ::index() in find_index()
explicit, as previously it was accepting any iterator.
2021-07-22 22:56:20 +02:00
Ali Mohammad Pur
2dc31c503e AK: Convert AnyOf/AllOf to east-const style 2021-07-22 22:56:20 +02:00
Ali Mohammad Pur
d40d10aae7 AK: Implement {any,all}_of(IterableContainer&&, Predicate)
This is a generally nicer-to-use version of the existing {any,all}_of()
that doesn't require the user to explicitly provide two iterators.
As a bonus, it also allows arbitrary iterators (as opposed to the hard
requirement of providing SimpleIterators in the iterator version).
2021-07-22 22:56:20 +02:00
Ali Mohammad Pur
f879e04133 AK: Add a concept for iterable containers
This concept describes a type with a begin()/end() pair that can
function as an iterator, given the following criteria:
- The return type of begin() is comparable with the return type of
  end(), and the comparison (with operator!=) yields a bool
- The object returned from begin() can be pre-incremented
- The iterator has an operator*() implementation
2021-07-22 22:56:20 +02:00
Ali Mohammad Pur
2891dca0cd AK: Add a deduction guide to Vector
Note that this does not generate a vector with inline capacity.
2021-07-22 22:56:20 +02:00
Ali Mohammad Pur
6c9ef20010 AK: Add a CommonType<Ts...> type trait
Also adds a simple-ish test for CommonType.
2021-07-22 22:56:20 +02:00
Timothy
ccd19d464e LibGUI: Handle multiple lines of text in MessageBox
The total height of text is calculated from the glyph height, the number
of lines, and a padding modifier.
2021-07-22 22:38:25 +02:00
Kenneth Myhra
cc45ccbd9b Ports: Add ScummVM game Soltys 2021-07-22 22:30:55 +02:00
Kenneth Myhra
d84102de99 Ports: Add ScummVM game Sfinx 2021-07-22 22:30:55 +02:00
Kenneth Myhra
caca5b0b3e Ports: Add ScummVM game Nippon Safes Inc 2021-07-22 22:30:55 +02:00
Kenneth Myhra
924930f357 Ports: Add ScummVM game Lure of the Temptress 2021-07-22 22:30:55 +02:00
Kenneth Myhra
8853d94032 Ports: Add ScummVM game DreamWeb 2021-07-22 22:30:55 +02:00
Kenneth Myhra
59e303cc54 Ports: Add ScummVM game Dráscula: The Vampire Strikes Back 2021-07-22 22:30:55 +02:00
Kenneth Myhra
281cff7845 Ports: Add ScummVM game Hi-Res Adventure #1: Mystery House 2021-07-22 22:30:55 +02:00