Commit Graph

40204 Commits

Author SHA1 Message Date
Andreas Kling
75348bdfd3 Kernel: Don't require MM lock for Region::set_page_directory()
The MM lock is not required for this, it's just a simple ref-counted
pointer assignment.
2022-08-18 18:52:34 +02:00
Andreas Kling
abb84b9fcd Kernel: Fix inconsistent lock acquisition order in kmalloc
We always want to grab the page directory lock before the MM lock.
This fixes a deadlock I encountered when building DOOM with make -j4.
2022-08-18 18:52:34 +02:00
Andreas Kling
27c1135d30 Kernel: Don't remap all regions from Region::remap_vmobject_page()
When handling a page fault, we only need to remap the faulting region in
the current process. There's no need to traverse *all* regions that map
the same VMObject and remap them cross-process as well.

Those other regions will get remapped lazily by their own page fault
handlers eventually. Or maybe they won't and we avoided some work. :^)
2022-08-18 18:52:34 +02:00
Andreas Kling
45e6123de8 Kernel: Shorten time under spinlocks while handling inode faults
- Instead of holding the VMObject lock across physical page allocation
  and quick-map + copy, we now only hold it when updating the VMObject's
  physical page slot.
2022-08-18 18:52:34 +02:00
Thomas Symalla
03e9697975 TextEditor: Change cursor when reaching the ruler area
Noticed that mouse-overing the ruler area in the TextEditor
does not change the cursor to the default cursor, instead, the
beam cursor is used, which does not look nice.

This PR extends the mousemove event and introduces a new
set_editing_cursor() function that takes care of setting the
cursor for the editor area.
2022-08-18 15:59:53 +02:00
Timothy Flynn
299cebbbcb FileManager: Do not activate "Show Dotfiles" action on every startup
Commit 75d1840cf detects if the initial path provided to the FileManager
contains a dotfile, and if so, forces the FileManager to show dotfiles.
However, it does this by activating the "Show Dotfiles" action. This has
the side effect of always setting and persisting the configuration,
overriding whatever the user's preference was.

Instead, only transiently update the view to show dotfiles if the path
contains a dotfile.
2022-08-18 15:58:41 +02:00
MacDue
d26203ff90 Base: Add some repeating-linear-gradient() examples 2022-08-18 15:58:05 +02:00
MacDue
e294b7929a LibWeb: Support painting repeating-linear-gradient()s 2022-08-18 15:58:05 +02:00
MacDue
ffdcc60b03 LibWeb: Avoid NaNs from zero-length gradient color stops 2022-08-18 15:58:05 +02:00
MacDue
f9a685437f LibWeb: Parse repeating-linear-gradient()
Including `-webkit-repeating-linear-gradient()`
2022-08-18 15:58:05 +02:00
Ryan Liptak
b123309b0d LibGfx: Skip useless iterations during PNG::FilterType::Sub unfiltering 2022-08-18 11:12:59 +01:00
Ryan Liptak
b19f3b5106 LibGfx: Unfilter PNG data before unpacking it to RGBA
The order of PNG compression is raw pixel data -> filter -> compress.
For decompression, the order is reversed, so that means uncompress ->
unfilter -> raw pixel data. Previously, the PNG decoder was converting
to raw pixel data before unfiltering, which was a problem when using
indexed color palettes, since each pixel's palette index could change
during unfiltering (e.g. it was unfiltering after already choosing
the color from the palette index). This was leading to 'Palette index
out of range' errors on files that both:

- Had scanlines with some sort of filtering
- Didn't use the full range of possible palette indices for their bit
  depth.

Also, because filtering now happens before converting to pixel data,
filtering acts on bytes instead of pixels, meaning that the
implementation of each filter type now maps much more directly to
the specification:

http://www.libpng.org/pub/png/spec/1.2/PNG-Filters.html
2022-08-18 11:12:59 +01:00
djwisdom
77a135491e Base: Add new globe emojis U+1F30D-U+1F30F
🌍 - U+1F30D GLOBE SHOWING EUROPE-AFRICA
🌎 - U+1F30E GLOBE SHOWING AMERICAS
🌏 - U+1F30F GLOBE SHOWING ASIA-AUSTRALIA

Coverage: https://emoji.serenityos.net
2022-08-18 09:59:06 +01:00
kleines Filmröllchen
c0079cf963 LibCore: Make EventLoop's connection to InspectorServer work again
This path was changed to the uid templated version without actually
using the template resolver function in Account.
2022-08-17 16:40:42 -07:00
Andreas Kling
04c362b4dd Kernel: Fix TOCTOU in sys$unveil()
Make sure we reject the unveil attempt with EPERM if the veil was locked
by another thread while we were parsing argument (and not holding the
veil state spinlock.)

Thanks Brian for spotting this! :^)

Amendment to #14907.
2022-08-18 01:04:28 +02:00
Andreas Kling
ae3fa20252 Kernel/x86: Don't re-enable interrupts too soon when unlocking spinlocks
To ensure that we stay on the same CPU that acquired the spinlock until
we're completely unlocked, we now leave the critical section *before*
re-enabling interrupts.
2022-08-18 00:58:34 +02:00
Andreas Kling
cb04caa18e Kernel: Protect the Custody cache with a spinlock
Protecting it with a mutex meant that anyone unref()'ing a Custody
might need to block on said mutex.
2022-08-18 00:58:34 +02:00
Andreas Kling
17de393253 Kernel: Remove outdated FIXME in Custody.h 2022-08-18 00:58:34 +02:00
Andreas Kling
ec330c2ce6 Kernel: Use consistent lock acquisition order in Thread::block*()
We want to grab g_scheduler_lock *before* Thread::m_block_lock.
This appears to have fixed a deadlock that I encountered while building
DOOM with make -j2.
2022-08-18 00:58:34 +02:00
Andreas Kling
ae8558dd5c Kernel: Don't do path resolution in sys$chdir() while holding spinlock
Path resolution may do blocking I/O so we must not do it while holding
a spinlock. There are tons of problems like this throughout the kernel
and we need to find and fix all of them.
2022-08-18 00:58:34 +02:00
Andreas Kling
51bc87d15a Kernel/x86: Disable interrupts when leaving critical sections
This fixes an issue where we could get preempted after acquiring the
current Processor pointer, but before calling methods on it.

I strongly suspect this was the cause of "Processor::current() == this"
assertion failures.
2022-08-18 00:58:34 +02:00
Andreas Kling
cd348918f9 Kernel/x86: Move Processor::{leave,clear}_critical() out of line
I don't think this code needs to be ALWAYS_INLINE, and moving it out
of line will make backtraces nicer.
2022-08-18 00:58:34 +02:00
davidot
28e552f853 LibJS: Resolve the correct this value for calls in with statements 2022-08-17 23:56:24 +01:00
davidot
3a8dd3e78d LibJS: Implement tagged literals evaluation like the spec
We cache on the AST node side as this is easier to track a position, we
just have to take care to wrap the values in a handle to make sure they
are not garbage collected.
2022-08-17 23:56:24 +01:00
davidot
e5adc51e27 LibJS: Allow invalid string in tagged template literals
Since tagged template literals can inspect the raw string it is not a
syntax error to have invalid escapes. However the cooked value should be
`undefined`.
We accomplish this by tracking whether parse_string_literal
fails and then using a NullLiteral (since UndefinedLiteral is not a
thing) and finally converting null in tagged template execution to
undefined.
2022-08-17 23:56:24 +01:00
davidot
0f9434a02c LibJS: Make StringToNumber case sensitive when falling back to strtod
We use strtod to convert a string to number after checking whether the
string is [+-]Infinity, however strtod also checks for either 'inf' or
'infinity' in a case-insensitive.
There are still valid cases for strtod to return infinity like 10e100000
so we just check if the "number" contains 'i' or 'I' in which case
the strtod infinity is not valid.
2022-08-17 23:56:24 +01:00
davidot
9d05ca7b20 LibJS: Don't assume a this argument for function.prototype.bind
Assuming we had at least one argument meant that the ...arg count would
underflow causing the bound function to have length 0 instead of the
given length when binding with no arguments.
2022-08-17 23:56:24 +01:00
davidot
c4f3d44be1 LibJS: Add the HostEnsureCanAddPrivateElement hook
This hook allows us to reject private elements on certain exotic
objects like the window object in browser.
Note that per the spec we should only call this hook if the host is a
web browser, however because LibJS has no way of knowing whether it is
in a web browser environment we just always call the host hook.
2022-08-17 23:56:24 +01:00
Samuel Bowman
b5a2f59320 Kernel: Make sys$unveil() not take the big process lock
The unveil syscall uses the UnveilData struct which is already
SpinlockProtected, so there is no need to take the big lock.
2022-08-18 00:04:31 +02:00
Linus Groh
146903a3b5 Kernel: Require semicolon after VERIFY_{NO_,}PROCESS_BIG_LOCK_ACQUIRED
This matches out general macro use, and specifically other verification
macros like VERIFY(), VERIFY_NOT_REACHED(), VERIFY_INTERRUPTS_ENABLED(),
and VERIFY_INTERRUPTS_DISABLED().
2022-08-17 22:56:51 +02:00
Brian Gianforcaro
0db5f62f57 Meta: Upgrade to the lastest version of the SonarScanner CLI 2022-08-17 11:54:59 -07:00
Timon Kruiper
a4dadaeb00 Meta: Disallow running with QEMU >= 7.x on aarch64 build
This is currently broken upstream, and our aarch64 Kernel only runs with
QEMU 6.x.
2022-08-17 15:44:38 +01:00
Timon Kruiper
408e2f607a Toolchain: Allow setting QEMU_{VERSION, MD5SUM} from command line
This can be used to download and build a specific QEMU version.
2022-08-17 15:44:38 +01:00
Timothy Flynn
ca92e37ae0 LibUnicode: Generate code point display names with run-length encoding
Similar to commit becec35, our code point display name data was a large
list of StringViews. RLE can be used here as well to remove about 32 MB
from the initialized data section to the read-only section.

Some of the refactoring to store strings as indices into an RLE array
also lets us clean up some of the code point name generators.
2022-08-17 15:42:12 +01:00
Timothy Flynn
2c2ede8581 LibUnicode: Mark UniqueStringStorage::generate as constant
This is just to allow it to be invoked from callers who hold a constant
UniqueStringStorage instance.
2022-08-17 15:42:12 +01:00
Xexxa
d3621ac177 Base: Add more emoji
 - U+2693 ANCHOR
⛓️ - U+26D3 CHAINS
⛰️ - U+26F0 MOUNTAIN
⛱️ - U+26F1 UMBRELLA ON GROUND
🇩🇯 - U+1F1E9 U+1F1EF DJ DJIBOUTI
🌋 - U+1F30B VOLCANO
🌵 - U+1F335 CACTUS
🍹 - U+1F379 TROPICAL DRINK
🎹 - U+1F3B9 MUSICAL KEYBOARD
🏔️ - U+1F3D4 SNOW-CAPPED MOUNTAIN
🐙 - U+1F419 OCTOPUS
💌 - U+1F48C LOVE LETTER
📺 - U+1F4FA TELEVISION
📻 - U+1F4FB RADIO
🕳️ - U+1F573 HOLE
🕶️ - U+1F576 SUNGLASSES
🪀 - U+1FA80 YO-YO
🪢 - U+1FAA2 KNOT
🪤 - U+1FAA4 MOUSE TRAP
🛖 - U+1F6D6 HUT
🛠️ - U+1F6E0 HAMMER AND WRENCH
📷 - U+1F4F7 CAMERA
📸 - U+1F4F8 CAMERA WITH FLASH
🇨🇬 - U+1F1E8 U+1F1EC CG Congo - Brazzaville
🇪🇦 - U+1F1EA U+1F1E6 EA Ceuta & Melilla
🇪🇭 - U+1F1EA U+1F1ED EH Western Sahara
🇬🇫 - U+1F1EC U+1F1EB GF French Guiana
🇬🇬 - U+1F1EC U+1F1EC GG Guernsey
🇬🇹 - U+1F1EC U+1F1F9 GT Guatemala
🇯🇴 - U+1F1EF U+1F1F4 JO Jordan
🇳🇫 - U+1F1F3 U+1F1EB NF Norfolk Island
2022-08-17 14:06:03 +01:00
Xexxa
cf6a564be9 Base: Replace emoji U+1F47D.png with U+1F470.png, remove U+1F470.png 2022-08-17 14:06:03 +01:00
Xexxa
54b98d9841 Base: Adjust transparency for emoji U+1F1EA_U+1F1EC.png 2022-08-17 14:06:03 +01:00
Ryan Liptak
2ea61185e7 Base: Add 6 new emojis
✌️ - U+270C U+FE0F VICTORY HAND
👌 - U+1F44C OK HAND
💀 - U+1F480 SKULL
📈 - U+1F4C8 CHART INCREASING
📉 - U+1F4C9 CHART DECREASING
🫶 - U+1FAF6 HEART HANDS
2022-08-17 11:29:01 +01:00
djwisdom
ac6fb84082 Base: Add new emojis U+1F311-U+1F31A U+1F31D
🌑 - U+1F311 NEW MOON
🌒 - U+1F312 WAXING CRESCENT MOON
🌓 - U+1F313 FIRST QUARTER MOON
🌔 - U+1F314 WAXING GIBBOUS MOON
🌕 - U+1F315 FULL MOON
🌖 - U+1F316 WANING GIBBOUS MOON
🌗 - U+1F317 LAST QUARTER MOON
🌘 - U+1F318 WANING CRESCENT MOON
🌙 - U+1F319 CRESCENT MOON
🌚 - U+1F31A NEW MOON FACE
🌝 - U+1F31D FULL MOON FACE

Coverage: https://emoji.serenityos.net
2022-08-17 11:09:43 +01:00
Ryan Liptak
64543c3667 Base: Add 16 new hand emojis
✍️ - U+270D U+FE0F WRITING HAND
👆 - U+1F446 BACKHAND INDEX POINTING UP
👇 - U+1F447 BACKHAND INDEX POINTING DOWN
👈 - U+1F448 BACKHAND INDEX POINTING LEFT
👉 - U+1F449 BACKHAND INDEX POINTING RIGHT
👋 - U+1F44B WAVING HAND
👏 - U+1F44F CLAPPING HANDS
🖐️ - U+1F590 HAND WITH FINGERS SPLAYED
🤏 - U+1F90F PINCHING HAND
🤙 - U+1F919 CALL ME HAND
🤚 - U+1F91A RAISED BACK OF HAND
🤝 - U+1F91D HANDSHAKE
🫱 - U+1FAF1 RIGHTWARDS HAND
🫲 - U+1FAF2 LEFTWARDS HAND
🫳 - U+1FAF3 PALM DOWN HAND
🫴 - U+1FAF4 PALM UP HAND
2022-08-17 09:02:13 +01:00
Ryan Liptak
b89cd4215e Base: Add 10 new emojis
☹️ - U+2639 U+FE0F FROWNING FACE
☺️ - U+263A U+FE0F SMILING FACE
🤡 - U+1F921 CLOWN FACE
🥹 - U+1F979 FACE HOLDING BACK TEARS
🫠 - U+1FAE0 MELTING FACE
🫡 - U+1FAE1 SALUTING FACE
🫢 - U+1FAE2 FACE WITH OPEN EYES AND HAND OVER MOUTH
🫣 - U+1FAE3 FACE WITH PEEKING EYE
🫤 - U+1FAE4 FACE WITH DIAGONAL MOUTH
🫥 - U+1FAE5 DOTTED LINE FACE
2022-08-16 23:09:49 +01:00
Ryan Liptak
2eda84c56e Base: Update tongue color of emoji U+1F923 to match others 2022-08-16 23:09:49 +01:00
Ryan Liptak
20157848ca Base: Add 2 new cat face emojis
😸 - U+1F638 GRINNING CAT WITH SMILING EYES
😾 - U+1F63E POUTING CAT FACE
2022-08-16 23:09:49 +01:00
Ryan Liptak
80f33932c5 Base: Fix codepoint of CRYING CAT FACE
This was mistakenly using the codepoint of POUTING CAT FACE
2022-08-16 23:09:49 +01:00
Andreas Kling
ce6e93d96b Kernel: Make sys$socketpair() not take the big lock
This system call mainly accesses the file descriptor table, and this is
already guarded by MutexProtected.
2022-08-16 20:43:23 +02:00
Andreas Kling
164c9617c3 Kernel: Only lock file descriptor table once in sys$pipe()
Instead of locking it twice, we now frontload all the work that doesn't
touch the fd table, and then only lock it towards the end of the
syscall.

The benefit here is simplicity. The downside is that we do a bit of
unnecessary work in the EMFILE error case, but we don't need to optimize
that case anyway.
2022-08-16 20:39:45 +02:00
Andreas Kling
b6d0636656 Kernel: Don't leak file descriptors in sys$pipe()
If the final copy_to_user() call fails when writing the file descriptors
to the output array, we have to make sure the file descriptors don't
remain in the process file descriptor table. Otherwise they are
basically leaked, as userspace is not aware of them.

This matches the behavior of our sys$socketpair() implementation.
2022-08-16 20:35:32 +02:00
Andreas Kling
307932857e Kernel: Make sys$pipe() not take the big lock
This system call mainly accesses the file descriptor table, and this is
already guarded by MutexProtected.
2022-08-16 20:20:11 +02:00
Andreas Kling
0b58fd5aef Kernel: Remove unnecessary TOCTOU bug in sys$pipe()
We don't need to explicitly check for EMFILE conditions before doing
anything in sys$pipe(). The fd allocation code will take care of it
for us anyway.
2022-08-16 20:16:17 +02:00