Commit graph

31889 commits

Author SHA1 Message Date
Jelle Raaijmakers
5e01ca29c5 LibGL: Optimize float divisions in unpack_color
For Tux Racer on my machine, this function would account for 15% of
samples. After this change, that drops down to 9%.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
8d8f74e334 Ports: Implement SDL_QUIT event in Tux Racer
This allows the user to close Tux Racer by closing the window.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
1a3af23a10 LibGL: Defer depth writing until after alpha testing
In the OpenGL fixed function pipeline, alpha testing should happen
before depth testing and writing. Since the tests are basically boolean
ANDs, we can reorder them however we like to improve performance and as
such, we perform early depth testing and delay the more expensive alpha
testing until we know which pixels to test.

However, we were already writing to the depth buffer during the depth
test, even if the alpha test fails later on. Depth writing should only
happen if depth testing _and_ writing is enabled.

This change introduces depth staging, deferring the depth write until
we are absolutely sure we should do so.
2021-12-30 14:24:29 +01:00
Timothy Flynn
565a880ce5 Userland: Link directly against LibUnicodeData where needed
This is partially a revert of commits:
    10a8b6d411
    561b67a1ad

Rather than adding the prot_exec pledge requried to use dlopen(), we can
link directly against LibUnicodeData in applications that we know need
that library.

This might make the dlopen() dance a bit unnecessary. The same purpose
might now be fulfilled with weak symbols. That can be revisted next, but
for now, this at least removes the potential security risk of apps like
the Browser having prot_exec privileges.
2021-12-30 14:18:12 +01:00
Timothy Flynn
0c84957eba Meta: Add helper CMake function to link directly against LibUnicodeData
Rather than each CMakeLists.txt needing to import unicode_data.cmake and
check if Unicode data generation is enabled, add a helper method to do
this.
2021-12-30 14:18:12 +01:00
Daniel Bertalan
8e2efe78f7 Kernel: Tighten String-related includes 2021-12-30 14:16:03 +01:00
Daniel Bertalan
2175c689ef Kernel: Remove redundant (K)String::characters() calls 2021-12-30 14:16:03 +01:00
Daniel Bertalan
1d2f78682b Kernel+AK: Eliminate a couple of temporary String allocations 2021-12-30 14:16:03 +01:00
Daniel Bertalan
726c023f9e Kernel: Propagate allocation failure in resolve_path_without_veil 2021-12-30 14:16:03 +01:00
Maciej
cd92b73845 LibGUI: Convert INISyntaxHighlighter to east-const 2021-12-30 14:12:39 +01:00
Maciej
1f7e363b74 LibGUI: Use consistent naming scheme in INILexer 2021-12-30 14:12:39 +01:00
Maciej
18d489faec LibGUI: Handle '#' comments in INILexer
They are supported by LibCore's ConfigFile but were not higlighted.
2021-12-30 14:12:39 +01:00
Owen Smith
3f2b70382e Kernel: Fix incorrect SFMASK MSR value clobbering reserved bits
Also improve the comments around that initialisation code.
2021-12-30 14:12:26 +01:00
salaaad2
d364c8e352 Base: Add manpages for cut, diff, head & rmdir command line utilities 2021-12-29 20:42:18 -08:00
Linus Groh
87068896d0 LibJS: Evaluate NewExpression arguments before checking constructor type
Exactly like in 99f9609, which fixed the same issue in CallExpression,
the spec tells us to *first* evaluate the arguments, if any, and *then*
check if the provided value is a constructor function.
2021-12-30 01:02:30 +01:00
Lady Gegga
d636f7703d Base: Add Misc. Symbols and Pictographs to font Katica Regular 10
https://www.unicode.org/charts/PDF/U1F300.pdf
1F510, 1F511, 1F520-1F522, 1F5A8, 1F5B6, 1F5B8, 1F5D6-1F5DB, 1F5F4,
1F5F5, 1F5F8, 1F5F9
2021-12-30 00:43:10 +01:00
Lady Gegga
55a0365c8e Base: Add CJK Symbols and Punctuation to font Katica Regular 10
3014-3015
https://www.unicode.org/charts/PDF/U3000.pdf
2021-12-30 00:43:10 +01:00
Lady Gegga
fd3cb281fc Base: Add Dingbats to font Katica Regular 10
2705, 2708, 2709, 2713-2716, 274C-2753, 2755-2757, 275B-2761,
276C-2775, 2795-2797, 27A8
https://www.unicode.org/charts/PDF/U2700.pdf
2021-12-30 00:43:10 +01:00
Lady Gegga
87799f0be9 Base: Add Miscellaneous Symbols to font Katica Regular 10
2605, 2606, 2610-2612, 2614, 2616, 2617, 262D, 262E,
2639-263B, 2640, 2660-2667, 2669-266F, 267A, 267E-2689,
2690-2693, 2698, 2699, 26A2, 26B2, 26BF, 26C6, 26C8-26CD,
26CF, 26D0, 26D2-26E1, 26E8, 26F5, 26F6, 26F8-26FB, 26FD
https://www.unicode.org/charts/PDF/U2600.pdf
2021-12-30 00:43:10 +01:00
Lady Gegga
f4bbd6157a Base: Adjust some glyphs in font Katica Regular 10
Adjust glyphs to the fonts "new" 10p max width.
Specials:
FFFD https://www.unicode.org/charts/PDF/UFFF0.pdf
Geometric Shapes:
25A0-25B1 https://www.unicode.org/charts/PDF/U25A0.pdf
2021-12-30 00:43:10 +01:00
tuftedocelot
4633f89217 Meta: Use portable gzip option for extracting PCI and USB ID files
gzip -c is supported in both Linux and BSD flavors of gzip. The -o flag
was introduced in a previous commit which is present in OpenBSD, but not
other flavors of Linux. -c will write to stdout which is redirected to
the target files. As a side benefit, we no longer need to copy files
anywhere
2021-12-29 15:03:47 -08:00
Brian Gianforcaro
018dc4bb5c Kernel: Add verification promise violations are propagated properly
This change adds a thread member variable to track if we have a pending
promise violation on a kernel thread. This ensures that all code
properly propagates promise violations up to the syscall handler.

Suggested-by: Andreas Kling <kling@serenityos.org>
2021-12-29 18:08:15 +01:00
Brian Gianforcaro
54b9a4ec1e Kernel: Handle promise violations in the syscall handler
Previously we would crash the process immediately when a promise
violation was found during a syscall. This is error prone, as we
don't unwind the stack. This means that in certain cases we can
leak resources, like an OwnPtr / RefPtr tracked on the stack. Or
even leak a lock acquired in a ScopeLockLocker.

To remedy this situation we move the promise violation handling to
the syscall handler, right before we return to user space. This
allows the code to follow the normal unwind path, and grantees
there is no longer any cleanup that needs to occur.

The Process::require_promise() and Process::require_no_promises()
functions were modified to return ErrorOr<void> so we enforce that
the errors are always propagated by the caller.
2021-12-29 18:08:15 +01:00
Brian Gianforcaro
c444a3fc9e Kernel: Add EPROMISEVIOLATION as a kernel ErrnoCode 2021-12-29 18:08:15 +01:00
Brian Gianforcaro
89783d7843 Kernel: Remove now unused REQUIRE_PROMISE and REQUIRE_NO_PROMISES macros 2021-12-29 18:08:15 +01:00
Brian Gianforcaro
0f7fe1eb08 Kernel: Use Process::require_no_promises instead of REQUIRE_NO_PROMISES
This change lays the foundation for making the require_promise return
an error hand handling the process abort outside of the syscall
implementations, to avoid cases where we would leak resources.

It also has the advantage that it makes removes a gs pointer read
to look up the current thread, then process for every syscall. We
can instead go through the Process this pointer in most cases.
2021-12-29 18:08:15 +01:00
Brian Gianforcaro
bad6d50b86 Kernel: Use Process::require_promise() instead of REQUIRE_PROMISE()
This change lays the foundation for making the require_promise return
an error hand handling the process abort outside of the syscall
implementations, to avoid cases where we would leak resources.

It also has the advantage that it makes removes a gs pointer read
to look up the current thread, then process for every syscall. We
can instead go through the Process this pointer in most cases.
2021-12-29 18:08:15 +01:00
Luke Wilde
c4f60844c5 Kernel: Print KUBSAN backtrace to screen if KUBSAN is deadly 2021-12-29 17:58:44 +01:00
Luke Wilde
8eb01c0b11 ImageViewer: Allow choice between nearest neighbor and bilinear scaling
Currently, ImageViewer always uses nearest neighbor scaling.
This allows the user to choose whether to use nearest neighbor
or bilinear scaling. It current defaults to nearest neighbor.
2021-12-29 17:58:32 +01:00
davidot
e179cf2540 LibJS: Don't VERIFY that the token after 'import' is one of '.' and '('
Although those are the only valid options parse_primary_expression is
sometimes called when only an expression is valid which means it did not
check match_expression and might fail the now removed VERIFY.
2021-12-29 16:57:23 +01:00
davidot
56c425eec1 LibJS: Detect invalid unicode and stop lexing at that point
Previously we might swallow invalid unicode point which would skip valid
ascii characters. This could be dangerous as we might skip a '"' thus
not closing a string where we should.
This might have been exploitable as it would not have been clear what
code gets executed when looking at a script.

Another approach to this would be simply replacing all invalid
characters with the replacement character (this is what v8 does). But
our lexer and parser are currently not set up for such a change.
2021-12-29 16:57:23 +01:00
davidot
b1e022908d LibJS: Remove unused declaration copy_data_properties
The method was moved to Object but this declaration was not removed.
2021-12-29 16:57:23 +01:00
Linus Groh
87a89e7126 LibJS: Convert create_global_function_binding() to ThrowCompletionOr 2021-12-29 16:02:44 +01:00
Linus Groh
4767be1459 LibJS: Convert create_global_var_binding() to ThrowCompletionOr 2021-12-29 16:00:36 +01:00
Linus Groh
8296d3fbd2 LibJS: Convert can_declare_global_function() to ThrowCompletionOr 2021-12-29 15:56:53 +01:00
Linus Groh
215a56b0e4 LibJS: Convert can_declare_global_var() to ThrowCompletionOr 2021-12-29 15:54:44 +01:00
Linus Groh
1817c1f83c LibJS: Convert has_restricted_global_property() to ThrowCompletionOr 2021-12-29 15:50:50 +01:00
Linus Groh
9571631b58 LibJS: Add spec comments to remaining GlobalEnvironment methods 2021-12-29 15:48:11 +01:00
Brian Gianforcaro
b5367bbf31 Kernel: Clarify why ftruncate() & pread() are passed off_t const*
I fell into this trap and tried to switch the syscalls to pass by
the `off_t` by register. I think it makes sense to add a clarifying
comment for future readers of the code, so they don't fall into the
same trap. :^)
2021-12-29 05:54:04 -08:00
Idan Horowitz
9d034785de Kernel: Make File::unref virtual
This is required for SlavePTY's custom unref handler to function
correctly, as otherwise a SlavePTY held in a File RefPtr would call
the base's (RefCounted<>) unref method instead of SlavePTY's version.
2021-12-29 15:46:14 +02:00
tuftedocelot
6dee1e91be Meta+Documentation: Don't rebuild disk image for every run on OpenBSD 2021-12-29 03:46:56 -08:00
tuftedocelot
68e4e7923a Meta: Add egcc as a GCC candidate
egcc is the alias for the GCC compiler (since OpenBSD uses Clang by
default). Toolchain/BuildIt.sh has the necessary adjustments, but the
compiler check occurs before BuildIt.sh is called.
2021-12-29 03:46:56 -08:00
tuftedocelot
5810467c97 Build: Remove gzip -k usage in PCI/USB ID files and crypt for OpenBSD
OpenBSD gzip does not have the -k flag to keep the original after
extraction. Work around this by copying the original gzip to the dest
and then extracting. A bit of a hack, but only needs to be done for the
first-time or rebuilds

OpenBSD provides crypt in libc, not libcrypt. Adjust if/else to check
for either and proceed accordingly

Remove outdated OpenBSD checks when building the toolchain
2021-12-29 03:46:56 -08:00
tuftedocelot
ea0a002468 LibCore: Add OpenBSD headers to System and LocalSocket
Add the correct header to System.h and add OpenBSD-specific handling of
signals and socket process id
2021-12-29 03:46:56 -08:00
kleines Filmröllchen
f650efc76f Documentation: Elaborate on GRUB image flashing and video-less debugging
This should help others to not run into the same roadblocks with
bare-metal that I ran into.
2021-12-29 03:45:59 -08:00
Daniel Bertalan
a34c657eb3 Base: Add DEC Special Graphics characters to Csilla Regular 10
The following codepoints are included:
U+2518, U+2510, U+250C, U+2514, U+253C, U+2500, U+251C, U+2524, U+2534,
U+252C, U+2502
2021-12-29 03:42:45 -08:00
Daniel Bertalan
fcc8bd6f8e Base: Add support for the default XTerm color scheme
Finally, the "Color Scheme" combo box gets an option besides "Default".
2021-12-29 03:42:45 -08:00
Daniel Bertalan
d8e383edd0 LibVT: Always clear "stomp" state when changing the cursor position
This fixes a bug, where we mistakenly put a character in the next row if
the cursor was told to move to the rightmost column when it was already
there.
2021-12-29 03:42:45 -08:00
Daniel Bertalan
2329c52ad9 Base: Add some box drawing characters to font Csilla Regular 10
This commit adds the characters used by vim's popup window feature to
draw window borders. Namely:
- U+2550 BOX DRAWINGS DOUBLE HORIZONTAL
- U+2551 BOX DRAWINGS DOUBLE VERTICAL
- U+2554 BOX DRAWINGS DOUBLE DOWN AND RIGHT
- U+2557 BOX DRAWINGS DOUBLE DOWN AND LEFT
- U+255A BOX DRAWINGS DOUBLE UP AND RIGHT
- U+255D BOX DRAWINGS DOUBLE UP AND LEFT
2021-12-29 03:42:45 -08:00
Daniel Bertalan
e37dbee017 Kernel+LibC: Add ECANCELED errno value
This is needed for clangd to compile.
2021-12-29 03:42:45 -08:00