Commit graph

15090 commits

Author SHA1 Message Date
Nathan Lanza
33834090bb
Documentation: Update macOS build instructions cask invocation (#4561)
brew deprecated `brew cask` and requires `brew install --cask` instead
2020-12-27 01:18:15 +01:00
Tom
f1534ff36e Kernel: Take into account the time keeper's frequency (if no HPET)
The PIT is now also running at a rate of ~250 ticks/second, so rather
than assuming there are 1000 ticks/second we need to query the timer
being used for the actual frequency.

Fixes #4508
2020-12-27 01:17:50 +01:00
Andreas Kling
0e2b7f9c9a Kernel: Remove the per-process icon_id and sys$set_process_icon()
This was a goofy kernel API where you could assign an icon_id (int) to
a process which referred to a global shbuf with a 16x16 icon bitmap
inside it.

Instead of this, programs that want to display a process icon now
retrieve it from the process executable instead.
2020-12-27 01:16:56 +01:00
Andreas Kling
cb68b8ff8b LibGUI: Use FileIconProvider in RunningProcessesModel
This was the last remaining client of the per-process icon_id.
2020-12-27 01:16:56 +01:00
Andreas Kling
2e846631a8 SystemMonitor: Fetch process icons from their executable
Instead of using the extremely hackish icon_id field in /proc/all,
we now retrieve process icons from their executable by using
GUI::FileIconProvider.
2020-12-27 01:16:56 +01:00
Andreas Kling
21ccbc2167 Kernel: Expose process executable paths in /proc/all 2020-12-27 01:16:56 +01:00
Andreas Kling
87492e723b Kernel: Lock target process when generating core dump
Dumping core can happen at the end of a profiling run, and in that case
we have to protect the target process and take the lock while iterating
over its region map.

Fixes #4509.
2020-12-27 01:16:56 +01:00
Linus Groh
4395e1b240 paste: Don't read past clipboard data buffer size
ByteBuffer is not null-terminated (anymore), this is another one of
those bugs.
Also use the new format functions while we're here.

Fixes #4558.
2020-12-27 01:11:42 +01:00
Tom
74fa894994 Kernel: Remove subheap from list before removing memory
When the ExpandableHeap calls the remove_memory function, the
subheap is assumed to be removed and freed entirely. remove_memory
may drop the underlying memory at any time, but it also may cause
further allocation requests. Not removing it from the list before
calling remove_memory could cause a memory allocation in that
subheap while remove_memory is executing. which then causes issues
once the underlying memory is actually freed.
2020-12-26 19:55:01 +01:00
Andreas Kling
2588b14d38 DevTools: Add a simple GML Playground application :^)
This app allows you to edit GML and see the results live. Pretty cool!
2020-12-26 19:04:46 +01:00
Itamar
ec33e57f32 CMake: Generate SONAME attribute for shared objects
Previosuly, generation of the SONAME attribute was disabled.
This caused libraries to have relative paths in DT_NEEDED attributes
(e.g "Libraries/libcore.so" instead of just "libcore.so"),
which caused build errors when the working directory during build was
not $SERENITY_ROOT/Build.

This caused the build of ports that use libraries other than libc.so
to fail (e.g the nesalizer port).

Closes #4457
2020-12-26 17:38:39 +01:00
AnotherTest
7b5aa06702 Kernel: Allow 'elevating' unveil permissions if implicitly inherited from '/'
This can happen when an unveil follows another with a path that is a
sub-path of the other one:
```c++
unveil("/home/anon/.config/whoa.ini", "rw");
unveil("/home/anon", "r"); // this would fail, as "/home/anon" inherits
                           // the permissions of "/", which is None.
```
2020-12-26 16:10:04 +01:00
Andreas Kling
3be9a9ac76 LibTLS: Fix TLS breakage after ByteBuffer => Span conversion
Oops, I accidentally shadowed the outer scope's "decrypted" ByteBuffer
which caused us to throw away the buffer too early.

Fixes #4533.
2020-12-26 16:09:02 +01:00
Andreas Kling
bdff88d8d5 LibGUI: Make the LinkLabel widget keyboard-friendly
Make it tab-focusable and activate it with the return key. :^)
2020-12-26 16:09:02 +01:00
Brendan Coles
6b6594e3d0 MenuApplets: Username: init app early, pledge early, do not unveil /tmp 2020-12-26 15:18:12 +01:00
Sergey Bugaev
738f5f4d66 SystemServer: Set HOME for services
Fixes https://github.com/SerenityOS/serenity/issues/4484
2020-12-26 14:23:29 +01:00
Sergey Bugaev
95157f8b81 SystemServer: Port to Core::Account
We now have a handy Core::Account class that we can use instead of iterating
over the passwd database ourselves.
2020-12-26 14:23:29 +01:00
Andreas Kling
7babe5ade6 LibGUI: Set LinkLabel tooltip if text can't fit the widget
We were setting a tooltip when the text overflowed the *window* width,
make this more general by basing it on the *widget* width.
2020-12-26 13:17:57 +01:00
Andreas Kling
4e084793df LibGUI: Tweak GUI::Label API a bit and add did_change_text() virtual 2020-12-26 13:11:43 +01:00
Andreas Kling
9fe310c470 LibGUI: Minor tweaks to the GUI::LinkLabel
Remove some unnecessary includes and make the constructor private.
2020-12-26 13:07:53 +01:00
Andreas Kling
5452c8a566 LibGUI: Rename Link => LinkLabel 2020-12-26 13:03:38 +01:00
Andreas Kling
788594c0c2 Profiler: Show the name & PID of process being profiled
Also tweak the GUI a little bit to look nicer.
2020-12-26 12:58:50 +01:00
AnotherTest
1c9d28d212 AK: Fix busted Trie test
This wasn't testing anything ^^'
2020-12-26 12:32:27 +01:00
AnotherTest
ad646420dd AK: Make AK::IsSame<T, U>::value a constexpr bool
It being an enum value was preventing it from being used without `!!` in
requires clauses (bool also makes more sense anyway).
2020-12-26 12:32:27 +01:00
AnotherTest
a9184fcb76 Kernel: Implement unveil() as a prefix-tree
Fixes #4530.
2020-12-26 11:54:54 +01:00
AnotherTest
cb3348191b AK: Add a prefix tree implementation
`AK::Trie` can be keyed by any given hashable type, and can store any
metadata (including nothing at all).
Also adds a test.
2020-12-26 11:54:54 +01:00
AnotherTest
3dcdee75be Meta: Make lint-shell-scripts.sh happy
`${FAILURES}` -> `"${FAILURES}"`
2020-12-26 11:54:54 +01:00
Andreas Kling
bd47957c3a Profiler: Show a GUI message box with the error when profiling fails
This came up in @jonathandturner's video walking through the system
and playing with things: https://www.youtube.com/watch?v=TtV86uL5oD4

At one point, he tried profiling his Terminal app, and since the
Terminal was completely idle while profiling, no samples were captured
and there was no profile to show.

Make sure we propagate any error when loading the profile, and show it
in a GUI message box instead of stderr. :^)
2020-12-26 10:27:57 +01:00
Lenny Maiorani
b2316701a8 Everywhere: void arguments to C functions
Problem:
- C functions with no arguments require a single `void` in the argument list.

Solution:
- Put the `void` in the argument list of functions in C header files.
2020-12-26 10:10:27 +01:00
Sahan Fernando
b990fc5d3a LibC: Enable compiler warnings for scanf and strftime format strings 2020-12-26 10:05:50 +01:00
Sahan Fernando
e665ad92af Everywhere: Add -Wformat=2 to build 2020-12-26 10:05:50 +01:00
Sahan Fernando
d780e2265d LibC: Fix some incorrect printf usages 2020-12-26 10:05:50 +01:00
Sahan Fernando
6b01d1cf14 LibC: Enable compiler warnings for printf format strings 2020-12-26 10:05:50 +01:00
Andreas Kling
1cfdaf96c4 Kernel: Reset the process dumpable flag on successful non-setid exec
Once we've committed to a new memory layout and non-setid credentials,
we can reset the dumpable flag.
2020-12-26 01:31:24 +01:00
Andreas Kling
6e5a73c11a TextEditor+HexEditor: Tweak dirty document warning messages 2020-12-26 01:31:24 +01:00
Linus Groh
dd2ce8bc8f LaunchServer: Remove icons from LaunchServer::Handler 2020-12-26 01:09:13 +01:00
Linus Groh
d4a60583a9 LibDesktop: Remove icons from Desktop::Launcher::Details 2020-12-26 01:09:13 +01:00
Linus Groh
721b00a83a FileManager: Fix missing launch action icons
I missed this when updating everything to use GUI::FileIconProvider
rather than loading icons from .af files, it broke as a result as none
of them have icon info anymore. :^)
2020-12-26 01:09:13 +01:00
Xavier Cooney
1cf92d39eb LibJS: Implement String.prototype.endsWith() 2020-12-26 01:09:04 +01:00
Xavier Cooney
43f948b357 LibJS: Implement IsRegExp abstract operation
This is needed by various String.prototype operations, as well as
the RegExp constructor.
2020-12-26 01:09:04 +01:00
Linus Groh
d8899ea65b WindowServer: Validate cursor type in SetWindowCursor message handler
Fixes #4536.
2020-12-25 23:07:06 +01:00
Andreas Kling
82f86e35d6 Kernel+LibC: Introduce a "dumpable" flag for processes
This new flag controls two things:
- Whether the kernel will generate core dumps for the process
- Whether the EUID:EGID should own the process's files in /proc

Processes are automatically made non-dumpable when their EUID or EGID is
changed, either via syscalls that specifically modify those ID's, or via
sys$execve(), when a set-uid or set-gid program is executed.

A process can change its own dumpable flag at any time by calling the
new sys$prctl(PR_SET_DUMPABLE) syscall.

Fixes #4504.
2020-12-25 19:35:55 +01:00
Andreas Kling
3c9bd911b8 Kernel: Make /proc/PID directories owned by the EUID:EGID
This is instead of the UID:GID, since that was allowing some very bad
information leaks like spawning "su" as an unprivileged user and having
full /proc access to it.

Work towards #4504.
2020-12-25 19:35:55 +01:00
Andreas Kling
057c1d4798 Kernel: Fix build with E1000_DEBUG 2020-12-25 19:35:55 +01:00
Andreas Kling
ed5c26d698 AK: Remove custom %w format string specifier
This was a non-standard specifier alias for %04x. This patch replaces
all uses of it with new-style formatting functions instead.
2020-12-25 17:05:05 +01:00
Andreas Kling
cb2c8f71f4 AK: Remove custom %b format string specifier
This was a non-standard specifier alias for %02x. This patch replaces
all uses of it with new-style formatting functions instead.
2020-12-25 17:04:28 +01:00
Andreas Kling
89d3b09638 Kernel: Allocate new main thread stack before committing to exec
If the allocation fails (e.g ENOMEM) we want to simply return an error
from sys$execve() and continue executing the current executable.

This patch also moves make_userspace_stack_for_main_thread() out of the
Thread class since it had nothing in particular to do with Thread.
2020-12-25 16:22:01 +01:00
Andreas Kling
d55fb7b5e2 UserspaceEmulator: Use ring 3 segment selectors
We were using ring 0 selectors everywhere (the bottom 3 bits of a
selector determines the ring.) This doesn't really make any practical
difference since UE doesn't run code in other rings anyway, but let's
have correct-looking segment selectors. :^)
2020-12-25 15:39:26 +01:00
Andreas Kling
2f1712cc29 Kernel: Move ELF auxiliary vector building out of Process class
Process had a couple of members whose only purpose was holding on to
some temporary data while building the auxiliary vector. Remove those
members and move the vector building to a free function in execve.cpp
2020-12-25 15:23:35 +01:00
Andreas Kling
40e9edd798 LibELF: Move AuxiliaryValue into the ELF namespace 2020-12-25 14:48:30 +01:00