Commit graph

5992 commits

Author SHA1 Message Date
Andreas Kling
1d95e56700 LibHTML: Fix broken build after Element::computed_style() change 2020-01-05 17:38:52 +01:00
Matrix89
0d402a074b LibHTML: Make the Element::computed_style() return NonnullRefPtr
Because Element::computed_style() can never retrun null we can
return NonnullRefPtr instead of RefPtr.
2020-01-05 17:13:22 +01:00
Matrix89
99cf8e36b1 LibHTML: Add four missing border properties to the computed style 2020-01-05 17:13:22 +01:00
Matrix89
c2e1dd67c9 LibHTML: Replace StyleProperties::create(StyleProperties) with clone() 2020-01-05 17:13:22 +01:00
Matrix89
2dd35916e5 Browser+LibHTML: Change the way computed styles are queried 2020-01-05 17:13:22 +01:00
Matrix89
2ced4c4ec7 Browser+LibHTML: Deduplicate inspector code
The `DOMElementStyleModel` and `DOMComputedElementStyleModel` classes were
replaced by the `StylePropertiesModel`.
2020-01-05 17:13:22 +01:00
Matrix89
988d1deca8 Browser+LibHTML: Add "Computed" styles to the DOM inspector
I though it would be nice to also show the style that the browser uses
to display an element.

In order to do that, in place of the styles table I've put a tab widget,
with tabs for both element and computed element styles.
2020-01-05 17:13:22 +01:00
Andreas Kling
1da31ce8ae LibCore: IDAllocator should never vend ID 0
This was tripping up CObject which interprets timer ID 0 as "no timer".
Once we got ID 0 assigned, it was impossible to turn it off and it
would fire on every event loop iteration, causing CPU churn.
2020-01-05 15:13:55 +01:00
Andreas Kling
c410644c90 WindowServer: Stop menu applets from blocking wallpaper updates
The clock menu applet was causing pixel ghosting at some seemingly
arbitrary location on the desktop because the background paint logic
tries to avoid painting any part of the background that's covered by
an opaque window.

Since the code was using any_opaque_window_contains_rect() to check
this, we were not considering the window's *type*. (Menu applets are
still windows, but they are of the special type "MenuApplet" and do
not participate in normal compositing.)

The fix is to use for_each_visible_window_from_back_to_front() instead
of for_each_window() :^)

Fixes #1022.
2020-01-05 13:41:02 +01:00
Andreas Kling
c9507e8cbe ls: Display SUID files with red background color 2020-01-05 12:49:25 +01:00
Tibor Nagy
cdeae8a6f3 Keymap: Fix map initialization
Correct the number of keymap entries and initialize them.

Fixes #1017
2020-01-05 12:25:26 +01:00
Tibor Nagy
1bb98c6950 Kernel: Fix IRQ define in PS2MouseDevice 2020-01-05 10:45:30 +01:00
Andreas Kling
1525c11928 Kernel: Add missing iovec base validation for writev() syscall
We were forgetting to validate the base pointers of iovecs passed into
the writev() syscall.

Thanks to braindead for finding this bug! :^)
2020-01-05 10:38:02 +01:00
Andreas Kling
c89fe8a6a3 Kernel: Fix bad TOCTOU pattern in syscalls that take a parameter struct
Our syscall calling convention only allows passing up to 3 arguments in
registers. For syscalls that take more arguments, we bake them into a
struct and pass a pointer to that struct instead.

When doing pointer validation, this is what we would do:

    1) Validate the "params" struct
    2) Validate "params->some_pointer"
    3) ... other stuff ...
    4) Use "params->some_pointer"

Since the parameter struct is stored in userspace, it can be modified
by userspace after validation has completed.

This was a recurring pattern in many syscalls that was further hidden
by me using structured binding declarations to give convenient local
names to things in the parameter struct:

    auto& [some_pointer, ...] = *params;
    memcpy(some_pointer, ...);

This devilishly makes "some_pointer" look like a local variable but
it's actually more like an alias for "params->some_pointer" and will
expand to a dereference when accessed!

This patch fixes the issues by explicitly copying out each member from
the parameter structs before validating them, and then never using
the "param" pointers beyond that.

Thanks to braindead for finding this bug! :^)
2020-01-05 10:37:57 +01:00
Andreas Kling
7ae7a60caa LibELF: Fix stack overflow in ELFImage::relocations()
Thanks to braindead for finding the bug! :^)
2020-01-05 10:37:54 +01:00
Sergey Bugaev
0f42908073 LibHTML: Respect the system theme
LibHTML will now use the palette colors for the default document background and
the text. As always, a page can override this default styling with CSS if it
really wants a specific color or style.

Fixes https://github.com/SerenityOS/serenity/issues/963
2020-01-05 10:21:15 +01:00
Shannon Booth
7557251fac WindowServer: Move menu related code from WindowManager to MenuManager
Menus are now owned by menu manager instead of being split between the
window manager and menu manager. If the window server wants to change
a menu, or call menu related functionality, this will need to be done
through the menu manager.

Further refactoring is likely needed, but this seems like a good start
for seperating menu logic from window logic.
2020-01-05 09:02:24 +01:00
marprok
adff54879c Userland: Support multiple input files.
The user can now give more than one files to the cut command.
2020-01-05 09:00:47 +01:00
Shannon Booth
861f40f014 AK+LibCore: Add an IDAllocator and use to allocate timer ids 2020-01-05 09:00:05 +01:00
Shannon Booth
d5fea1b235 AK: Add a u64 Trait type
This allows u64s to be used in HashMaps.
2020-01-05 09:00:05 +01:00
Elisée Maurer
9e22b83343 Documentation: Suggest gcc-9 on Ubuntu since PPA doesn't have 8 anymore 2020-01-05 08:57:43 +01:00
Jami Kettunen
08c7b5068e Base: Space out some names in app files 2020-01-04 22:29:21 +01:00
Andreas Kling
5a02a0d140 LibGUI: Refine the per-item rects in GItemView
Previously we would consider anything in the large padded area around
each item to also be part of the item for mouse event purposes.
This didn't feel right when rubberbanding, so this patch factors out
the per-item rect computation into a get_item_rects() helper which can
then be used by the various functions that need it.
2020-01-04 21:36:42 +01:00
Andreas Kling
6e21d5c432 LibGUI: Add basic rubber band selection in GItemView 2020-01-04 21:18:48 +01:00
Andreas Kling
d4761762f2 Kernel: Remove some unused Process members 2020-01-04 19:53:29 +01:00
Andreas Kling
3a27790fa7 Kernel: Use Thread::from_tid() in more places 2020-01-04 18:56:04 +01:00
Andreas Kling
95ba0d5a02 Kernel: Remove unused "putch" syscall 2020-01-04 16:00:25 +01:00
Jami Kettunen
874a6c4039 WindowServer: Introduce keyboard shortcuts for fast window management 2020-01-04 14:58:50 +01:00
Jami Kettunen
6c2fa0ee0a WindowServer: Maximize a window if it is dragged to top of the screen 2020-01-04 14:58:50 +01:00
Jami Kettunen
74ae6ac94b WindowServer: Various window pop-up menu fixes & QoL tweaks 2020-01-04 14:58:50 +01:00
Jami Kettunen
eab34a7de3 WindowServer+LibGUI: Implement minimizable property to windows 2020-01-04 14:58:50 +01:00
Jami Kettunen
a641f4d213 WindowServer: Set no active window if no new candidates are available 2020-01-04 14:58:50 +01:00
Andreas Kling
c663b1034a su: Use setgroups() to switch over to the target user's extra GIDs
Before this, su would leave the process's extra GIDs untouched,
simply inheriting them from whoever spawned su.

Now we grab the target user's groups from /etc/group and setgroups().
2020-01-04 13:48:55 +01:00
Andreas Kling
5abc30e057 Kernel: Allow setgroups() to drop all groups with nullptr
Previously we'd EFAULT for setgroups(0, nullptr), but we can just as
well tolerate it if someone wants to drop groups without a pointer.
2020-01-04 13:47:54 +01:00
Andreas Kling
69af59d061 Base: Only allow members of the "wheel" group to use /bin/su 2020-01-04 13:35:25 +01:00
Andreas Kling
d4b4883d55 id: Remove weird commas from output 2020-01-04 13:26:51 +01:00
Andreas Kling
f558c8e36a Base: Add an "audio" group that gets to write to /dev/audio 2020-01-04 13:25:13 +01:00
Andreas Kling
498659773c Base: Add a "phys" group for users with physical access
Only users in this group can access the screen, mouse and keyboard.
2020-01-04 13:21:33 +01:00
Andreas Kling
9bd4bf41fb SystemServer: Explicitly open /dev/null for services without StdIO
Spawning services with nothing open at all on the standard I/O fds is
way too harsh. We now open /dev/null for them instead.
2020-01-04 13:15:01 +01:00
Andreas Kling
c2b7c43f3c SystemServer: Fetch any extra GIDs and call setgroups() before spawn
We now pick up all the user's extra GIDs from /etc/group and make
sure those are set before exec'ing a service.

This means we finally get to enjoy being in more than one group. :^)
2020-01-04 13:11:43 +01:00
Andreas Kling
b4b8b8850a LibC: Fix broken setgroups() wrapper
This was invoking the wrong syscall (getgroups), oops! We had not been
using it yet, so it makes sense.
2020-01-04 13:01:14 +01:00
Andreas Kling
12eb1f5d74 Kernel: Entries in /dev/pts should be accessible only to the owner
This fixes an issue where anyone could snoop on any pseudoterminal.
2020-01-04 12:46:48 +01:00
Andreas Kling
c6254916ba Base: Make /dev/hd{a,b,c,d} superuser-only 2020-01-04 12:46:45 +01:00
Andreas Kling
20ac4e44d1 Base: Add "tty" group and make /dev/tty* be root:tty mode 610
This fixes an issue where anyone could snoop on the virtual consoles.
2020-01-04 12:46:09 +01:00
Andreas Kling
4f4dc47ec3 TTYServer: Use fork+exec instead of system()
No point in spawning an extra shell process just to spawn a shell. :^)
2020-01-04 12:33:34 +01:00
Andreas Kling
b5da0b78eb Kernel: File::open() should apply r/w mode from the provided options
This has been a FIXME for a long time. We now apply the provided
read/write permissions to the constructed FileDescription when opening
a File object via File::open().
2020-01-04 12:30:55 +01:00
Andreas Kling
32d0967f5f SystemServer: Don't let services inherit standard in/out and TTY
We were letting services inherit writable fds for /dev/tty0, as well as
having /dev/tty0 as their controlling terminal.

Lock this down by closing fds {0,1,2} when spawning a service. We also
detach from the controlling terminal. An exception is made for services
with an explicit StdIO setting. In those cases, we now switch the
controlling terminal to the specified path if possible.
2020-01-04 12:17:13 +01:00
Andreas Kling
755938c650 ls: Show directories with the sticky bit in a special color
This makes /tmp show up with a green background in "ls" output.
2020-01-04 11:38:02 +01:00
Andreas Kling
e79c33eabb Kernel: The root inode of a TmpFS should have the sticky bit set
We were running without the sticky bit and mode 777, which meant that
the /tmp directory was world-writable *without* protection.

With this fixed, it's no longer possible for everyone to steal root's
files in /tmp.
2020-01-04 11:33:36 +01:00
Andreas Kling
4398eec03c Build: Lock down the /mod and /boot directories
Make these directories accessible to root only. Unprivileged users have
no need to look at the kernel binary or kernel modules.
2020-01-04 11:12:59 +01:00