Commit Graph

311 Commits

Author SHA1 Message Date
Sergey Bugaev
3e1ed38d4b Kernel: Do not return ENOENT for unresolved symbols
ENOENT means "no such file or directory", not "no such symbol". Return EINVAL
instead, as we already do in other cases.
2020-01-18 23:51:22 +01:00
Andreas Kling
26a31c7efb Kernel: Add "accept" pledge promise for accepting incoming connections
This patch adds a new "accept" promise that allows you to call accept()
on an already listening socket. This lets programs set up a socket for
for listening and then dropping "inet" and/or "unix" so that only
incoming (and existing) connections are allowed from that point on.
No new outgoing connections or listening server sockets can be created.

In addition to accept() it also allows getsockopt() with SOL_SOCKET
and SO_PEERCRED, which is used to find the PID/UID/GID of the socket
peer. This is used by our IPC library when creating shared buffers that
should only be accessible to a specific peer process.

This allows us to drop "unix" in WindowServer and LookupServer. :^)

It also makes the debugging/introspection RPC sockets in CEventLoop
based programs work again.
2020-01-17 11:19:06 +01:00
Brian Gianforcaro
b553a86048 man: Fix minor inconsistencies in pledge(2) man page
- tty promise was listed twice.

- Fix a few typos
2020-01-14 08:00:35 +01:00
Andreas Kling
fd64e97c8a LibDraw+LibHTML: Make link colors themeable
Add "Link", "ActiveLink" and "VisitedLink" colors to the system theme
definition, and implement support for them in LibHTML.

Note that <body link="foo" alink="bar" vlink="baz"> takes precedence
over the system colors. Author style also takes precedence, since we
only fetch the system color in case the CSS color is -libhtml-link.
2020-01-13 20:33:15 +01:00
Sergey Bugaev
9513f54932 Base: Document new chroot abilities 2020-01-12 20:02:11 +01:00
Sergey Bugaev
fee6d0a3a6 Kernel+Base: Mount root as nodev,nosuid
Then bind-mount /dev and /bin while adding back the appropriate permissions :^)
2020-01-12 20:02:11 +01:00
Andreas Kling
198cd77307 Base: Tweak language in pledge(2) man page 2020-01-12 19:08:42 +01:00
Andreas Kling
f3eb06a46f Base: Add a man page about pledge(2) 2020-01-12 16:11:12 +01:00
Sergey Bugaev
b37bd28053 Base: Document mount(2) and mount(8) 2020-01-11 18:57:53 +01:00
Sergey Bugaev
71f1d3f819 Base: Apply some filesystem flags by default
Notably, /tmp is now mounted nodev,nosuid :^)
2020-01-11 18:57:53 +01:00
Andreas Kling
d0a708fda4 Base: Run ProtocolServer as a separate "protocol" user
This is probably not the final design we'll want for this, but for now
let's run the HTTP client code as a separate user to reduce exposure
for the standard "anon" user account.

Note that "protocol" is also added to the "lookup" group, in order to
allow ProtocolServer to contact LookupServer for DNS requests.
2020-01-11 13:07:32 +01:00
Andreas Kling
3f9e4cd24e chroot: Add a little chroot program
This program changes the current filesystem root and spawns a shell.
2020-01-10 23:23:20 +01:00
Sergey Bugaev
7bc8fa884a FileManager: Add a columns view
This new view, backed by a GColumnsView, joins the existing table and icon
views :^) Even though it displays a file tree, its data is provided by the very
same GFileSystemModel that the other two views use.

This commit also includes my attempt at making an icon for the new mode.
2020-01-10 17:45:59 +01:00
Andreas Kling
f5d9f11e52 Base: Add a "lookup" user+group that runs LookupServer
LookupServer now runs as lookup:lookup, allowing connections from other
members of the "lookup" group.

This is enforced through file system permissions by having the service
socket (/tmp/portal/lookup) be mode 0660.

Now the LookupServer program can't overwrite other people's files if it
starts misbehaving. That's pretty cool :^)
2020-01-09 21:36:17 +01:00
Andreas Kling
7dd03b46ee SystemServer: Allow specifying per-service socket file permissions 2020-01-09 21:35:33 +01:00
0xtechnobabble
123dcada05 Themes: Support rubberband selection theming 2020-01-07 11:02:43 +01:00
Jami Kettunen
08c7b5068e Base: Space out some names in app files 2020-01-04 22:29:21 +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
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
Tibor Nagy
790eaab6f5 Keymap+Base: Keycode fixes, remove workaround
Add missing keymap entries for the dollar sign and escape key and reformat
the Hungarian keymap.

Remove the workaround for "0x08", replace it with '\b'.

Fix the octal/hex mixup in the value of escape key. (033 != 0x33, 033 == 0x1B)
2020-01-03 01:20:47 +01:00
Andreas Kling
7f843ef3b2 Kernel: Make the purge() syscall superuser-only
I don't think we need to give unprivileged users access to what is
essentially a kernel testing mechanism.
2020-01-02 13:39:49 +01:00
Andreas Kling
4fa7146da1 Base: Move the modload and modunload command documentation to man8
These are system administration commands, not intended for use by
all users. These tend to go in section 8.
2020-01-02 12:37:19 +01:00
Andreas Kling
05b004ec64 Base: Remove "idle" priority note from SystemServer(5)
The "idle" priority was never meant to be exposed to userspace, as it's
only used by the kernel's internal idle thread.
2020-01-02 12:36:15 +01:00
Andreas Kling
0c22646e2b Base: Document EPERM error in module_load(2) and module_unload(2)
Only the superuser can use these system calls.
2020-01-02 12:35:19 +01:00
Andreas Kling
38f93ef13b Kernel: Disable x86 RDTSC instruction in userspace
It's still possible to read the TSC via the read_tsc() syscall, but we
will now clear some of the bottom bits for unprivileged users.
2020-01-01 18:22:20 +01:00
Andreas Kling
f598bbbb1d Kernel: Prevent executing I/O instructions in userspace
All threads were running with iomapbase=0 in their TSS, which the CPU
interprets as "there's an I/O permission bitmap starting at offset 0
into my TSS".

Because of that, any bits that were 1 inside the TSS would allow the
thread to execute I/O instructions on the port with that bit index.

Fix this by always setting the iomapbase to sizeof(TSS32), and also
setting the TSS descriptor's limit to sizeof(TSS32), effectively making
the I/O permissions bitmap zero-length.

This should make it no longer possible to do I/O from userspace. :^)
2020-01-01 17:31:41 +01:00
Andreas Kling
9c0836ce97 Kernel: Enable x86 UMIP (User Mode Instruction Prevention) if supported
This prevents code running outside of kernel mode from using the
following instructions:

* SGDT - Store Global Descriptor Table
* SIDT - Store Interrupt Descriptor Table
* SLDT - Store Local Descriptor Table
* SMSW - Store Machine Status Word
* STR - Store Task Register

There's no need for userspace to be able to use these instructions so
let's just disable them to prevent information leakage.
2020-01-01 13:21:15 +01:00
Jami Kettunen
6af301edec Base: Update Finnish keymap with proper AltGr support 2019-12-31 19:46:40 +01:00
Tibor Nagy
d8ddf803e2 Base: Add Hungarian keymap 2019-12-31 19:31:42 +01:00
Shannon Booth
d0f9906c17 Crash: Add a "Test All Crash Types" option
Add an option "-A", that will run all of the crash types in the crash
program. In this mode, all crash tests are run in a child process so
that the crash program does not crash.

Crash uses the return status of the child process to ascertain whether
the crash happened as expected.
2019-12-31 02:14:36 +01:00
Andreas Kling
b0bbdc53e9 Base: Remove misplaced backtick in syscall(1) 2019-12-30 14:15:18 +01:00
Tibor Nagy
a7040078e5 Base: Add glyph spacing fields to fonts 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
Andreas Kling
e0ec4f89b2 Base: Add man page for purge(8) 2019-12-29 13:23:21 +01:00
Tibor Nagy
ac0b8caa42 Base: Add 2x upscaled Liza fonts 2019-12-28 21:06:02 +01:00
Hüseyin ASLITÜRK
e50deb55d3 WindowServer: Remove Clock from server.
We have clock applet.
2019-12-27 22:47:31 +01:00
Shannon Booth
c85bdff57a PaintBrush: Add an "ellipse tool"
The tool currently supports drawing an elliptical line of a specified
thickness. Further improvements can include adding a fill mode, and
holding down shift to draw a perfect circle.

Closes #375.
2019-12-27 00:52:17 +01:00
Shannon Booth
b830639912 PaintBrush: Add a "rectangle tool"
Fill, line, and gradient modes initially supported :^)
2019-12-26 21:22:29 +01:00
Tibor Nagy
f0a82e1bcc Base: Add 3x upscaled Liza fonts
Upscaled with hq3x then cleaned up the glyphs manually.
2019-12-26 14:35:51 +01:00
Andreas Kling
5be6a43860 LibDraw: Add MenuBaseText and MenuSelectionText color roles
This allows the very aesthetic "Hotdog Stand" theme to have quite
reasonable looking menus.
2019-12-26 00:58:46 +01:00
Conrad Pankoff
5330593e38 Base: Add Hotdog Stand theme 2019-12-26 00:46:16 +01:00
Andreas Kling
33efeaf71a crash: Add "-X" option for attempting to execute non-executable memory 2019-12-25 13:35:57 +01:00
Andreas Kling
aae54bdbde LibDraw: Add ColorRole::BaseText (to be painted on ColorRole::Base) 2019-12-24 22:01:32 +01:00
Mauri de Souza Nunes
cb4e51a7a5 Userland: Add syscall -l option and man page 2019-12-24 20:23:37 +01:00
Andreas Kling
b6eba388e3 LibDraw: Add Selection and SelectionText system theme colors 2019-12-24 12:13:49 +01:00
Conrad Pankoff
033de7efe2 Base: Describe kernel modules, syscalls, and programs 2019-12-24 11:52:01 +01:00