Commit Graph

24033 Commits

Author SHA1 Message Date
Alexander
459aa44f6b LibWeb: Avoid UAF in query_selector{,_all}()
This fixes a bug that caused the selector to be dumped.
It would relase the RefPtr into a dump function, and then use it.
2021-07-17 01:48:04 +04:30
Linus Groh
86c6e68431 LibJS: Implement Temporal.Duration.prototype.abs() 2021-07-16 21:59:13 +01:00
Linus Groh
7df47bf3fb LibJS: Implement Temporal.Duration.prototype.negated() 2021-07-16 21:59:13 +01:00
Linus Groh
9aa1e4b885 LibJS: Implement Temporal.Duration.prototype.with() 2021-07-16 21:59:13 +01:00
Linus Groh
510f668ae3 LibJS: Add TokenType::{Debugger,With} to Token::is_identifier_name()
Also remove TokenType::Interface, that should be handled elsewhere (as
a 'future reserved word' in strict mode).
2021-07-16 21:59:13 +01:00
Ali Mohammad Pur
52a2518a69 LibWasm: Remove a useless use of ScopeGuard
There are no multiple exit paths in that function, so we can just put
the ending logic right at the end of the function instead.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
65cd5526cb LibWasm+Everywhere: Make the instruction count limit configurable
...and enable it for LibWeb and test-wasm.
Note that `wasm` will not be limited by this.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
70b94f58b2 LibWasm: Inline some very hot functions
These are mostly pretty small functions too, and they were about ~10%
of runtime.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
bacf5a7220 wasm: Don't try to print the function results if it traps 2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
23b48f8fe1 Revert "LibWasm: Some more performance stuff (#8812)"
This reverts commit 35394dbfaa.
I pushed the wrong button again, hopefully this will be the last of
such incidents.
2021-07-17 01:11:28 +04:30
Ali Mohammad Pur
35394dbfaa
LibWasm: Some more performance stuff (#8812)
* wasm: Don't try to print the function results if it traps

* LibWasm: Inline some very hot functions

These are mostly pretty small functions too, and they were about ~10%
of runtime.

* LibWasm+Everywhere: Make the instruction count limit configurable

...and enable it for LibWeb and test-wasm.
Note that `wasm` will not be limited by this.

* LibWasm: Remove a useless use of ScopeGuard

There are no multiple exit paths in that function, so we can just put
the ending logic right at the end of the function instead.
2021-07-17 01:04:37 +04:30
Daniel Bertalan
3099a6bf2a Kernel+AK: Generate compile-time error for non-sized delete
This is a much more ergonomic option than getting a
`VERIFY_NOT_REACHED()` failure at run-time. I encountered this issue
with Clang, where sized deallocation is not the default due to ABI
breakage concerns.

Note that we can't simply just not declare these functions, because the
C++ standard states:
> If this function with size parameter is defined, the program shall
> also define the version without the size parameter.
2021-07-16 20:51:13 +02:00
Daniel Bertalan
dd4ed4d22d Kernel: Implement aligned operator new and use it
The compiler will use these to allocate objects that have alignment
requirements greater than that of our normal `operator new` (4/8 byte
aligned).

This means we can now use smart pointers for over-aligned types.

Fixes a FIXME.
2021-07-16 20:51:13 +02:00
Daniel Bertalan
c176680443 Kernel: Tell the compiler about operator new's alignment
By default, the compiler will assume that `operator new` returns
pointers that are aligned correctly for every built-in type. This is not
the case in the kernel on x64, since the assumed alignment is 16
(because of long double), but the kmalloc blocks are only
`alignas(void*)`.
2021-07-16 20:51:13 +02:00
Timothy Flynn
860417fb4f LibJS: Ensure RegExpStringIterator keeps the RegExp matcher object alive
Fixes a crash found with 'test-js -g' due to this object going out of
scope.
2021-07-16 20:44:48 +02:00
Wesley Moret
1b8f73b6b3 LibPDF: Fix treating not finding the linearized dict as a fatal error
We now try to parse the first indirect value and see 
if it's the `Linearization Parameter Dictionary`. if it's not, we 
fallback to reading the xref table from the end of the document
2021-07-16 20:44:10 +02:00
Wesley Moret
5d4d70355e LibPDF: Fix checking minor_ver instead of major_ver 2021-07-16 20:44:10 +02:00
LuK1337
b94931e7f6 ThemeEditor: Set window size to 480x385 and disable resizing 2021-07-16 20:43:04 +02:00
LuK1337
12f0602379 ThemeEditor: Add menu bar with quit and about items 2021-07-16 20:43:04 +02:00
Tom
704e1c2e3d Kernel: Rename functions to be less confusing
Thread::yield_and_release_relock_big_lock releases the big lock, yields
and then relocks the big lock.

Thread::yield_assuming_not_holding_big_lock yields assuming the big
lock is not being held.
2021-07-16 20:30:04 +02:00
Tom
0536a4ff41 Kernel: Release big lock when blocking on another lock
When blocking on a Lock other than the big lock and we're holding the
big lock, we need to release the big lock first. This fixes some
deadlocks where a thread blocks while holding the big lock, preventing
other threads from getting the big lock in order to unblock the waiting
thread.
2021-07-16 20:30:04 +02:00
Tom
710cf14c55 Kernel: Fix some Lock problems and VERIFY statements
When a Lock blocks (e.g. due to a mode mismatch or because someone
else holds it) the lock mode will be updated to what was requested.

There were also some cases where restoring locks may have not worked
as intended as it may have been held already by the same thread.

Fixes #8787
2021-07-16 20:30:04 +02:00
Gunnar Beutner
22a588d394 Kernel: Make the page table for the kernel image larger
Building the x86_64 kernel with ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS
results in an image that is larger than 0x2000000 bytes.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
a17c25e45e Kernel: Make resizing the page tables for the kernel image easier
By using the KERNEL_PD_OFFSET constant we can avoid some of the
hard-coded values in the boot code.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
cbdb488578 Kernel: Move end_of_kernel_image after the .ksyms section
Without this we won't be able to detect whether .ksyms overlaps the end
of the page table we set up for the kernel image.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
acf8f2a2a3 Kernel: Support specifying a 64-bit KERNEL_BASE address
The kernel doesn't currently boot when using an address other than
0xc0000000 because the page tables aren't set up properly for that
but this at least lets us build the kernel.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
9b431cbe42 Kernel: Avoid unnecessary jump in the boot code
The 32-bit boot code jumps to 0xc0000000 + entry address once page
tables are set up. This is unnecessary for 64-bit mode because we'll
do another far jump just moments later.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
eb1935b62e Kernel: Avoid hard-coding kernel virtual base 2021-07-16 18:50:59 +02:00
Liav A
9e36158ece Kernel: Remove stale forward declaration of BochsFramebufferDevice 2021-07-16 18:50:16 +02:00
Idan Horowitz
8d01d43f5e LibJS: Replace the boolean argument of Object::set with an enum class
This is more serenity-esque and also makes pointing out missing
exception checks during reviews much easier.
2021-07-16 17:50:01 +01:00
Idan Horowitz
4b39e718b3 LibJS: Remove unused Object::PutOwnPropertyMode enum class
All usages of this enum class were removed in the Object rewrite, but
this enum was left behind.
2021-07-16 17:50:01 +01:00
Andreas Kling
3108aa0a6b Kernel: Fix bogus check in Thread::WaitBlockCondition::finalize()
I botched this in 859e5741ff, the check
was supposed to be with Process::is_kernel_process().

This fixes an issue with zombie processes hanging around forever.
Thanks tomuta for spotting it! :^)
2021-07-16 15:18:47 +02:00
Timothy Flynn
4812b95795 LibJS: Implement RegExp AdvanceStringIndex abstraction
This isn't particularly useful yet because the underlying LibRegex
engine doesn't support unicode matching yet. But the debt of FIXMEs
related to AdvanceStringIndex have added up, so let's get this out of
the way.
2021-07-16 13:53:11 +01:00
Timothy Flynn
5135f4000c LibJS: Implement RegExp.prototype [ @@matchAll ]
This also allows String.prototype.matchAll to work, as all calls to that
method result in an invocation to @@matchAll.
2021-07-16 13:53:11 +01:00
Timothy Flynn
cfddcad7cf LibJS: Implement the RegExpStringIterator object
This implementation closely follows the StringIterator object in that
the abstract closure meant to be created in CreateRegExpStringIterator
is instead unrolled into RegExpStringIterator.prototype.next.
2021-07-16 13:53:11 +01:00
Timothy Flynn
6cf64d0f09 LibJS: Make the RegExpExec abstraction publically available
For RegExpStringIterator, this will be needed outside of the RegExp
prototype.
2021-07-16 13:53:11 +01:00
Gunnar Beutner
c7265ee6bd Assistant: Keep the Terminal window open after the command has run 2021-07-16 13:05:55 +02:00
ry-sev
2634cab7a8 HackStudio: Add statusbar with file and selected text information 2021-07-16 12:58:20 +02:00
Max Wipfli
e22a34badb LibWeb: Fix assertion failures in HTMLTokenizer
The *TagName states are all very similar, so it seems to be correct to
apply the fix from #8761 to all of those states.

This fixes #8788.
2021-07-16 11:55:55 +02:00
Peter Bindels
ca9c53c1a8
LibELF/DynamicLinker: Evaluate symbols in library insertion order (#8802)
When loading libraries, it is required that each library uses the same
instance of each symbol, and that they use the one from the executable
if any. This is barely noticeable if done incorrectly; except that it
completely breaks RTTI on Clang. This switches the hash map to be
ordered; tested to work for Clang by @Bertaland
2021-07-16 11:55:01 +02:00
Timothy
5f3e6085a2 AK/Tests: Add test for EnumBits has_any_flag()
This test will pass when any flag in the mask is present in the value.
2021-07-16 11:49:50 +02:00
Timothy
9715311837 AK+Kernel: Implement and use EnumBits has_any_flag()
This duplicates the old functionality of has_flag and will return true
when any flags present in the mask are also in the value.
2021-07-16 11:49:50 +02:00
Timothy
371911b1b5 AK/Tests: Add test for EnumBits has_flag()
This test requires that all values in the mask are present in the value
as well.
2021-07-16 11:49:50 +02:00
Timothy
03b76e4ba0 AK: Change EnumBits has_flag() to check all flags in mask are present
Co-authored-by: Brian Gianforcaro <b.gianfo@gmail.com>
2021-07-16 11:49:50 +02:00
Luke
2df4d977e2 Kernel: Return ENOMEM on allocation failures in FramebufferDevice::mmap 2021-07-16 11:15:30 +02:00
Andreas Kling
41c0009f6d Kernel/Ext2FS: Don't hog inode lock in traverse_as_directory()
Reimplement directory traversal in terms of read_bytes() instead of
doing direct block access. This lets us avoid taking the inode lock
while iterating over the directory contents.
2021-07-16 02:40:53 +02:00
Andreas Kling
abbd237ec1 Kernel/Ext2FS: Don't hog FS lock when calling base class flush_writes()
Once we've finalized all the file system metadata in flush_writes(),
we no longer need to hold the file system lock during the call to
BlockBasedFileSystem::flush_writes().
2021-07-16 02:40:53 +02:00
Andreas Kling
98c230b370 Kernel/Ext2FS: Uncache unknown inode indices when flushing writes
Ext2FS::get_inode() will remember unknown inode indices that it has
been asked about and put them into the inode cache as null inodes.

flush_writes() was not null-checking these while iterating, which
was a bug I finally managed to hit.

Flushing also seemed like a good time to drop unknown inodes from
the cache, since there's no good reason to hold to them indefinitely.
2021-07-16 02:40:53 +02:00
Andreas Kling
a7d193951f Kernel: Don't hog file system lock when doing BlockBasedFileSystem I/O
The file system lock is meant to protect the file system metadata
(super blocks, bitmaps, etc.) Not protect processes from reading
independent parts of the disk at once.

This patch introduces a new lock to protect the *block cache* instead,
which is the real thing that needs synchronization.
2021-07-16 02:40:53 +02:00
Andreas Kling
abf0249f35 Kernel: Don't explicitly seek before I/O in BlockBasedFileSystem
Use the new FileDescription APIs to avoid doing seek+read or seek+write
as two separate operations.
2021-07-16 02:40:53 +02:00