Commit graph

6104 commits

Author SHA1 Message Date
Andreas Kling
de69f84868 Kernel: Remove SmapDisablers in fchmod() and fchown() 2020-01-10 14:20:14 +01:00
Andreas Kling
b1ffde6199 Kernel: unlink() should not follow symlinks 2020-01-10 14:07:36 +01:00
Andreas Kling
f026f0f4bb rm: When invoked on a symlink, remove the symlink itself 2020-01-10 14:02:52 +01:00
Andreas Kling
8f20b173fd LibC: Remove useless retry loop in connect_to_lookup_server() 2020-01-10 13:52:20 +01:00
Andreas Kling
7380c8ec6e TmpFS: Synthesize "." and ".." in traverse_as_directory()
As Sergey pointed out, it's silly to have proper entries for . and ..
in TmpFS when we can just synthesize them on the fly.

Note that we have to tolerate removal of . and .. via remove_child()
to keep VFS::rmdir() happy.
2020-01-10 13:16:55 +01:00
Andreas Kling
952bb95baa Kernel: Enable SMAP protection during the execve() syscall
The userspace execve() wrapper now measures all the strings and puts
them in a neat and tidy structure on the stack.

This way we know exactly how much to copy in the kernel, and we don't
have to use the SMAP-violating validate_read_str(). :^)
2020-01-10 12:20:36 +01:00
Andreas Kling
bf9f36bf22 SystemServer: Expose service socket permissions to RPC clients 2020-01-10 10:57:33 +01:00
Andreas Kling
59bfbed2e2 ProcFS: Don't expose kernel-only regions to users via /proc/PID/vm
The superuser is still allowed to see them, but kernel-only VM regions
are now excluded from /proc/PID/vm.
2020-01-10 10:57:33 +01:00
Andreas Kling
62c45850e1 Kernel: Page allocation should not use memset_user() when zeroing
We're not zeroing new pages through a userspace address, so this should
not use memset_user().
2020-01-10 10:57:33 +01:00
Andreas Kling
197e73ee31 Kernel+LibELF: Enable SMAP protection during non-syscall exec()
When loading a new executable, we now map the ELF image in kernel-only
memory and parse it there. Then we use copy_to_user() when initializing
writable regions with data from the executable.

Note that the exec() syscall still disables SMAP protection and will
require additional work. This patch only affects kernel-originated
process spawns.
2020-01-10 10:57:06 +01:00
Andreas Kling
66b0002acb Base: Let's make home directories 700 to keep things private :^) 2020-01-09 21:57:52 +01:00
Andreas Kling
41d5f5c3b5 ls: Widen the user and group fields a little bit
I didn't like looking at /tmp/portal now that lookup:lookup owns one
of the sockets there :^)
2020-01-09 21:43:21 +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
Andreas Kling
f3dad64a3b LibC: Fail name lookups immediately if we can't connect to LookupServer 2020-01-09 21:33:03 +01:00
Andreas Kling
a9e3575a18 Kernel: Don't apply process umask to the LocalSocket prebind mode 2020-01-09 21:32:11 +01:00
Andreas Kling
0596ab880e Kernel: connect() should EISCONN on already-connected LocalSocket
This was causing us to try and accept the same client socket multiple
times on the server side, tripping an assertion in Socket::accept().
2020-01-09 21:30:56 +01:00
Dov Alperin
21517f693d Build: Add fast build mode that does not clean everything or run tests
Passing the "-f" or "--fast" option to the ./makeall.sh script will
build everything without cleaning first, and then will skip tests.
2020-01-09 18:07:21 +01:00
Andreas Kling
ff16298b44 Kernel: Removed an unused global variable 2020-01-09 18:02:37 +01:00
Andreas Kling
17ef5bc0ac Kernel: Rename {ss,esp}_if_crossRing to userspace_{ss,esp}
These were always so awkwardly named.
2020-01-09 18:02:01 +01:00
Andreas Kling
f007a63b10 Kernel: Prune a bunch of removed syscalls from the list 2020-01-09 16:25:35 +01:00
Andreas Kling
673d789c39 Kernel: Make some static keyboard data const
This moves it to the kernel's .rodata section which we write protect in
MemoryManager initialization.
2020-01-09 16:23:45 +01:00
Andreas Kling
4b4d369c5d Kernel: Take path+length in the unlink() and umount() syscalls 2020-01-09 16:23:41 +01:00
Andreas Kling
76c20642f0 Kernel: Ignore closed fd's when considering select() unblock
This fixes a null RefPtr deref (which asserts) in the scheduler if a
file descriptor being select()'ed is closed by a second thread while
blocked in select().

Test: Kernel/null-deref-close-during-select.cpp
2020-01-09 12:36:42 +01:00
Andreas Kling
e23f05a157 Kernel: Remove unused variable Thread::m_userspace_stack_region 2020-01-09 12:31:18 +01:00
Andrew Kaster
c21f384d17 LibELF: Remove DynamicSection from ELFImage
Since ELFDynamicObject needs the actual virtual address of the .dynamic
section in the loaded image, and not the file offset like we assumed
before, due to MAP_PRIVATE secretly giving us a MAP_SHARED, we can
remove all of the Dynamic* code from ELFImage.

ELFDynamicLoader only needs ELFImage to get the Program headers at this
point. More consolidation opportunities seem likely in the future.
2020-01-09 09:29:36 +01:00
Andrew Kaster
2e349337d3 LibELF: Map .text segment with MAP_ANONYMOUS for shared objects
We need to workaround the fact that MAP_PRIVATE when passed a file
descriptor doesn't work the way we expect. We can't change the
permissions on our mmap to PROT_WRITE if the original executable doesn't
have PROT_WRITE.

Because of this, we need to construct our ELFDynamicObject using the
actual virtual address of the .dynamic section, instead of using the
offset into the ELFImage that was actually getting modified by accident
...somehow. Not clear what was going on.
2020-01-09 09:29:36 +01:00
Andrew Kaster
e594724b01 Kernel: mmap(..., MAP_PRIVATE, fd, offset) is not supported
Make mmap return -ENOTSUP in this case to make sure users don't get
confused and think they're using a private mapping when it's actually
shared. It's currenlty not possible to open a file and mmap it
MAP_PRIVATE, and change the perms of the private mapping to ones that
don't match the permissions of the underlying file.
2020-01-09 09:29:36 +01:00
Andreas Kling
56974f76be LibVT: Relayout TerminalWidget on font change
We were not recomputing the internal dimensions after a font changed,
which caused things to look very off.

It's still not perfect as we're always using the same (small) font for
bold text, which obviously sticks out like a sore pinky when the rest
of the terminal text is large.
2020-01-08 21:12:40 +01:00
Andreas Kling
53e204dfb0 Terminal: Put the Font menu items in an action group :^) 2020-01-08 21:12:40 +01:00
Andreas Kling
7ba7d88fba SystemMonitor: Put the Frequency menu items in an action group
This makes them look like radio buttons in the menu, which is a very
nice increase in polish. :^)
2020-01-08 21:12:40 +01:00
Andreas Kling
463ed77024 WindowServer+LibGUI: Paint exclusive actions as radio buttons in menus
Actions that are checkable and members of a GActionGroup will now be
painted with a radio button appearance in menus.
2020-01-08 21:12:40 +01:00
Andreas Kling
cc8c26c39b LibDraw+LibGUI: Move radio button painting into StylePainter
This will allow WindowServer to draw radio buttons :^)
2020-01-08 21:12:40 +01:00
Andreas Kling
6c549959c6 disk_benchmark: Unbreak this utility now that read() of O_WRONLY fails 2020-01-08 21:12:40 +01:00
Dov Alperin
dacec1a7ee Meta: Reference CodingStyle doc in CONTRIBUTING.md 2020-01-08 19:41:20 +01:00
Andreas Kling
aac17fc81a IPv4: Randomize the first TCP sequence number
Fixes #185.
2020-01-08 16:03:01 +01:00
Andreas Kling
03c34cc73f LibC: Don't leave /etc/passwd open in getlogin() 2020-01-08 16:01:51 +01:00
Andreas Kling
e1d4b19461 Kernel: open() and openat() should ignore non-permission bits in mode 2020-01-08 15:21:06 +01:00
Andreas Kling
d310cf3b49 Kernel: Opening a file with O_TRUNC should update mtime 2020-01-08 15:21:06 +01:00
Andreas Kling
e485667201 Kernel: ftruncate() should update mtime 2020-01-08 15:21:06 +01:00
Andreas Kling
1f6c624a1a truncate: Unbreak this utility after ftruncate() syscall fixes 2020-01-08 15:21:06 +01:00
Andreas Kling
532f240f24 Kernel: Remove unused syscall for setting the signal mask 2020-01-08 15:21:06 +01:00
Andreas Kling
200459d644 Kernel: Fix SMAP violation in join_thread() 2020-01-08 15:21:05 +01:00
Dov Alperin
518f469970 LibGUI: clicking and dragging one item will drag other items in selection
Previously if more than one item was selected clicking on one of
them and dragging would de-select everything that is not the one that
was clicked on. Now, if more than one items are selected and there
is a mousedown it goes into a "mightdrag" state.
The user can then perform a drag, if they don't everything that is not
the item being clicked gets unselected in the mouseup event, mimicking
the previous behavior.
2020-01-08 15:20:41 +01:00
Dov Alperin
e0c959ea7f LibGUI: separate file names with commas in the drag operation text 2020-01-08 15:20:41 +01:00
Andreas Kling
8ddd053c2a WindowServer: Detach WSMenuManager from WSWindowManager
You can now get to the WSMenuManager via WSMenuManager::the().
Also note that it's initialized after WSWindowManager.
2020-01-08 13:26:19 +01:00
Andreas Kling
2d75396c94 About: Focus the button on startup 2020-01-08 13:14:39 +01:00
Andreas Kling
50fa759806 Revert "WSWindowServer: Remove uneccessary special casing"
This reverts commit 0c1bc91e88.

It turns out this is what made it possible to hover "between" different
menus after opening one of them with a click.
2020-01-08 13:13:36 +01:00
Andreas Kling
fe1bf067b8 ProcFS: Reads past the end of a generated file should be zero-length 2020-01-08 12:59:06 +01:00
Andreas Kling
28ee5b0e98 TmpFS: Reads past the end of a file should be zero-length 2020-01-08 12:47:41 +01:00