Commit graph

24658 commits

Author SHA1 Message Date
Brian Gianforcaro
de9ff0af50 Kernel: Modify the IOCTL API to return KResult
The kernel has been gradually moving towards KResult from just bare
int's, this change migrates the IOCTL paths.
2021-07-27 01:23:37 +04:30
Brian Gianforcaro
46c9b1d81c Kernel+LibC: Use argument for TIOCGPGRP ioctl value
In preparation for modifying the Kernel IOCTL API to return KResult
instead of int, we need to fix this ioctl to an argument to receive
it's return value, instead of using the actual function return value.
2021-07-27 01:23:37 +04:30
Brian Gianforcaro
9a04f53a0f Kernel: Utilize AK::Userspace<T> in the ioctl interface
It's easy to forget the responsibility of validating and safely copying
kernel parameters in code that is far away from syscalls. ioctl's are
one such example, and bugs there are just as dangerous as at the root
syscall level.

To avoid this case, utilize the AK::Userspace<T> template in the ioctl
kernel interface so that implementors have no choice but to properly
validate and copy ioctl pointer arguments.
2021-07-27 01:23:37 +04:30
Brian Gianforcaro
0bb3d83a48 AK: Add copy_to span method for AK::MACAddress 2021-07-27 01:23:37 +04:30
Tom
1a664d80f9 Mail: Prompt for password if no password was saved
This allows the user to create a mail configuration without having
to save the password in clear text (or any other form) to disk.
2021-07-26 21:55:18 +04:30
Tom
81c183e06a LibGUI: Add InputType enum to allow creating a password InputBox dialog 2021-07-26 21:55:18 +04:30
Tobias Christiansen
5745e8e18c LibWeb: Add blurring support to box-shadow
Now the box-shadow-rendering is done by using the new
Gfx::FastBoxBlurFilter. :^)
2021-07-26 17:54:19 +01:00
Tobias Christiansen
d1844e424d LibGfx: Add FastBoxBlurFilter
This patch adds a FastBoxBlurFilter to the system. It can be created by
specifying a Bitmap it will work on.
There are two uses implemented:
- apply_single_pass() applys an implementation of a linear-time
box-blur algorithm with the specified radius using a horizontal and a
vertical pass and utilizinga sliding window.
- apply_three_passes() gets a better Gaussian approximation by applying
  the filter three times. For this to work the radius of each pass is
  calculated to fit Gauss the best.
2021-07-26 17:54:19 +01:00
sin-ack
48d4062b47 NotificationServer: Expand the notification when hovered
Now, instead of showing a tooltip, the entire notification will be
shown when the user hovers over a notification. In the future, limiting
the amount of lines shown within the notification and moving extra lines
to the tooltip again might be a good idea.
2021-07-26 21:14:39 +04:30
sin-ack
e11940fd01 Userland: Move text wrapping/elision into the new TextLayout :^)
This class now contains all the fun bits about laying out text in a
rect. It will handle line wrapping at a certain width, cutting off lines
that don't fit the given rect, and handling text elision.
Painter::draw_text now internally uses this.

Future work here would be not laying out text twice (once actually
preparing the lines to be rendered and once to get the bounding box),
and possibly adding left elision if necessary.

Additionally, this commit makes the Utf32View versions of
Painter::draw_text convert to Utf8View internally. The intention is to
completely remove those versions, but they're kept at the moment to keep
the scope of this PR small.
2021-07-26 21:14:39 +04:30
sin-ack
a5a32fbcce LibGUI: Ignore the Enter event by default
If this is not ignored by default, then one can move the mouse fast
enough to skip hovering over a parent element and hover directly over
the child, causing the parent to never receive an Enter event.
2021-07-26 21:14:39 +04:30
sin-ack
cfc9ee6f16 LibGUI: Only dispatch Leave if the now-hovered widget isn't a child
Without this change, when the mouse starts hovering over a child widget,
the parent would receive a Leave event despite the parent widget not
losing mouse hover.
2021-07-26 21:14:39 +04:30
sin-ack
444ed56521 LibGUI: Add virtual handlers for WindowEntered and WindowLeft events
These can be useful if an application wants to react to the cursor
entering the window at any point, rather than just on a widget.
2021-07-26 21:14:39 +04:30
sin-ack
6162e78c7f LibGUI: Let GUI applications create an inspectable EventLoop
GUI applications automatically have EventLoops created for them via
GUI::Application; however before this commit it was not possible to make
the application event loop inspectable. This exposes a third optional
argument to GUI::Application which allows one to make the application
event loop inspectable.
2021-07-26 21:14:39 +04:30
Timothy Flynn
2e3a5b884c LibJS: Implement Unicode aware String.prototype.to{Upper,Lower}Case 2021-07-26 17:03:55 +01:00
Timothy Flynn
98d8274040 Meta: Add LibUnicode (and its tests) to Lagom
This is primarily to allow using LibUnicode within LibJS and its REPL.

Note: this seems to be the first time that a Lagom dependency requires
generated source files. For this to work, some of Lagom's CMakeLists.txt
commands needed to be re-organized to include the CMake files that fetch
and parse UnicodeData.txt. The paths required to invoke the generator
also differ depending on what is currently building (SerenityOS vs.
Lagom as part of the Serenity build vs. a standalone Lagom build).
2021-07-26 17:03:55 +01:00
Timothy Flynn
4dda3edc9e LibUnicode: Introduce a Unicode library for interacting with UCD files
The Unicode standard publishes the Unicode Character Database (UCD) with
information about every code point, such as each code point's upper case
mapping. LibUnicode exists to download and parse UCD files at build time
and to provide accessors to that data.

As a start, LibUnicode includes upper- and lower-case code point
converters.
2021-07-26 17:03:55 +01:00
Patrick Meyer
83f88df757 Kernel: Add option to build with coverage instrumentation and KCOV
GCC and Clang allow us to inject a call to a function named
__sanitizer_cov_trace_pc on every edge. This function has to be defined
by us. By noting down the caller in that function we can trace the code
we have encountered during execution. Such information is used by
coverage guided fuzzers like AFL and LibFuzzer to determine if a new
input resulted in a new code path. This makes fuzzing much more
effective.

Additionally this adds a basic KCOV implementation. KCOV is an API that
allows user space to request the kernel to start collecting coverage
information for a given user space thread. Furthermore KCOV then exposes
the collected program counters to user space via a BlockDevice which can
be mmaped from user space.

This work is required to add effective support for fuzzing SerenityOS to
the Syzkaller syscall fuzzer. :^) :^)
2021-07-26 17:40:28 +02:00
Idan Horowitz
67b3255fe8 LibJS: Implement Temporal.PlainDate.from 2021-07-26 16:15:31 +01:00
Idan Horowitz
07485802c6 LibJS: Implement Temporal.PlainDate.compare 2021-07-26 16:15:31 +01:00
Idan Horowitz
2c6bd3a61b LibJS: Use narrower types in Temporal PlainDate/PlainDateTime/Calendar
These are bounds-checked during construction of PlainDate/PlainDateTime
and as such theres no need to widen them in these internal AO calls.
2021-07-26 16:15:31 +01:00
davidot
c5c32ad274 LibWeb: Make functions and attributes in bindings writable
This allows overwriting of for example
EventTarget.prototype.addEventListener as css3test does.
2021-07-26 15:56:15 +01:00
davidot
7a56ca1250 LibJS: Implement a naive String.prototype.localeCompare 2021-07-26 15:56:15 +01:00
davidot
e22539bdd9 LibWeb: Fix that non-member calls to window gave the wrong this_value
We treat all NativeFunctions as strict mode and thus window function
which were called in a global context (i.e. `setTimeout(f, 0)`) got a
null this_value. But we really need to treat all functions not defined
by the ECMAScript specification as non-strict. In most cases this won't
matter however since Window is also the global_object we have an extra
bit of logic.
To fix this more correctly we would need to track the strictness of
NativeFunctions.
2021-07-26 15:56:15 +01:00
davidot
a67f0cbfa2 LibWeb: Make the custom CSSDeclaration methods only work on strings
Otherwise it will try to convert it to a string later anyway. And as far
as I'm aware there are no style properties with just a number or
JavaScript symbol as name.
2021-07-26 15:56:15 +01:00
davidot
e42eaa5d95 LibWeb: Add a CustomHasProperty trait to WrapperGenerator
We immediately use this in CSSStyleDeclaration to fix that "background"
in element.style did not return true.
This is the mechanism used in css3test.com for detecting support of
features.
2021-07-26 15:56:15 +01:00
davidot
0b74cc4712 LibWeb: Convert WrapperGenerator and the generated code to east-const 2021-07-26 15:56:15 +01:00
Jamie Mansfield
3d4abd7154 KeyboardSettings: Prevent minimising the window
This matches how the new MouseSettings application works.
2021-07-26 14:56:49 +02:00
Jamie Mansfield
902559fc2d KeyboardSettings: Prevent resizing the window
This matches the other settings applications.
2021-07-26 14:56:49 +02:00
Jamie Mansfield
3129956c4e DisplaySettings: Prevent minimising the window
This matches how the new MouseSettings application works.
2021-07-26 14:56:49 +02:00
Jamie Mansfield
eb28ca2081 Spider: Improve 32x32 icon
This now matches Andreas' nice 16x16 icon :)
2021-07-26 12:41:01 +02:00
Ali Mohammad Pur
5dc6270b57 Kernel: Remove invalid '#' format modifier for printing a faulting addr
This was mistakenly added in 306d898ee5.
2021-07-26 14:12:09 +04:30
Kenneth Myhra
7a4f59f638 LibC: Declare wide character type functions in wctype.h
Declares all wide character handling functions in wctype.h. All calls
are forwarded to the corresponding character handling function in
ctype.h.

These functions are declared, but not implemented:
- iswctype
- wctype
- towctrans
- wctrans

This should also resolve a build issue with the 'sed' port getting
confused with iswprint being declared twice. Seems like it expected
more functions from wctype.h and then had a backup strategy of adding
its own wctype.h.
2021-07-26 11:36:21 +02:00
Ali Mohammad Pur
eb9c82a487 Kernel: Un-unmap-after-init CommandLine::boot_mode()
This function is now used when the kernel panics, so unmapping it would
make the kernel panic while in panic, which is not a good thing :P
2021-07-26 11:33:14 +02:00
Ali Mohammad Pur
306d898ee5 Kernel: Show the unmapped-after-init symbol being accessed
This makes it a lot easier to figure out what unmapped function is being
accessed, and a lot easier to reason about _why_ it is being accessed.
2021-07-26 11:33:14 +02:00
Brian Gianforcaro
c95ac83367 Base: Mitigations(7) add -fzero-call-used-regs and Process Protection
Update the man page to describe more mitigations that we have applied.
2021-07-26 13:08:37 +04:30
Vinicius
5e87c798d2 TextDocument: Fix indentation duplicating spaces
Auto indentation will consider only leading spaces before the cursor.
Fixes #8973.
2021-07-26 12:56:52 +04:30
Andreas Kling
7d4e3f01dd Taskbar: Unbreak application launchers in the start menu
Application launcher actions reference their applications by an index
into the global `g_apps` table. When skipping over settings apps,
we still have to increment the current app identifier.
2021-07-26 02:57:24 +02:00
Andreas Kling
689e7c28b7 Base: Make DisplaySettings have matching 16x16 and 32x32 icons 2021-07-26 02:03:29 +02:00
Andreas Kling
b6c97a259c Settings: Tweak initial window size 2021-07-26 01:58:07 +02:00
Andreas Kling
4e2c5cd19e Taskbar: Show Settings app instead of Settings app category
The Settings app is basically a viewer for the Settings app category
anyway, so let's just direct users there instead of having the various
settings apps in the start menu.
2021-07-26 01:56:33 +02:00
Andreas Kling
03040f1d10 Base: Improve 32x32 app icons for DisplaySettings and KeyboardSettings 2021-07-26 01:55:25 +02:00
Andreas Kling
1eeea5b4ae MouseSettings: Replace the scroll step size icon 2021-07-26 01:07:37 +02:00
Brian Gianforcaro
f43423edc3 Build: Only specify -fzero-call-used-regs with compiler >= GCC 11.1
This fixes the use case of using clang, or building inside CLion with
an older host compiler.
2021-07-26 01:00:36 +02:00
Linus Groh
7915994dfc LibJS: Use more narrow types in Temporal ISODateTime struct 2021-07-25 23:44:36 +01:00
Linus Groh
96e63415b6 LibJS: Implement Temporal.TimeZone.prototype.getOffsetNanosecondsFor() 2021-07-25 23:44:36 +01:00
Linus Groh
d428787e18 LibJS: Handle PlainDateTime objects in GetTemporalCalendarWithISODefault 2021-07-25 23:44:36 +01:00
Linus Groh
c1005dbb0a LibJS: Handle PlainDateTime objects ToTemporalCalendar 2021-07-25 23:44:36 +01:00
Linus Groh
1c1354db07 LibJS: Store the %Array.prototype.values% intrinsic on the global object
Also group the getter functions for all the additional intrinsics (not
generated via macros), and initialize the members.
2021-07-25 23:44:36 +01:00
Andreas Kling
50472fd69f Kernel: Don't try to return a committed page that we don't have
When we get a COW fault and discover that whoever we were COW'ing
together with has either COW'ed that page on their end (or they have
unmapped/exited) we simplify life for ourselves by clearing the COW
bit and keeping the page we already have. (No need to COW if the page
is not shared!)

The act of doing this does not return a committed page to the pool.
In fact, that committed page we had reserved for this purpose was used
up (allocated) by our COW buddy when they COW'ed the page.

This fixes a kernel panic when running TestLibCMkTemp. :^)
2021-07-26 00:39:10 +02:00