Commit graph

40289 commits

Author SHA1 Message Date
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
David Smith
2a386c0b50 LibGUI: Don't let widgets hide tooltips they didn't show
Widget::handle_leave_event() hides the tooltip if one is shown. That's
usually fine and hides the widget's tooltip, but it can happen that
another widget managed to show a tooltip after the Leave event was
triggered and before it's processed.

Thus change handle_leave_event() to only hide the tooltip if it was show
by the widget.

Fixes the case where this could happen in the flame graph in Profiler
when moving the mouse over the tooltip window itself #14852.
2022-08-16 16:56:43 +02:00
Timothy Flynn
becec3578f LibTimeZone+LibUnicode: Generate string data with run-length encoding
Currently, the unique string lists are stored in the initialized data
sections of their shared libraries. In order to move the data to the
read-only section, generate the strings using RLE arrays.

We generate two arrays: the first is the RLE data itself, the second is
a list of indices into the RLE array for each string. We then generate a
decoding method to convert an RLE string to a StringView.
2022-08-16 16:56:17 +02:00
Mike Akers
de980de0e4 Kernel: Lock the inode before writing in SharedInodeVMObject::sync
We ensure that when we call SharedInodeVMObject::sync we lock the inode
lock before calling Inode virtual write_bytes method directly to avoid
assertion on the unlocked inode lock, as it was regressed recently. This
is not a complete fix as the need to lock from each path before calling
the write_bytes method should be avoided because it can lead to
hard-to-find bugs, and this commit only fixes the problem temporarily.
2022-08-16 16:54:03 +02:00
David Smith
0b9d83fe0d Profiler: Fix unmovable splitter
Set preferred height instead of fixed height to allow the splitter to
move.

The splitter respects set_fixed_height() after a808cfa7 "LibGUI+
Applications: Govern Splitter resizing by opportunistic growth", and
that caused the splitter in Profiler to stop working.
2022-08-16 16:53:24 +02:00
thankyouverycool
a74f512f6b LibGUI+WindowServer+DisplaySettings: Add Tooltips to SystemEffects
Tooltips can now be toggled on and off system-wide.
2022-08-16 16:53:00 +02:00
thankyouverycool
d286bf85e6 WindowServer: Remove unused header in SystemEffects 2022-08-16 16:53:00 +02:00
thankyouverycool
63b8d04100 WindowServer: Walk the open menu stack in reverse on MouseMove events
Fixes lower level menus stealing focus from higher submenus.
2022-08-16 16:52:09 +02:00
thankyouverycool
e87eb97e68 WindowServer: Do not pop-up submenus directly atop their ancestors
Previously submenus would pop-up on their immediate open ancestors in
cases of limited screen real estate. If the submenu was sufficiently
large, this could make it difficult to navigate back down the menu
stack. Now submenus display on either side of their ancestors, making
it easy to zig-zag up and down menu stacks. This is similar to how
menus operate in many other DEs.
2022-08-16 16:52:09 +02:00
thankyouverycool
4489f9dbef WindowServer: Add MenuManager helper to find closest open ancestor 2022-08-16 16:52:09 +02:00
thankyouverycool
db852548ce WindowServer: Force cursor invalidation when composing immediately
And invalidate the cursor before creating a new drag-and-drop
overlay. Fixes dnd overlay bitmaps failing to draw at the correct
location immedately after changing cursors.
2022-08-16 16:43:27 +02:00
thankyouverycool
9bcd7dc0ce WindowServer: Don't start a drag and drop unless holding Primary mouse
Adds a member to record the last processed mouse buttons. If they
do not include MouseButton::Primary, return early before creating
a new drag and drop client. This fixes race conditions in which
MouseUp events canceling or completing a drop could be swallowed
by Overlay creation or postponed by an executing DragOperation,
leaving the operation in limbo.
2022-08-16 16:43:27 +02:00
thankyouverycool
db058a22ae LibGUI: Put DragOperation dbgln() behind DRAG_DEBUG 2022-08-16 16:43:27 +02:00
thankyouverycool
7c1995993f WindowServer: Use correct config group for workspace settings
WindowServer.ini already contained the correct pluralized group by
default, but was left unused by a typo.
2022-08-16 16:41:47 +02:00
thankyouverycool
71a437b512 DisplaySettings: Update Workspaces tab GML
Removes some verbiage and arranges things consistent with other
settings dialogs.

Ideally we shouldn't litter UIs with shortcuts, tips, tricks,
self-evident or redundant descriptions, etc, so this can be
refined again in the future once there's an official way to expose/
customize keyboard shortcuts.
2022-08-16 16:41:47 +02:00
thankyouverycool
2d706ba753 Base: Add 32x32 workspaces settings icon 2022-08-16 16:41:47 +02:00