Commit graph

5819 commits

Author SHA1 Message Date
Jami Kettunen
33b8d37dd3 Applications: Space out SystemMonitor & TextEditor in AboutDialogs 2019-12-31 01:46:42 +01:00
Andreas Kling
3f254bfbc8 Kernel+ping: Only allow superuser to create SOCK_RAW sockets
/bin/ping is now setuid-root, and will drop privileges immediately
after opening a raw socket.
2019-12-31 01:42:34 +01:00
Andreas Kling
5c918d0e71 dmesg: Add missing newline to error message 2019-12-31 01:32:57 +01:00
Andreas Kling
9af054af9e ProcFS: Reduce the amount of info accessible to non-superusers
This patch hardens /proc a bit by making many things only accessible
to UID 0, and also disallowing access to /proc/PID/ for anyone other
than the UID of that process (and superuser, obviously.)
2019-12-31 01:32:27 +01:00
Andreas Kling
54d182f553 Kernel: Remove some unnecessary leaking of kernel pointers into dmesg
There's a lot more of this and we need to stop printing kernel pointers
anywhere but the debug console.
2019-12-31 01:22:00 +01:00
Andreas Kling
66d5ebafa6 Kernel: Let's also not consider kernel regions to be valid user stacks
This one is less obviously exploitable than the previous one, but still
a bug nonetheless.
2019-12-31 00:28:14 +01:00
Andreas Kling
0fc24fe256 Kernel: User pointer validation should reject kernel-only addresses
We were happily allowing syscalls with pointers into kernel-only
regions (virtual address >= 0xc0000000).

This patch fixes that by only considering user regions in the current
process, and also double-checking the Region::is_user_accessible() flag
before approving an access.

Thanks to Fire30 for finding the bug! :^)
2019-12-31 00:24:35 +01:00
Andreas Kling
25d7a7efa6 WindowServer: Let's boost all threads in the active client process
Instead of just boosting the main thread, let's boost all threads in
the currently active client process.

This avoids creating internal priority inversion problems in clients.
2019-12-30 20:10:49 +01:00
Andreas Kling
a69734bf2e Kernel: Also add a process boosting mechanism
Let's also have set_process_boost() for giving all threads in a process
the same boost.
2019-12-30 20:10:00 +01:00
Andreas Kling
0dea0fd06f WindowServer: Give a thread boost to the currently active window
When the currently active (foreground) window is owned by a client,
we now apply a +10 priority boost to the client's main thread.

You normally want the window you're interacting with to be responsive,
so this little boost allows it to run a bit sooner and more often. :^)
2019-12-30 19:33:24 +01:00
Andreas Kling
610f3ad12f Kernel: Add a basic thread boosting mechanism
This patch introduces a syscall:

    int set_thread_boost(int tid, int amount)

You can use this to add a permanent boost value to the effective thread
priority of any thread with your UID (or any thread in the system if
you are the superuser.)

This is quite crude, but opens up some interesting opportunities. :^)
2019-12-30 19:23:13 +01:00
Andreas Kling
50677bf806 Kernel: Refactor scheduler to use dynamic thread priorities
Threads now have numeric priorities with a base priority in the 1-99
range.

Whenever a runnable thread is *not* scheduled, its effective priority
is incremented by 1. This is tracked in Thread::m_extra_priority.
The effective priority of a thread is m_priority + m_extra_priority.

When a runnable thread *is* scheduled, its m_extra_priority is reset to
zero and the effective priority returns to base.

This means that lower-priority threads will always eventually get
scheduled to run, once its effective priority becomes high enough to
exceed the base priority of threads "above" it.

The previous values for ThreadPriority (Low, Normal and High) are now
replaced as follows:

    Low -> 10
    Normal -> 30
    High -> 50

In other words, it will take 20 ticks for a "Low" priority thread to
get to "Normal" effective priority, and another 20 to reach "High".

This is not perfect, and I've used some quite naive data structures,
but I think the mechanism will allow us to build various new and
interesting optimizations, and we can figure out better data structures
later on. :^)
2019-12-30 18:46:17 +01:00
Andreas Kling
816d3e6208 LibHTML: Ignore all CSS rules starting with "@" for now 2019-12-30 17:09:00 +01:00
Andreas Kling
a88d409c74 AK: Use stack buffers in String::number() to avoid some malloc() calls 2019-12-30 14:52:27 +01:00
Andreas Kling
1b2c6e8f41 LibCore: Use JsonObject::get_ptr() in CProcessStatisticsReader
This removes a bunch of JsonValue copying from the hot path in thread
statistics fetching.

Also pre-size the thread statistics vector since we know the final size
up front. :^)
2019-12-30 14:51:34 +01:00
Andreas Kling
7011dba98e AK: Add JsonObject::get_ptr() for copy-free lookup
This variant of get() returns a const JsonValue* instead of a JsonValue
and can be used when you want to peek into a JsonObject's member fields
without making copies.
2019-12-30 14:49:45 +01:00
Andreas Kling
b0bbdc53e9 Base: Remove misplaced backtick in syscall(1) 2019-12-30 14:15:18 +01:00
Jesse Buhagiar
ba98666b05 DisplayProperties: Add a menubar
Add a menubar to the `DisplayProperties` application to make it
more consistent with the other programs in the system.
2019-12-30 14:03:31 +01:00
Tibor Nagy
a7040078e5 Base: Add glyph spacing fields to fonts 2019-12-30 14:02:12 +01:00
Tibor Nagy
62d79a77d6 FontEditor: Add glyph spacing spinbox 2019-12-30 14:02:12 +01:00
Tibor Nagy
edc3580756 LibDraw: Store glyph spacing information in the fonts headers 2019-12-30 14:02:12 +01:00
Jami Kettunen
edba444aa9 Base: Add man page for keymap(1) 2019-12-30 14:02:00 +01:00
Jami Kettunen
107612209d Base: Add ASCII-friendly fi.json 2019-12-30 14:02:00 +01:00
Jami Kettunen
76f0a74b0c Keymap: Add ability to load keymap files by name 2019-12-30 14:02:00 +01:00
Jami Kettunen
0b3f1e70ca Keymap: Clean up source a bit 2019-12-30 14:02:00 +01:00
Andreas Kling
a1f2a7eaa8 ProtocolServer: Delete the generated IPC endpoints on "make clean" 2019-12-30 13:47:48 +01:00
Andreas Kling
ef658594e4 LibIPC: Let's start building custom message codecs for LibIPC
Instead of using ByteBuffer (which always malloc() their storage) for
IPC message encoding, we now use a Vector<u8, 1024>, which means that
messages smaller than 1 KB avoid heap allocation entirely.
2019-12-30 02:41:45 +01:00
Andreas Kling
00d26457c5 WindowServer: Don't repaint entire menubar on applet update 2019-12-30 01:18:38 +01:00
Andreas Kling
8fd7f3d9fa Ports: Update GCC patch to match our toolchain 2019-12-30 00:36:37 +01:00
Andreas Kling
57f55f297b LibGUI: Call GWidget::resize_event() before doing widget layout
The widget layout system currently works by having layouts size the
children of a widgets. The children then get resize events, giving them
a chance to lay out their own children, etc.

In keeping with this, we need to handle the resize event before calling
do_layout() in a widget, since the resize event handler may do things
that end up affecting the layout, but layout should not affect the
resize event since the event comes from the widget parent, not itself.
2019-12-30 00:26:19 +01:00
Andreas Kling
aaaf04f393 LibGUI: Relayout GTextEditor on font change
Fixes #941.
2019-12-29 23:03:41 +01:00
Andrew Kaster
cdcab7e5f4 Kernel: Retry mmap if MAP_FIXED is not in flags and addr is not 0
If an mmap fails to allocate a region, but the addr passed in was
non-zero, non-fixed mmaps should attempt to allocate at any available
virtual address.
2019-12-29 23:01:27 +01:00
Andrew Kaster
bae8e21a8b Kernel: Add move assign operator to KResultOr 2019-12-29 23:01:27 +01:00
Andreas Kling
821484f170 AK: Fix JSON parser crashing when encountering UTF-8
The mechanism that caches the most recently seen string for each first
character was indexing into the cache using a 'char' subscript. Oops!
2019-12-29 22:20:21 +01:00
Shannon Booth
d1d7db2745 WindowServer: Include minimised windows for switching 2019-12-29 22:07:46 +01:00
Shannon Booth
24bc674d94 AK: Add StringView::ends_with function 2019-12-29 22:04:22 +01:00
Andreas Kling
27df4eb43d WindowServer: Always fill the menubar with color behind applets
Otherwise, menu applets with an alpha channel may leave behind ghost
pixels when updating.

Fixes #949.
2019-12-29 21:18:38 +01:00
Andreas Kling
8721d54f24 Clock.MenuApplet: Only wake up once per second
This avoids an issue where we'd sometimes go longer than a whole second
between updates. Thanks to Roman May for the suggestion! :^)
2019-12-29 21:18:07 +01:00
Andreas Kling
fed3416bd2 Kernel: Embrace the SerenityOS name 2019-12-29 19:08:02 +01:00
Andreas Kling
6a94214502 About: Embrace the SerenityOS name 2019-12-29 19:07:52 +01:00
Andreas Kling
2de19342e7 Meta: Fix typo in ReadMe 2019-12-29 16:25:06 +01:00
Andreas Kling
fd14795f9d Meta: Update ReadMe and move build instructions to a separate document 2019-12-29 16:23:50 +01:00
Andreas Kling
411d293961 LibCore+LibGUI: Don't fire timers in non-visible windows by default
LibCore timers now have a TimerShouldFireWhenNotVisible flag which is
set to "No" by default.

If "No", the timer will not be fired by the event loop if it's within
a CObject tree whose nearest GWindow ancestor is currently not visible
for timer purposes. (Specificially, this means that the window is
either minimized or fully occluded, and so does not want to fire timers
just to update the UI.)

This is another nice step towards a calm and serene operating system.
2019-12-29 16:03:36 +01:00
Andreas Kling
f8f2b8b520 LibDraw: Fix text rendering in progress bars 2019-12-29 15:53:28 +01:00
Andreas Kling
e0ec4f89b2 Base: Add man page for purge(8) 2019-12-29 13:23:21 +01:00
Andreas Kling
1f31156173 Kernel: Add a mode flag to sys$purge and allow purging clean inodes 2019-12-29 13:16:53 +01:00
Andreas Kling
c74cde918a Kernel+SystemMonitor: Expose amount of per-process clean inode memory
This is memory that's loaded from an inode (file) but not modified in
memory, so still identical to what's on disk. This kind of memory can
be freed and reloaded transparently from disk if needed.
2019-12-29 12:45:58 +01:00
Andreas Kling
0d5e0e4cad Kernel+SystemMonitor: Expose amount of per-process dirty private memory
Dirty private memory is all memory in non-inode-backed mappings that's
process-private, meaning it's not shared with any other process.

This patch exposes that number via SystemMonitor, giving us an idea of
how much memory each process is responsible for all on its own.
2019-12-29 12:28:32 +01:00
Andreas Kling
ffbe975ffc LibHTML: RenderingContext should keep the Palette alive
We were lugging around a reference to a temporary here.
2019-12-29 12:01:24 +01:00
Stefano Cristiano
985d906189 Build: Add instructions on where to get flock on macOS
Commit 0b50133 makes use of flock command inside makefiles.
Unfortunately it's not a core macOS command, so it must be installed explicitly using brew.
2019-12-29 01:08:37 +01:00