Commit Graph

17659 Commits

Author SHA1 Message Date
Mițca Dumitru
857b0e1dc3 LibC: Add imaxdiv and lldiv 2021-03-09 07:28:06 +01:00
Mițca Dumitru
42a8186728 LibM: Define floating point comparsion macros 2021-03-09 07:28:06 +01:00
Mițca Dumitru
70737b42b2 LibM: Define math_errhandling and associated macros 2021-03-09 07:28:06 +01:00
Ben Wiederhake
1e857de263 UserspaceEmulator: Support munmap/mprotect with partial mappings
Fixes #5663.
2021-03-08 22:57:36 +01:00
Ben Wiederhake
45443f24ec UserspaceEmulator: Enable splitting regions at arbitrary points
This is not yet useful in and of itself, but enables the feature in the next commit.
2021-03-08 22:57:36 +01:00
Ben Wiederhake
7cc8f20a30 UserspaceEmulator: Convert backing storage from malloc to mmap
This saves a few bytes for each guest-mmaped region, especially since these are likely to be page-aligned.
2021-03-08 22:57:36 +01:00
Andreas Kling
968ad0f8d1 LibWeb: Some improvements to CSS height:auto computation for blocks
Auto block heights are now computed according to something that kinda
resembles the specification.

Blocks with inline children and height:auto have their height computed
based on the top of the first line box and the bottom of the last line
box. Very straightforward.

Blocks with block children and height:auto have their height computed
based on the top of the first in-flow block child's margin box, and the
bottom of the last in-flow block child's margin box.
2021-03-08 22:53:28 +01:00
Andreas Kling
0918dd0460 Website: Add link to @ABigPickle's VLA exploit 2021-03-08 22:53:28 +01:00
Andreas Kling
dfca6b03e4 Website: Reorganize bounty page history section a little bit 2021-03-08 22:53:28 +01:00
Brian Gianforcaro
bac0dd5e3d LibGUI: Use AK_ENUM_BITWISE_OPERATORS for the FocusPolicy enum 2021-03-08 18:47:40 +01:00
Brian Gianforcaro
5f6ab77352 Kernel: Add bitwise operators for Thread::FileBlocker::BlockFlags enum
Switch to using type-safe bitwise operators for the BlockFlags class,
this cleans up a lot of boilerplate casts which are necessary when the
enum is declared as `enum class`.
2021-03-08 18:47:40 +01:00
Brian Gianforcaro
eaef57443c Kernel: Make MemoryManager API type-safe for Region::Access enum
Increase type-safety moving the MemoryManager APIs which take a
Region::Access to actually use that type instead of a `u8`.

Eventually the actually m_access can be moved there as well, but
I hit some weird bug where it wasn't using the correct operators
in `set_access_bit(..)` even though it's declared (and tested).
Something to fix-up later.
2021-03-08 18:47:40 +01:00
Brian Gianforcaro
c825159f01 AK: Add AK_ENUM_BITWISE_OPERATORS(..) to enable type-safe enum bitwise operations
This change introduces `AK_ENUM_BITWISE_OPERATORS(..)` which when
enabled for an enum, will automatically declare all the necessary
bitwise operators for that enum.

This allows bit masks enums to be used as first class, type safe, citizens.
2021-03-08 18:47:40 +01:00
Andreas Kling
dda6eb0f1f LibWeb: Implement StyleSheet.type
This just returns "text/css" on CSSStyleSheet, nothing exciting.
2021-03-08 16:16:28 +01:00
Andreas Kling
2cff070108 LibWeb: Map all the IDL string types to AK::String for now
DOMString, CSSOMString and USVString can all map to AK::String for now,
until we figure something better out.
2021-03-08 16:14:56 +01:00
Andreas Kling
bc116f3b13 LibWeb: Give CSSLoader a backpointer to its owner element
This allows CSSLoader to set up the style sheet owner node internally,
and avoids an awkward weak link between CSSLoader and Document.
2021-03-08 16:03:14 +01:00
Andreas Kling
d07fcba69b LibWeb: Implement StyleSheet.ownerNode :^) 2021-03-08 16:03:14 +01:00
Tom
183b2e71ba AK: Take advantage of constexpr in Time and add time conversion methods
By making the Time constructor constexpr we can optimize creating a
Time instance from hardcoded values.

Also add more functions to convert between Time and various time units.
2021-03-08 15:29:11 +01:00
Tom
42bc229500 AK: Initialize the AK::Time members
Since we tell the compiler to provide a default constructor we
need to initialize the member variables.
2021-03-08 15:29:11 +01:00
Andreas Kling
096c4571bb Ports: Add SDL2_mixer 2021-03-08 13:15:35 +01:00
Andreas Kling
a9830d9a55 LibWeb: Start exposing CSS style sheets to JavaScript :^)
This patch adds bindings for the following objects:

- StyleSheet
- StyleSheetList
- CSSStyleSheet

You can get to a document's style sheets via Document.styleSheets
and iterate through them using StyleSheetList's item() and length().

That's it in terms of functionality at this point, but still neat. :^)
2021-03-08 11:50:36 +01:00
Andreas Kling
0d515dea5d LibWeb: Allow specifying a custom C++ implementation for IDL attributes
The "ImplementedAs" extended attribute can now be specified on IDL
attributes to provide the name of a custom C++ implementation instead
of assuming it will have the same name as the attribute.
2021-03-08 11:50:36 +01:00
Andreas Kling
79bc07e5af LibWeb: Make generated wrapper code cast IDL longs to i32 for now
This makes it possible to use "long" and "unsigned long" in IDL.
2021-03-08 11:50:36 +01:00
Andreas Kling
483b45db3f AK: JsonObject::value_or() fallback value should be a const reference 2021-03-08 11:50:36 +01:00
Jorropo
9eff9b8cea Ports/git: remove no longer needed patches 2021-03-08 10:22:14 +01:00
Brendan Coles
69b98f7d32 Base: Add sysctl man page 2021-03-08 09:48:34 +01:00
AnotherTest
fb68aa1480 Shell: Don't blindly dereference the result of Parser::parse()
It _may_ return nullptr if there's nothing to return.
Fixes #5691.
2021-03-08 09:28:15 +01:00
Emanuele Torre
26c4cae77c Meta: check-newlines-at-eof.py now checks .json files and files in Base/
This makes it also check man pages and keymap files. :^)
2021-03-08 09:20:53 +01:00
Emanuele Torre
dd17ec180f Base: Fix newlines at end of file in some files. 2021-03-08 09:20:53 +01:00
Emanuele Torre
1f81bc6879 Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
Emanuele Torre
6749ba3477 Base: Replace HTMl => HTML 2021-03-08 09:20:53 +01:00
Emanuele Torre
b7de2046e6 Meta: serenityos.org: Fix javascript error in the 2nd anniversary page.
The error as seen from chromium's devtools:

    Uncaught ReferenceError: I is not defined
        at (index):455
2021-03-08 09:20:53 +01:00
aabajyan
0dfbc2c702 Ports: Add Genemu
This is a Basic Genesis / MegaDrive Emulator, that only requires
SDL2 to run it.

Usage: genemu /path/to/game.bin
2021-03-08 08:57:12 +01:00
Luke
368f78d03c Kernel: Manually reset the XCR0 register
According to the Intel manual: "After reset, all bits (except bit 0) in
XCR0 are cleared to zero; XCR0[0] is set to 1."
Sadly we can't trust this, for example VirtualBox starts with
bits 0-4 set, so let's do it ourselves.

Fixes #5653
2021-03-08 08:56:38 +01:00
Mițca Dumitru
5265a2d23e LibC: Remove stdbool.h as it is provided by the compiler 2021-03-08 08:56:15 +01:00
Mițca Dumitru
35829304d6 LibC: Define static_assert in assert.h when it's being used in C 2021-03-08 08:56:15 +01:00
AnotherTest
8cc279ed74 LibCrypto: Fail with overflow when bitfield has too many unused bits
There cannot be more unused bits than the entirety of the input.
Found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31706#c1
2021-03-08 08:32:07 +01:00
Jelle Raaijmakers
f9f9cda025 LibCompress: Rename libcompression.so to libcompress.so 2021-03-07 18:14:54 +01:00
Andreas Kling
e6f886677e LibWeb: Fix clang-format issue in CSS/StyleResolver.cpp 2021-03-07 17:53:20 +01:00
Andreas Kling
30b957e46c Ports: Add SDL2_ttf 2021-03-07 17:48:21 +01:00
Andreas Kling
fefb05f6f3 LibWeb: Split CSS::StyleSheet into StyleSheet and CSSStyleSheet
This is a little convoluted but matches the CSSOM specification.
2021-03-07 17:45:15 +01:00
Andreas Kling
0af4762662 LibWeb: Rename StyleRule => CSSStyleRule
This matches the CSSOM specification.
2021-03-07 17:45:15 +01:00
Linus Groh
3532e1788f open: Fix opening "." (again)
We can't always rely on the initial URL's path(), so use either the
user-specified argument or the URL path for determining the realpath,
depending on whether we got a file:// URL argument.

Fixes #4950.
2021-03-07 17:39:58 +01:00
Ben Wiederhake
501952852c Kernel: Fix pointer over/underflow in create_thread
The expression
    (u8*)params.m_stack_location + stack_size
… causes UBSan to spit out the warning
    KUBSAN: addition of unsigned offset to 0x00000002 overflowed to 0xb0000003
… even though there is no actual overflow happening here.
This can be reproduced by running:
    $ syscall create_thread 0 [ 0 0 0 0 0xb0000001 2 ]
Technically, this is a true-positive: The C++-reference is incredibly strict
about pointer-arithmetic:
    > A pointer to non-array object is treated as a pointer to the first element
    > of an array with size 1. […] [A]ttempts to generate a pointer that isn't
    > pointing at an element of the same array or one past the end invoke
    > undefined behavior.
    https://en.cppreference.com/w/cpp/language/operator_arithmetic
Frankly, this feels silly. So let's just use FlatPtr instead.

Found by fuzz-syscalls. Undocumented bug.

Note that FlatPtr is an unsigned type, so
    user_esp.value() - 4
is defined even if we end up with a user_esp of 0 (this can happen for example
when params.m_stack_size = 0 and params.m_stack_location = 0). The result would
be a Kernelspace-pointer, which would then be immediately flagged by
'MM.validate_user_stack' as invalid, as intended.
2021-03-07 17:31:25 +01:00
Ben Wiederhake
b6472204e5 AK+Tests: Also test Checked<> with unsigned
As expected, Checked<unsigned> works as intended. However, we didn't have a
test for that, so I added one.

See also 90c070cb1d.
2021-03-07 17:31:25 +01:00
Ben Wiederhake
8f3bed4671 Tests: Make syscall-fuzzer less brittle 2021-03-07 17:31:25 +01:00
Ben Wiederhake
00131d244e Kernel: Expose sysctl 'ubsan_is_deadly' to panic the Kernel on UB
This makes it easier to find UB, for example when fuzzing the Kernel.

This can be enabled by default, thanks to @boricj's work in
32e1354b9b.
2021-03-07 17:31:25 +01:00
Linus Groh
a0362d827c FileManager: Disable view change actions when directory is unreadable
Closes #3556.
2021-03-07 16:19:36 +01:00
thankyouverycool
1ccf9de6b9 Serendipity: Couple more tips and some clean-up 2021-03-07 15:41:32 +01:00
Andreas Kling
2d7d5f2b55 Serendipity: Make main window a normal window
..instead of a tool window. Tool windows are meant as accessories to
an application's main/primary windows, not to be primary windows
themselves.

Fixes #5667.
2021-03-07 14:19:20 +01:00