summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2021-01-07Userland: Include hard link count in "ls -l" outputNico Weber
2021-01-04Everywhere: Use GUI::CommonActions::make_about_action()Andreas Kling
2021-01-04crash: Remove -x and -y which do not crash (write to / read from freed memory)Linus Groh
These do not crash the process anymore. Fixes #4685.
2021-01-03LibCore: Report error condition when reading process statistics failedTom
2021-01-03Userland: Add gml-formatLinus Groh
TL;DR: Like clang-format but for GML files :^) It takes a list of files (or reads from standard input if none is given), formats them and prints the result to standard output or writes back to the file when using the -i/--inplace option.
2021-01-03Kernel+Loader.so: Allow dynamic executables without an interpreterWilliam Marlow
Commit a3a9016701e487a5ca92d83b8cff179a190cdeb2 removed the PT_INTERP header from Loader.so which cleaned up some kernel code in execve. Unfortunately it prevents Loader.so from being run as an executable
2021-01-03ls: Use Core::File::real_path_for()Andreas Kling
2021-01-03Loader.so+LibELF: Move most of Loader.so's logic into ELF::DynamicLinkerWilliam Marlow
Loader.so now just performs the initial self relocations and static LibC initialisation before handing over to ELF::DynamicLinker::linker_main to handle the rest of the process. As a trade-off, ELF::DynamicLinker needs to be explicitly excluded from Lagom unless we really want to try writing a cross platform dynamic loader
2021-01-02Build + LibC: Enable -fstack-protector-strong in user spaceBrian Gianforcaro
Modify the user mode runtime to insert stack canaries to find stack corruptions. The `-fstack-protector-strong` variant was chosen because it catches more issues than vanilla `-fstack-protector`, but doesn't have substantial performance impact like `-fstack-protector-all`. Details: -fstack-protector enables stack protection for vulnerable functions that contain: * A character array larger than 8 bytes. * An 8-bit integer array larger than 8 bytes. * A call to alloca() with either a variable size or a constant size bigger than 8 bytes. -fstack-protector-strong enables stack protection for vulnerable functions that contain: * An array of any size and type. * A call to alloca(). * A local variable that has its address taken. Example of it catching corrupting in the `stack-smash` test: ``` courage ~ $ ./user/Tests/LibC/stack-smash [+] Starting the stack smash ... Error: Stack protector failure, stack smashing detected! Shell: Job 1 (/usr/Tests/LibC/stack-smash) Aborted ```
2021-01-02AK: Remove redundant compare() functions.asynts
2021-01-01LibThread: Improve semantics of Thread::join, and remove Thread::quit.Andrew Kaster
Thread::quit was created before the pthread_create_helper in pthread.cpp that automagically calls pthread_exit from all pthreads after the user's thread function exits. It is unused, and unecessary now. Cleanup some logging, and make join return a Result<T, ThreadError>. This also adds a new type, LibThread::ThreadError as an AK::DistinctNumeric. Hopefully, this will make it possible to have a Result<int, ThreadError> and have it compile? It also makes it clear that the int there is an error at the call site. By default, the T on join is void, meaning the caller doesn't care about the return value from the thread. As Result is a [[nodiscard]] type, also change the current caller of join to explicitly ignore it. Move the logging out of join as well, as it's the user's responsibility whether to log or not.
2021-01-01LibJS: Remove hand-rolled Object is_foo() helpers in favor of RTTIAndreas Kling
2021-01-01Meta: Enable RTTI for Userspace programsAndrew Kaster
RTTI is still disabled for the Kernel, and for the Dynamic Loader. This allows for much less awkward navigation of class heirarchies in LibCore, LibGUI, LibWeb, and LibJS (eventually). Measured RootFS size increase was < 1%, and libgui.so binary size was ~3.3%. The small binary size increase here seems worth it :^)
2021-01-01DynamicLoader: Tell the linker to not add a PT_INTERP headerAndrew Kaster
Use the GNU LD option --no-dynamic-linker. This allows uncommenting some code in the Kernel that gets upset if your ELF interpreter has its own interpreter.
2020-12-31LibGfx: Introduce provisional font interfaceStephan Unverwerth
Old font functionality has been moved into BitmapFont and an abstract Font interface has been introduced to faciliate further development of TTF font integration.
2020-12-31Everywhere: Re-format with clang-format-11Linus Groh
Compared to version 10 this fixes a bunch of formatting issues, mostly around structs/classes with attributes like [[gnu::packed]], and incorrect insertion of spaces in parameter types ("T &"/"T &&"). I also removed a bunch of // clang-format off/on and FIXME comments that are no longer relevant - on the other hand it tried to destroy a couple of neatly formatted comments, so I had to add some as well.
2020-12-31DynamicLoader: Handle Loader.so being invoked directly as an executableWilliam Marlow
Loader.so is an actual executable, as well as the interpreter for dynamic libraries. Currently launching Loader.so as a standalone executable results in an obsucre crash as it tries to load itself over itself. Now we at least print a helpful message saying that you're doing the wrong thing and exit gracefully. In future we may wish to allow users to specify additional options to learn more about what's going on during dynamic linking, such as ld-linux.so.2 on Linux.
2020-12-30LibGFX: Move default_xxx_font() methods from Font to FontDatabaseStephan Unverwerth
When we have an abstract font class it makes no sense to keep these methods in the Font class.
2020-12-30ProtocolServer: Stream the downloaded data if possibleAnotherTest
This patchset makes ProtocolServer stream the downloads to its client (LibProtocol), and as such changes the download API; a possible download lifecycle could be as such: notation = client->server:'>', server->client:'<', pipe activity:'*' ``` > StartDownload(GET, url, headers, {}) < Response(0, fd 8) * {data, 1024b} < HeadersBecameAvailable(0, response_headers, 200) < DownloadProgress(0, 4K, 1024) * {data, 1024b} * {data, 1024b} < DownloadProgress(0, 4K, 2048) * {data, 1024b} < DownloadProgress(0, 4K, 1024) < DownloadFinished(0, true, 4K) ``` Since managing the received file descriptor is a pain, LibProtocol implements `Download::stream_into(OutputStream)`, which can be used to stream the download into any given output stream (be it a file, or memory, or writing stuff with a delay, etc.). Also, as some of the users of this API require all the downloaded data upfront, LibProtocol also implements `set_should_buffer_all_input()`, which causes the download instance to buffer all the data until the download is complete, and to call the `on_buffered_download_finish` hook.
2020-12-30pro: Add support for sending POST requests and custom headersAnotherTest
2020-12-29Userland: Make `test' accept single-digit negative numbersAnotherTest
2020-12-29Userland: Add readelf utilityBrendan Coles
2020-12-28AK/Userland: Use AK/Endian.h for portable byte swapping in ntpqueryAndrew Kaster
Create macros for the byte swap operations one would expect to be in endian.h or byteswap.h in AK/Endian.h. It's likely a similar/different change will be needed for BSDs, but there's no github action for those added to the project yet.
2020-12-27Kernel: Remove the per-process icon_id and sys$set_process_icon()Andreas Kling
This was a goofy kernel API where you could assign an icon_id (int) to a process which referred to a global shbuf with a 16x16 icon bitmap inside it. Instead of this, programs that want to display a process icon now retrieve it from the process executable instead.
2020-12-27paste: Don't read past clipboard data buffer sizeLinus Groh
ByteBuffer is not null-terminated (anymore), this is another one of those bugs. Also use the new format functions while we're here. Fixes #4558.
2020-12-26Kernel: Implement unveil() as a prefix-treeAnotherTest
Fixes #4530.
2020-12-26LibC: Fix some incorrect printf usagesSahan Fernando
2020-12-25AK: Remove custom %b format string specifierAndreas Kling
This was a non-standard specifier alias for %02x. This patch replaces all uses of it with new-style formatting functions instead.
2020-12-25LibELF: Move AuxiliaryValue into the ELF namespaceAndreas Kling
2020-12-25LibELF: Remove ELF::Loader and move everyone to ELF::ImageAndreas Kling
This commit gets rid of ELF::Loader entirely since its very ambiguous purpose was actually to load executables for the kernel, and that is now handled by the kernel itself. This patch includes some drive-by cleanup in LibDebug and CrashDaemon enabled by the fact that we no longer need to keep the ref-counted ELF::Loader around.
2020-12-24Toolchain+LibC: Fix usage of crt filesItamar
We now configure the gcc spec files to use a different crt files for static & PIE binaries. This relieves us from the need to explicitly specify the desired crt0 file in cmake scripts.
2020-12-24Loader: Support loading non-position independent executablesItamar
2020-12-24DynamicLoader: Call libc's exit when exitting, to flush standard streamsSahan Fernando
2020-12-24Userland: Make grep exit after hitting EOF on stdinSahan Fernando
2020-12-24Userland: Add strace parameter for output log fileSahan Fernando
2020-12-24Userland: Add pmap utilityBrendan Coles
2020-12-24open: Mention full URL in 'Failed to open' error messageLinus Groh
Just showing the URL's path is confusing, that would show '/' for something like foo://bar.
2020-12-24open: Handle file:// URLs properlyLinus Groh
open(1) was able to handle most URLs as well as paths, but not file:// URLs (which occur when dragging something from the output of ls, for example). We have to create an URL from the user-supplied argument using create_with_url_or_path(), check whether it's a file:// URL or not and *then* use real_path_for() on the URL's path().
2020-12-24open: Remove extraneous newline from error outputLinus Groh
This wasn't removed when fprintf was replaced by warnln.
2020-12-23cp: Don't copy the set-uid or set-gid bitsAndreas Kling
Also simplify the file copying logic a bit to avoid two syscalls per file. We now create the file with the right mode right away instead of creating it first, and then fchmod'ing it later. Fixes #4479.
2020-12-22LibCore: Rename identifiers that can clash with libc macros (#4127)ร‰rico Nogueira Rolim
POSIX allows the default streams (stdin, stdout and stderr) to be macros, which means that on such systems (musl libc is one) building Lagom will fail due to the File::std*() names. Also fix any files that use these identifiers.
2020-12-21Kernel: Improve time keeping and dramatically reduce interrupt loadTom
This implements a number of changes related to time: * If a HPET is present, it is now used only as a system timer, unless the Local APIC timer is used (in which case the HPET timer will not trigger any interrupts at all). * If a HPET is present, the current time can now be as accurate as the chip can be, independently from the system timer. We now query the HPET main counter for the current time in CPU #0's system timer interrupt, and use that as a base line. If a high precision time is queried, that base line is used in combination with quering the HPET timer directly, which should give a much more accurate time stamp at the expense of more overhead. For faster time stamps, the more coarse value based on the last interrupt will be returned. This also means that any missed interrupts should not cause the time to drift. * The default system interrupt rate is reduced to about 250 per second. * Fix calculation of Thread CPU usage by using the amount of ticks they used rather than the number of times a context switch happened. * Implement CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE and use it for most cases where precise timestamps are not needed.
2020-12-21Userland: userdel: Resolve home directory realpath before removalBrendan Coles
2020-12-21Userland: useradd: Add command line option to set user passwordBrendan Coles
2020-12-21Everywhere: Switch from (void) to [[maybe_unused]] (#4473)Lenny Maiorani
Problem: - `(void)` simply casts the expression to void. This is understood to indicate that it is ignored, but this is really a compiler trick to get the compiler to not generate a warning. Solution: - Use the `[[maybe_unused]]` attribute to indicate the value is unused. Note: - Functions taking a `(void)` argument list have also been changed to `()` because this is not needed and shows up in the same grep command.
2020-12-19LibTLS+Userland: Remove all uses of ByteBuffer::slice_view()Andreas Kling
This was another way to get a non-owning ByteBuffer wrapper.
2020-12-19LibTLS+LibCrypto: Remove all remaining uses of ByteBuffer::wrap()Andreas Kling
2020-12-19LibCrypto: Yet more ByteBuffer::wrap() removal. Not much left now!Andreas Kling
2020-12-19LibTLS: Even more ByteBuffer -> Span conversionAndreas Kling
2020-12-19LibTLS+LibCrypto: More ByteBuffer -> Span conversionAndreas Kling