Commit Graph

1199 Commits

Author SHA1 Message Date
Andreas Kling
c97bfbd609 Kernel: Pass a parameter struct to mknod() 2020-01-11 10:27:37 +01:00
Andreas Kling
6536a80aa9 Kernel: Pass a parameter struct to chown() 2020-01-11 10:17:44 +01:00
Andreas Kling
ddd0b19281 Kernel: Add a basic chroot() syscall :^)
The chroot() syscall now allows the superuser to isolate a process into
a specific subtree of the filesystem. This is not strictly permanent,
as it is also possible for a superuser to break *out* of a chroot, but
it is a useful mechanism for isolating unprivileged processes.

The VFS now uses the current process's root_directory() as the root for
path resolution purposes. The root directory is stored as an uncached
Custody in the Process object.
2020-01-10 23:14:04 +01:00
Andreas Kling
485443bfca Kernel: Pass characters+length to link() 2020-01-10 21:26:47 +01:00
Andreas Kling
416c7ac2b5 Kernel: Rename Syscall::SyscallString => Syscall::StringArgument 2020-01-10 20:16:18 +01:00
Andreas Kling
0695ff8282 Kernel: Pass characters+length to readlink()
Note that I'm developing some helper types in the Syscall namespace as
I go here. Once I settle on some nice types, I will convert all the
other syscalls to use them as well.
2020-01-10 20:13:23 +01:00
Andreas Kling
6a529ea425 LibGUI: Fix rendering GColumnsView separator
Patch by Sergey Bugaev.
2020-01-10 18:25:44 +01:00
Sergey Bugaev
edb61d8bfd LibGUI: Add GColumnsView
This is a shiny new widget that can display a tree using Miller columns ^:)

In many cases, the columns view can be used as an alternative to tree view,
but it has its own set of limitations:

* It can only display one model column (so it cannot replace a table)
* It takes up a lot of horizontal space, so it's only suitable if the item text
  is fairly short
* It can only display one subtree at a time

But as long as a usecase doesn't suffer from these limitations, a columns view
can be *much* more intuitive than a tree view.
2020-01-10 17:45:59 +01:00
Sergey Bugaev
10324f95b0 LibGUI+FileManager: Misc tweaks courtesy of clang-format 2020-01-10 17:45:59 +01:00
Sergey Bugaev
fdeb91e000 LibGUI+FileManager: Merge GDirectoryModel into GFileSystemModel
We used to have two different models for displaying file system contents:
the FileManager-grade table-like directory model, which exposed rich data
(such as file icons with integrated image previews) about contents of a
single directory, and the tree-like GFileSystemModel, which only exposed
a tree of file names with very basic info about them.

This commit unifies the two. The new GFileSystemModel can be used both as a
tree-like and as a table-like model, or in fact in both ways simultaneously.
It exposes rich data about a file system subtree rooted at the given root.

The users of the two previous models are all ported to use this new model.
2020-01-10 17:45:59 +01:00
Sergey Bugaev
0f18a16e2c LibGUI: Add GAbstractView::activate_selected()
This is a nice little utility to activate all the selected items,
which is what you usually want to do.
2020-01-10 17:45:59 +01:00
Sergey Bugaev
caa08938e5 LibGUI: Fix GModel::is_valid() behavior for tree-like models 2020-01-10 17:45:59 +01:00
Sergey Bugaev
303fa75d36 LibGUI: Fix tree view column positioning when some columns are hidden 2020-01-10 17:45:59 +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
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
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
f3dad64a3b LibC: Fail name lookups immediately if we can't connect to LookupServer 2020-01-09 21:33:03 +01:00
Andreas Kling
4b4d369c5d Kernel: Take path+length in the unlink() and umount() syscalls 2020-01-09 16:23:41 +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
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
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
03c34cc73f LibC: Don't leave /etc/passwd open in getlogin() 2020-01-08 16:01:51 +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
DAlperin
dcc4704fb5 LibGUI: Preserve existing GItemView selection on rubber band (#1031) 2020-01-07 16:18:12 +01:00
Andreas Kling
a47f3031ae LibC: Add MAP_FILE for mmap() 2020-01-07 15:35:41 +01:00
Conrad Pankoff
0e7cee58c0 LibGUI: Run clang-format on GModel.h to neaten up some formatting 2020-01-07 12:46:22 +01:00
Conrad Pankoff
84f0be37f0 LibCore: Fix a typo in CConfigFile.h 2020-01-07 12:46:02 +01:00
Shannon Booth
7cf15bcb75 GAbstractView: Add function for adding all to selection 2020-01-07 11:06:27 +01:00
N00byEdge
00596296c4 LibDraw: Add support for parsing #RGBA colors
This was the nicest way of making this happen, I think.
Fitting it into the 4 length function ended up becoming too hard to read.

Closes #1027
2020-01-07 11:03:35 +01:00
0xtechnobabble
123dcada05 Themes: Support rubberband selection theming 2020-01-07 11:02:43 +01:00
Andreas Kling
78a63930cc Kernel+LibELF: Validate PT_LOAD and PT_TLS offsets before memcpy()'ing
Before this, you could make the kernel copy memory from anywhere by
setting up an ELF executable with a program header specifying file
offsets outside the file.

Since ELFImage didn't even know how large it was, we had no clue that
we were copying things from outside the ELF.

Fix this by adding a size field to ELFImage and validating program
header ranges before memcpy()'ing to them.

The ELF code is definitely going to need more validation and checking.
2020-01-06 21:04:57 +01:00
Andreas Kling
9bf1fe9439 LibC: Remove thread-specific TID cache
As Sergey pointed out forever ago, this value is wrong after fork().
2020-01-06 14:39:52 +01:00
Andreas Kling
53bda09d15 Kernel: Make utime() take path+length, remove SmapDisabler 2020-01-06 12:23:30 +01:00
Andreas Kling
a47f0c93de Kernel: Pass name+length to mmap() and remove SmapDisabler 2020-01-06 12:04:55 +01:00
Andreas Kling
33025a8049 Kernel: Pass name+length to set_mmap_name() and remove SmapDisabler 2020-01-06 11:56:59 +01:00
Andreas Kling
7c916b9fe9 Kernel: Make realpath() take path+length, get rid of SmapDisabler 2020-01-06 11:32:25 +01:00
Andreas Kling
d6b06fd5a3 Kernel: Make watch_file() syscall take path length as a size_t
We don't care to handle negative path lengths anyway.
2020-01-06 11:15:49 +01:00
Andreas Kling
0df72d4712 Kernel: Pass path+length to mkdir(), rmdir() and chmod() 2020-01-06 11:15:49 +01:00
Andreas Kling
53d3b6b0a7 LibC: Make the syscall wrappers for stat/lstat/chdir return EFAULT
If we pass a null path to these syscall wrappers, just return EFAULT
directly from the wrapper instead of segfaulting by calling strlen().
This is a compromise, since we now have to pass the path length to the
kernel, so we can't rely on the kernel to tell us that the path is at
a bad memory address.
2020-01-06 11:15:49 +01:00
Andreas Kling
642137f014 Kernel: Make access() take path+length
Also, let's return EFAULT for nullptr at the LibC layer. We can't do
all bad addresses this way, but we can at least do null. :^)
2020-01-06 11:15:48 +01:00
Shannon Booth
47276a09dd LibC: Remove dubious String ends_with usage
As mentioned in #917, the String destructor could potentially be
clobbering the errno. Use memcpy so that we do not need String at all.
2020-01-06 10:43:00 +01:00
Shannon Booth
d4fa8e4b00 AK+Demos+Libraries: Remove executable permissions from {.cpp,.h} files 2020-01-06 10:43:00 +01:00
Andreas Kling
c5890afc8b Kernel: Make chdir() take path+length 2020-01-05 22:06:25 +01:00
Andreas Kling
f231e9ea76 Kernel: Pass path+length to the stat() and lstat() syscalls
It's not pleasant having to deal with null-terminated strings as input
to syscalls, so let's get rid of them one by one.
2020-01-05 22:02:54 +01:00
Andreas Kling
04b734501a LibCore: Oops, we were forgetting to destroy disconnected RPC clients 2020-01-05 17:54:48 +01:00
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