Commit graph

6209 commits

Author SHA1 Message Date
Andreas Kling
61e6b1fb7c AK: Run clang-format on Atomic.h
Also use <AK/Types.h> instead of <stddef.h>
2020-01-12 18:45:13 +01:00
Andreas Kling
f3eb06a46f Base: Add a man page about pledge(2) 2020-01-12 16:11:12 +01:00
Andreas Kling
8b54ba0d61 Kernel: Dispatch pending signals when returning from a syscall
It was quite easy to put the system into a heavy churn state by doing
e.g "cat /dev/zero".

It was then basically impossible to kill the "cat" process, even with
"kill -9", since signals are only delivered in two conditions:

a) The target thread is blocked in the kernel
b) The target thread is running in userspace

However, since "cat /dev/zero" command spends most of its time actively
running in the kernel, not blocked, the signal dispatch code just kept
postponing actually handling the signal indefinitely.

To fix this, we now check before returning from a syscall if there are
any pending unmasked signals, and if so, we take a dramatic pause by
blocking the current thread, knowing it will immediately be unblocked
by signal dispatch anyway. :^)
2020-01-12 15:04:33 +01:00
Andreas Kling
62a191b59a Kernel: Require "tty" for ioctl() on TTY and MasterPTY
SystemServer now pledges "tty" since it's used when spawning services.
2020-01-12 13:29:51 +01:00
Andreas Kling
35c84504cd IPv4: Require "inet" promise for ioctl() on an IPv4Socket 2020-01-12 13:28:07 +01:00
Andreas Kling
a27d2b7b32 chmod: Use pledge() 2020-01-12 13:25:02 +01:00
Andreas Kling
22cf24cba7 ChanViewer: Use pledge()
This app should be ported to LibProtocol, which would allow it to drop
"inet" and "dns" as well.
2020-01-12 13:22:34 +01:00
Andreas Kling
e588a41ac9 Browser: Drop "unix" pledge after starting up
We now instantiate a connection to ProtocolServer right away by calling
ResourceLoader::the(). This allows us to drop the "unix" pledge. :^)
2020-01-12 13:20:02 +01:00
0xtechnobabble
e12798c0a9 chown: Use pledge() 2020-01-12 12:55:20 +01:00
0xtechnobabble
f501014fae Userland: Add the chgrp command
The chgrp command allows the user to easily modify a file's group while
leaving its owner unchanged.
2020-01-12 12:55:20 +01:00
0xtechnobabble
954daaa916 Userland: Add named gid/uid args parsing
This patch makes it so that if a user provides a groupname/username
instead of an id, chown will automatically convert it to a gid/uid
using getgrnam() or getpwnam() respectively.
2020-01-12 12:55:20 +01:00
Andreas Kling
df7b81bdf5 Games: Use pledge() 2020-01-12 12:29:40 +01:00
Andreas Kling
d1839ae0c9 Kernel: Clearing promises with pledge("") should fail
Thanks Sergey for catching this brain-fart. :^)
2020-01-12 12:16:17 +01:00
Andreas Kling
f813bb52a2 Applications+DevTools+MenuApplets: Drop "unix" pledge when possible
Now that the "unix" pledge is no longer required for socket I/O, we can
drop it after making the connections we need in a program.

In most GUI program cases, once we've connected to the WindowServer by
instantiating a GApplication, we no longer need "unix" :^)
2020-01-12 12:03:57 +01:00
Andreas Kling
114a770c6f Kernel: Reduce pledge requirement for recvfrom()+sendto() to "stdio"
Since these only operate on already-open sockets, we should treat them
the same as we do read() and write() by putting them into "stdio".
2020-01-12 11:52:37 +01:00
Andreas Kling
955034e86e Kernel: Remove manual STAC/CLAC in create_thread() 2020-01-12 11:51:31 +01:00
Andreas Kling
a885719af5 Kernel: Keep SMAP protection enabled in Thread::backtrace_impl() 2020-01-12 10:47:01 +01:00
Andreas Kling
a6cef2408c Kernel: Add sigreturn() to "stdio" with all the other signal syscalls 2020-01-12 10:32:56 +01:00
Andreas Kling
7b53699e6f Kernel: Require the "thread" pledge promise for futex() 2020-01-12 10:31:21 +01:00
Andreas Kling
c32d65ae9f Kernel: Put some more syscalls in the "stdio" bucket
yield() and get_kernel_info_page() seem like decent fits for "stdio".
2020-01-12 10:31:21 +01:00
Andreas Kling
f6c0fccc01 Kernel: Fix busted backtraces when a thread backtraces itself
When the current thread is backtracing itself, we now start walking the
stack from the current EBP register value, instead of the TSS one.

Now SystemMonitor always appears to be running Thread::backtrace() when
sampled, which makes perfect sense. :^)
2020-01-12 10:19:37 +01:00
Andreas Kling
0d961ece94 SystemMonitor: Add "proc" pledge so we can send signals to processes 2020-01-12 10:07:42 +01:00
Andreas Kling
1b9f4c7c40 Shell: Fix broken debug logging about waiting on children 2020-01-12 10:03:06 +01:00
Andreas Kling
4edbcebeb4 Kernel: Put termios debug spam behind TTY_DEBUG 2020-01-12 10:02:02 +01:00
Andreas Kling
cb59f9e0f2 Kernel: Put some VFS debug spam behind VFS_DEBUG 2020-01-12 10:01:22 +01:00
Andreas Kling
ca609ce5a3 Kernel: Put fcntl() debug spam behind DEBUG_IO 2020-01-12 10:01:22 +01:00
Andreas Kling
45e7c2ba69 LibDraw: Remove debug spam about loading system themes 2020-01-12 10:01:22 +01:00
Shannon Booth
c66a6f131e WindowServer: Send key events to menu manager is there is a current menu
If there is a current menu, we now redirect all key events from window
manager to the menu manager. This allows us to properly navigate a menu
even when there is a current menu open.

Menu key navigation is now a lot more pleasant to use :^)

The action of pressing escape to close a menu has also been moved to its
proper home in menu manager in this commit.
2020-01-12 09:52:40 +01:00
Shannon Booth
e6c826ffc3 WindowServer: Fix non-submenus being closed when set as current menu
set_current_menu() was indiscriminately closing all menus when the
current menu is not a submenu. We should only close menus not in lineage
to the one being closed.
2020-01-12 09:52:40 +01:00
Shannon Booth
4f6b9b64c3 WindowServer: Fix incorrect current menu when switching to new item
We were forgetting to update the current menu when switching to a new
item.

We also rename the function from implying that only a redraw is
happening, as is actually not the case. It is now more correctly named:
update_for_new_hovered_item()
2020-01-12 09:52:40 +01:00
Andreas Kling
0d2bfc4ea0 WindowServer: Actually don't bring up system menu during move/resize
It was still possible to pop up the system menu by letting go of the
mouse button before letting go of the Logo key. This patch fixes that.
2020-01-12 02:33:24 +01:00
Andreas Kling
17135c9704 SoundPlayer: Use pledge() 2020-01-12 02:28:26 +01:00
Andreas Kling
b79711786c Help: Use pledge() 2020-01-12 02:23:55 +01:00
Andreas Kling
017b34e1ad Kernel: Add "video" pledge for accessing framebuffer devices
WindowServer becomes the only user.
2020-01-12 02:18:30 +01:00
Andreas Kling
bb6b9d9059 QuickShow: Use pledge() 2020-01-12 02:02:44 +01:00
Andreas Kling
9e51291aed Kernel: Disable SMAP protection while capturing profile samples 2020-01-12 02:02:29 +01:00
Andreas Kling
ef05bb61a0 WindowServer: Don't show system menu on Logo KeyUp during move/resize 2020-01-12 01:46:41 +01:00
0xtechnobabble
49e8d34f0e TextEditor: Replace text in find textbox with selection
This patch makes it so that if the find/replace widget is opened while
some text is selected, the find textbox's content is overrided with the
selected text.
2020-01-12 01:41:36 +01:00
0xtechnobabble
ecf58ddd4f TextEditor: Implement replacement functionality
This patch adds a new replace widget that cooperates with the find
widget, the replace widget takes the input in the find textbox, searches
for occurences of that input, and replaces them with the input provied
in the replace textbox.
2020-01-12 01:41:36 +01:00
Andreas Kling
2b20e8e187 IRCClient: Use pledge() 2020-01-11 23:53:54 +01:00
Andreas Kling
2067c003ff TextEditor: Use pledge() 2020-01-11 23:50:05 +01:00
Andreas Kling
f187374c1b Kernel: fork()ed children should inherit pledge promises :^)
Update various places that now need wider promises as they are not
reset by fork() anymore.
2020-01-11 23:28:41 +01:00
Andreas Kling
b39e732eb3 FileManager: Use pledge() 2020-01-11 22:13:38 +01:00
Andreas Kling
75c5e9af56 LibGUI: Fix assertion failure in GItemView::mouse_up() 2020-01-11 22:12:36 +01:00
Andreas Kling
d2e49719c4 WindowServer: Use pledge() 2020-01-11 21:35:01 +01:00
Andreas Kling
0ad491a854 ProtocolServer: Use pledge() 2020-01-11 21:35:01 +01:00
Andreas Kling
1c755d848e SystemServer: Use pledge() 2020-01-11 21:35:01 +01:00
Andreas Kling
a84aac86b1 AudioServer: Use pledge() 2020-01-11 21:35:01 +01:00
Andreas Kling
5f5791cac8 TTYServer: Use pledge() 2020-01-11 21:35:01 +01:00
Andreas Kling
7b6b1bae02 MenuApplets: Use pledge() 2020-01-11 21:33:12 +01:00