Commit graph

24609 commits

Author SHA1 Message Date
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
Andreas Kling
101486279f Kernel: Clear the COW bits when making an AnonymousVMObject volatile 2021-07-26 00:39:10 +02:00
Andreas Kling
87a22a77e9 Settings: Add a very simple Settings application
This is really just a launcher app that gathers all the installed apps
in the "Settings" category and presents them in a single window.
2021-07-26 00:39:10 +02:00
Andreas Kling
99f57d0a40 Base: Add descriptions to the apps in the Settings category :^) 2021-07-26 00:39:10 +02:00
Andreas Kling
89ab55b44b LibDesktop: Add an optional "Description" field to .af files 2021-07-26 00:39:10 +02:00
Andreas Kling
c17304a8f6 Base: Replace the MouseSettings app icon with something nicer :^) 2021-07-26 00:39:10 +02:00
Andreas Kling
7aed2cfc02 Kernel: Make some debug logging in Scheduler CPU agnostic 2021-07-26 00:39:10 +02:00
Andreas Kling
06104a4227 Kernel: Remove unused Scheduler::yield_from_critical() 2021-07-26 00:39:10 +02:00
Andreas Kling
cfce92f639 Kernel: Fix handful of clang-tidy warnings in Scheduler
All of them "static member accessed through instance".
2021-07-26 00:39:10 +02:00
Ali Mohammad Pur
54c54dabdd Kernel: PANIC() instead of manually halting the processor in abort() 2021-07-26 02:29:25 +04:30
Ali Mohammad Pur
6b606771b5 Kernel: Reset on panic in self-test mode
This makes a kernel panic immediately fail the on-target CI job.
Otherwise the failed job looks like a test timeout unless one digs into
the details of the job.
2021-07-26 02:29:25 +04:30
Ali Mohammad Pur
466e2a2fb7 Meta: Don't reboot on triple-fault in CI mode
Instead, just make QEMU quit immediately.
2021-07-26 02:29:25 +04:30
Andreas Kling
6a537ceef1 Kernel: Remove ContiguousVMObject, let AnonymousVMObject do the job
We don't need an entirely separate VMObject subclass to influence the
location of the physical pages.

Instead, we simply allocate enough physically contiguous memory first,
and then pass it to the AnonymousVMObject constructor that takes a span
of physical pages.
2021-07-25 18:44:47 +02:00
Andreas Kling
9a701eafc4 Kernel: Run clang-format on AnonymousVMObject.cpp 2021-07-25 18:21:59 +02:00
Andreas Kling
fb0c94ae84 WindowServer: Remove debug spam in MenuManager::refresh() 2021-07-25 18:01:24 +02:00
Andreas Kling
1fcb1ec367 LibC: Randomize malloc() block addresses on x86_64
We have a lot of address space here, let's use it. :^)
2021-07-25 18:01:24 +02:00
brapru
bdaaff70cb Utilities: Support static assignment of the ARP table 2021-07-25 17:57:08 +02:00
brapru
7e40c17460 AK: Create MACAddress from string
Previously there was no way to create a MACAddress by passing a direct
address as a string. This will allow programs like the arp utility to
create a MACAddress instance by user-passed addresses.
2021-07-25 17:57:08 +02:00
brapru
8313d35749 Kernel: Support ioctl SIOCSARP and SIOCDARP
Creates ioctl calls necessary to set/delete an entry from the ARP table
2021-07-25 17:57:08 +02:00
brapru
f8c104aaaf Kernel: Add update option to remove an entry from the ARP table
Allows for specifying whether to set/delete an entry from the table.
2021-07-25 17:57:08 +02:00
Karol Kosek
99b32073be LibGUI: Put actions in order in MultiView
Not so important, but it really bothered me..
2021-07-25 17:56:51 +02:00
Karol Kosek
b7b7b8ddf2 LibGUI: Add keyboard shortcuts for changing views in MultiView 2021-07-25 17:56:51 +02:00
Karol Kosek
232f0fb2d3 LibGUI: Add keyboard shortcuts to FilePicker
Taken from FileManager.
2021-07-25 17:56:51 +02:00
Andreas Kling
0d963fd641 Kernel: Remove unnecessary counting of VMObject-attached Regions
VMObject already has an IntrusiveList of all the Regions that map it.
We were keeping a counter in addition to this, and only using it in
a single place to avoid iterating over the list in case it only had
1 entry.

Simplify VMObject by removing this counter and always iterating the
list even if there's only 1 entry. :^)
2021-07-25 17:28:06 +02:00
Andreas Kling
ae3778c303 Kernel: Remove unused enum Region::SetVolatileError 2021-07-25 17:28:06 +02:00
Andreas Kling
4648bcd3d4 Kernel: Remove unnecessary weak pointer from Region to owning Process
This was previously used for a single debug logging statement during
memory purging. There are no remaining users of this weak pointer,
so let's get rid of it.
2021-07-25 17:28:06 +02:00
Andreas Kling
25a5fd870c Kernel: Add missing locking when registering VMObjectDeletedHandlers 2021-07-25 17:28:06 +02:00
Andreas Kling
09bc4cee15 Kernel: Remove unused madvise(MADV_GET_VOLATILE)
This was used to query the volatile state of a memory region, however
nothing ever actually used it.
2021-07-25 17:28:06 +02:00
Andreas Kling
5fb91e2e84 Kernel: Don't COW volatile VM objects
If a purgeable VM object is in the "volatile" state when we're asked
to make a COW clone of it, make life simpler by simply "purging"
the cloned object right away.

This effectively means that a fork()'ed child process will discover
its purgeable+volatile regions to be empty if/when it tries making
them non-volatile.
2021-07-25 17:28:05 +02:00
Andreas Kling
297c0748f0 Kernel: Minor cleanup around purge() during physical page allocation 2021-07-25 17:28:05 +02:00
Andreas Kling
2d1a651e0a Kernel: Make purgeable memory a VMObject level concept (again)
This patch changes the semantics of purgeable memory.

- AnonymousVMObject now has a "purgeable" flag. It can only be set when
  constructing the object. (Previously, all anonymous memory was
  effectively purgeable.)

- AnonymousVMObject now has a "volatile" flag. It covers the entire
  range of physical pages. (Previously, we tracked ranges of volatile
  pages, effectively making it a page-level concept.)

- Non-volatile objects maintain a physical page reservation via the
  committed pages mechanism, to ensure full coverage for page faults.

- When an object is made volatile, it relinquishes any unused committed
  pages immediately. If later made non-volatile again, we then attempt
  to make a new committed pages reservation. If this fails, we return
  ENOMEM to userspace.

mmap() now creates purgeable objects if passed the MAP_PURGEABLE option
together with MAP_ANONYMOUS. anon_create() memory is always purgeable.
2021-07-25 17:28:05 +02:00
Andreas Kling
6bb53d6a80 LibGUI: Handle GUI::Window non-volatile backing store issues better
Instead of crashing when we can't make the back buffer non-volatile,
we now transition the window into single-buffered mode instead
(assuming it was originally in double-buffered mode.)

This reduces GUI fidelity a bit (by potentially making windows flicker
during repaint) but since it's only triggered in low-memory conditions,
it seems like a reasonable thing to sacrifice in order for the system
to carry on.

This patch also stops us from allocating entirely new backing stores
after the old ones were purged. If they were purged but reallocated
just fine, there's no need to allocate new memory again. We already
have fresh zero-filled pages in the existing bitmap at this point.
2021-07-25 14:39:28 +02:00
Andreas Kling
143443e0b6 LibGfx: Make Gfx::Bitmap::set_nonvolatile() report allocation failure
Making a bitmap non-volatile after being volatile may fail to allocate
physical pages after the kernel stole the old pages in a purge.

This is different from the pages being purged, but reallocated. In that
case, they are simply replaced with zero-fill-on-demand pages as if
they were freshly allocated.
2021-07-25 14:39:25 +02:00
Andreas Kling
24b5295b30 LibGfx: Remove "purgeable Gfx::Bitmap" as a separate concept
This was a really weird thing to begin with, purgeable bitmaps were
basically regular bitmaps without a physical memory reservation.

Since all the clients of this code ended up populating the bitmaps
with pixels immediately after allocating them anyway, there was no
need to avoid the reservation.

Instead, all Gfx::Bitmaps are now purgeable, in the sense that they
can be marked as volatile or non-volatile.

The only difference here is that allocation failure is surfaced when
we try to create the bitmap instead of during the handling of a
subsequent page fault.
2021-07-25 14:39:21 +02:00
Andreas Kling
deec79b3c6 LibGfx: Add try_ prefix to Bitmap::try_allocate_backing_store() 2021-07-25 14:11:34 +02:00
Andreas Kling
deff554096 Kernel+LibSystem: Add a 4th syscall argument
Let's allow passing 4 function arguments to a syscall. The 4th argument
goes into ESI or RSI.
2021-07-25 14:08:50 +02:00
TheFightingCatfish
9b78ae5149 LibGUI+Browser: Do not paste bitmaps
This prevents GUI::TextBox and the `Paste & Go` action in the browser
from trying to paste a bitmap. Also, the paste action is enabled
and disabled on clipboard change to reflect if the clipboard data
can be pasted.
2021-07-25 12:36:23 +02:00
brapru
c4eaba6c88 SystemManager: Separate sockets GroupBox into TCP/UDP 2021-07-25 00:33:00 +02:00
brapru
3013ca5fd0 Utilities: Add count option for ping 2021-07-25 00:32:32 +02:00
Linus Groh
028e4bd2ae LibIMAP: Parse (but ignore) OK [HIGHESTMODSEQ <mod-sequence-value>]
Parse it to avoid dbgln() spam, but ignore the value for now. See:
https://datatracker.ietf.org/doc/html/rfc4551#section-3.1.1
2021-07-24 22:22:41 +01:00
Linus Groh
66e47d05c5 LibIMAP: Parse OK [CLOSED]
In my case the mail server responded with the following after selecting
a mailbox (in the Mail application):

    * OK [CLOSED] Previous mailbox closed.
    * FLAGS (\Answered \Flagged ...)
    * OK [PERMANENTFLAGS (\Answered \Flagged ... \*)] Flags permitted.
    * 2 EXISTS
    * 0 RECENT
    * OK [UIDVALIDITY 1234567890] UIDs valid
    * OK [UIDNEXT 12345] Predicted next UID
    * OK [HIGHESTMODSEQ 123456] Highest
    A6 OK [READ-WRITE] Select completed (0.002 secs).

The [CLOSED] part threw the parser off as it was expecting a space after
the atom following the opening bracket, which would actually lead to a
crash of Mail (AK::Optional::value() without value).
2021-07-24 22:22:41 +01:00
Linus Groh
73a9d2ec32 LibIMAP: Replace abuse of String::matches() with == in the parser
matches() is for globs. These are not globs.
2021-07-24 22:22:41 +01:00
Linus Groh
ddd11b98d9 LibIMAP: Add and use Parser::consume_until_end_of_line() 2021-07-24 22:22:41 +01:00
Linus Groh
8e8d1383b7 LibIMAP: Clean up Parser.h a bit
Move members after methods, remove useless parameter names ('x', 's'),
more sensible method grouping.
2021-07-24 22:22:41 +01:00
Linus Groh
8c05b4e137 LibIMAP: Rename IMAP::Parser::{parse => consume}_while()
This isn't parsing anything.
2021-07-24 22:22:41 +01:00
Tobias Christiansen
6502d79240 Base: Add test page for box-shadow 2021-07-24 22:16:48 +02:00
Tobias Christiansen
5471c87246 LibWeb: Add box-shadow rendering
This patch adds the box-shadow rendering to Boxes. We do parse the
blur-radius of a box-shadow but we don't use it for now as the Filter
in the system don't seem quite powerful enough yet to handle that.
2021-07-24 22:16:48 +02:00
Tobias Christiansen
281689e1fa LibWeb: Parse box-shadow in the DeprecatedCSSParser
This adds support for box-shadows to the DeprecatedCSSParser. When it
encounters a box-shadow property, the following syntaxes can get parsed:
- box-shadow: <offset_x> <offset_y> <color>
- box-shadow: <offset_x> <offset_y> <blur_radius> <color>

There is other possible data following the property, but those aren't
supported for now.
2021-07-24 22:16:48 +02:00
Tobias Christiansen
f1bdaafcf6 LibWeb: Make box-shadow known throughout the CSS subsystem
This patch spreads box-shadows around:
- The Values important to box-shadows are stored in a BoxShadowData
  struct
- StyleProperties knows how to construct such a struct from a
  BoxShadowStyleValue and a Node knows how to ask for it
- CalculatedValues contain BoxShadowData and expose them
2021-07-24 22:16:48 +02:00
Tobias Christiansen
36e6f559c5 LibWeb: Add box-shadow as a known ValueID 2021-07-24 22:16:48 +02:00