summaryrefslogtreecommitdiff
path: root/Libraries
AgeCommit message (Collapse)Author
2020-01-12Kernel+LibC: Allow passing mount flags to chroot()Sergey Bugaev
Since a chroot is in many ways similar to a separate root mount, we can also apply mount flags to it as if it was an actual mount. These flags will apply whenever the chrooted process accesses its root directory, but not when other processes access this same directory for the outside. Since it's common to chdir("/") immediately after chrooting (so that files accessed through the current directory inherit the same mount flags), this effectively allows one to apply additional limitations to a process confined inside a chroot. To this effect, sys$chroot() gains a mount_flags argument (exposed as chroot_with_mount_flags() in userspace) which can be set to all the same values as the flags argument for sys$mount(), and additionally to -1 to keep the flags set for that file system. Note that passing 0 as mount_flags will unset any flags that may have been set for the file system, not keep them.
2020-01-12LibDraw: Remove debug spam about loading system themesAndreas Kling
2020-01-12TextEditor: Implement replacement functionality0xtechnobabble
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-11LibGUI: Fix assertion failure in GItemView::mouse_up()Andreas Kling
2020-01-11SystemMonitor+LibCore: Show process pledges in SystemMonitor :^)Andreas Kling
2020-01-11Kernel: Add pledge() syscall :^)Andreas Kling
This patch implements basic support for OpenBSD-style pledge(). pledge() allows programs to incrementally reduce their set of allowed syscalls, which are divided into categories that each make up a subset of POSIX functionality. If a process violates one of its pledged promises by attempting to call a syscall that it previously said it wouldn't call, the process is immediately terminated with an uncatchable SIGABRT. This is by no means complete, and we'll need to add more checks in various places to ensure that promises are being kept. But it is pretty cool! :^)
2020-01-11Kernel+LibC: Implement a few mount flagsSergey Bugaev
We now support these mount flags: * MS_NODEV: disallow opening any devices from this file system * MS_NOEXEC: disallow executing any executables from this file system * MS_NOSUID: ignore set-user-id bits on executables from this file system The fourth flag, MS_BIND, is defined, but currently ignored.
2020-01-11Kernel+LibC: Add O_EXEC, move exec permission checking to VFS::open()Sergey Bugaev
O_EXEC is mentioned by POSIX, so let's have it. Currently, it is only used inside the kernel to ensure the process has the right permissions when opening an executable.
2020-01-11Kernel+LibC: Add support for mount flagsSergey Bugaev
At the moment, the actual flags are ignored, but we correctly propagate them all the way from the original mount() syscall to each custody that resides on the mounted FS.
2020-01-11LibPthread: Fix incompatible pthread_setname_np(), pthread_getname_np()Andreas Kling
Other implementations of pthread_setname_np() do not take the name length as an argument. For pthread_getname_np(), other implementations take the buffer size as a size_t. This patch brings us in line with other implementations.
2020-01-11Kernel: Use the Syscall string and buffer types moreAndreas Kling
While I was updating syscalls to stop passing null-terminated strings, I added some helpful struct types: - StringArgument { const char*; size_t; } - ImmutableBuffer<Data, Size> { const Data*; Size; } - MutableBuffer<Data, Size> { Data*; Size; } The Process class has some convenience functions for validating and optionally extracting the contents from these structs: - get_syscall_path_argument(StringArgument) - validate_and_copy_string_from_user(StringArgument) - validate(ImmutableBuffer) - validate(MutableBuffer) There's still so much code around this and I'm wondering if we should generate most of it instead. Possible nice little project.
2020-01-11Kernel: Pass a parameter struct to mount()Andreas Kling
This was the last remaining syscall that took a null-terminated string and figured out how long it was by walking it in kernelspace *shudder*.
2020-01-11Kernel: Pass a parameter struct to rename()Andreas Kling
2020-01-11Kernel: Pass a parameter struct to symlink()Andreas Kling
2020-01-11Kernel: Pass a parameter struct to mknod()Andreas Kling
2020-01-11Kernel: Pass a parameter struct to chown()Andreas Kling
2020-01-10Kernel: Add a basic chroot() syscall :^)Andreas Kling
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-10Kernel: Pass characters+length to link()Andreas Kling
2020-01-10Kernel: Rename Syscall::SyscallString => Syscall::StringArgumentAndreas Kling
2020-01-10Kernel: Pass characters+length to readlink()Andreas Kling
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-10LibGUI: Fix rendering GColumnsView separatorAndreas Kling
Patch by Sergey Bugaev.
2020-01-10LibGUI: Add GColumnsViewSergey Bugaev
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-10LibGUI+FileManager: Misc tweaks courtesy of clang-formatSergey Bugaev
2020-01-10LibGUI+FileManager: Merge GDirectoryModel into GFileSystemModelSergey Bugaev
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-10LibGUI: Add GAbstractView::activate_selected()Sergey Bugaev
This is a nice little utility to activate all the selected items, which is what you usually want to do.
2020-01-10LibGUI: Fix GModel::is_valid() behavior for tree-like modelsSergey Bugaev
2020-01-10LibGUI: Fix tree view column positioning when some columns are hiddenSergey Bugaev
2020-01-10LibC: Remove useless retry loop in connect_to_lookup_server()Andreas Kling
2020-01-10Kernel: Enable SMAP protection during the execve() syscallAndreas Kling
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-10Kernel+LibELF: Enable SMAP protection during non-syscall exec()Andreas Kling
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-09LibC: Fail name lookups immediately if we can't connect to LookupServerAndreas Kling
2020-01-09Kernel: Take path+length in the unlink() and umount() syscallsAndreas Kling
2020-01-09LibELF: Remove DynamicSection from ELFImageAndrew Kaster
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-09LibELF: Map .text segment with MAP_ANONYMOUS for shared objectsAndrew Kaster
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-08LibVT: Relayout TerminalWidget on font changeAndreas Kling
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-08WindowServer+LibGUI: Paint exclusive actions as radio buttons in menusAndreas Kling
Actions that are checkable and members of a GActionGroup will now be painted with a radio button appearance in menus.
2020-01-08LibDraw+LibGUI: Move radio button painting into StylePainterAndreas Kling
This will allow WindowServer to draw radio buttons :^)
2020-01-08LibC: Don't leave /etc/passwd open in getlogin()Andreas Kling
2020-01-08LibGUI: clicking and dragging one item will drag other items in selectionDov Alperin
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-08LibGUI: separate file names with commas in the drag operation textDov Alperin
2020-01-07LibGUI: Preserve existing GItemView selection on rubber band (#1031)DAlperin
2020-01-07LibC: Add MAP_FILE for mmap()Andreas Kling
2020-01-07LibGUI: Run clang-format on GModel.h to neaten up some formattingConrad Pankoff
2020-01-07LibCore: Fix a typo in CConfigFile.hConrad Pankoff
2020-01-07GAbstractView: Add function for adding all to selectionShannon Booth
2020-01-07LibDraw: Add support for parsing #RGBA colorsN00byEdge
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-07Themes: Support rubberband selection theming0xtechnobabble
2020-01-06Kernel+LibELF: Validate PT_LOAD and PT_TLS offsets before memcpy()'ingAndreas Kling
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-06LibC: Remove thread-specific TID cacheAndreas Kling
As Sergey pointed out forever ago, this value is wrong after fork().
2020-01-06Kernel: Make utime() take path+length, remove SmapDisablerAndreas Kling