Commit graph

15025 commits

Author SHA1 Message Date
Itamar
bbedd320b5 Toolchain+LibC: Fix usage of crt files
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-24 21:46:35 +01:00
Itamar
6990d62977 Ports: Tweak configuration flags of gcc port to support shared binaries 2020-12-24 21:46:35 +01:00
Itamar
a83a9f3a55 Loader: Support loading non-position independent executables 2020-12-24 21:46:35 +01:00
Itamar
0cb636078a Kernel+LibELF: Allow Non ET_DYN executables to have an interpreter 2020-12-24 21:34:51 +01:00
Itamar
d64d0451e5 Kernel: Fix mmap with specific address for file backed mappings 2020-12-24 21:34:51 +01:00
Andreas Kling
79818bbf8e LibC: Unbreak assert.h when compiled with a C compiler :^) 2020-12-24 21:06:13 +01:00
Luke
6d4fd02b92 Meta: Set two minute timeout for CMake tests
CMake tests usually takes ~40 seconds. However, sometimes it deadlocks
and is only timed out after the 6 hour time limit.

Let's set a 2 minute timeout to make it fail sooner. 2 minutes instead
of 1 for good measure.
2020-12-24 21:05:25 +01:00
Lenny Maiorani
1db5276c05 Meta: Run all lint checks and report failures together
Problem:
- The first lint check that fails results in all subsequent checks not
  being run.

Solution:
- Run all the lint checks aggregating the number of failures.
- Return a non-0 exit code if any have failed.
2020-12-24 21:00:35 +01:00
Luke
200c7572b7 LibJS: Implement Object.prototype.propertyIsEnumerable
Spec: https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable

This is used by core-js, which is used by frameworks such as Vue.
2020-12-24 21:00:28 +01:00
Lenny Maiorani
d46de3aeb4 Meta: Verify all AK test files are listed in CMake
Problem:
- It is possible for a new test file to be added to the `AK/Tests`
  directory without being added to the corresponding
  `CMakeLists.txt`. This results in the tests not being run.

Solution:
- As part of CI linting, verify that all the `AK/Tests/Test*.cpp`
  files are mentioned in the `CMakeLists.txt`.
2020-12-24 21:00:10 +01:00
Linus Groh
e5ac1fcd00 Base: Remove [Icons] section from .af files
With everything now using GUI::FileIconProvider and therefore loading
icons embedded in the executable files, this information is now longer
being used.
We might have to think about this again if we want to allow .af files
with custom commands (e.g. shell scripts). Maybe those could get away
with just an "Icon" entry under "[App]", but currently there's only
"Executable" anyway.
2020-12-24 20:50:30 +01:00
Linus Groh
0384eb41ae Taskbar: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Linus Groh
c670a2b52e SystemMenu: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Linus Groh
b53011a198 Terminal+LibVT: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Sahan Fernando
bcecd2fa2f DynamicLoader: Call libc's exit when exitting, to flush standard streams 2020-12-24 20:49:05 +01:00
Sahan Fernando
12f214e2f0 Userland: Make grep exit after hitting EOF on stdin 2020-12-24 20:48:54 +01:00
Sahan Fernando
3eeb00b003 Userland: Add strace parameter for output log file 2020-12-24 20:48:54 +01:00
Brendan Coles
b71edba06d Userland: Add pmap utility 2020-12-24 13:22:24 +01:00
Dan MacDonald
277c44c2dc Meta: Update install guide with link to hardware compatibility list 2020-12-24 11:02:43 +01:00
Lenny Maiorani
e4ce485309 CMake: Decouple cmake utility functions from top-level CMakeLists.txt
Problem:
- These utility functions are only used in `AK`, but are being defined
  in the top-level. This clutters the top-level.

Solution:
- Move the utility functions to `Meta/CMake/utils.cmake` and include
  where needed.
- Also, move `all_the_debug_macros.cmake` into `Meta/CMake` directory
  to consolidate the location of `*.cmake` script files.
2020-12-24 11:02:04 +01:00
Andreas Kling
6db224f020 Meta: Add Brendan Coles to the contributors list :^) 2020-12-24 10:47:36 +01:00
Brendan Coles
b156c5a8eb ProcFS: pid_vm: Replace duplicated purgeable key with kernel+cacheable
ProcFS /proc/<pid>/vm map info no longer contains two `purgeable` keys.

The second `purgeable` key has been removed and replaced with keys for
`kernel` and `cacheable`.
2020-12-24 10:26:39 +01:00
Linus Groh
0729c8ed65 LaunchServer: Ignore empty FileType / Protocol / [Launcher] config values
"Foo=" should be treated the same as "Foo" being missing.
2020-12-24 10:25:18 +01:00
Linus Groh
bed240d4b3 LaunchServer+Base: Stop using Browser as default protocol handler
Browser supports very few protocols (http, https, gemini, file) at the
moment, so there's no point in using it as a catch-all and default
protocol handler. I added an explicit association for gemini to
/bin/Browser instead.

This stops Desktop::Launcher::open() from reporting success for any URL,
which really isn't the case (Browser shows an error page...).
2020-12-24 10:25:18 +01:00
Linus Groh
af007ce126 open: Mention full URL in 'Failed to open' error message
Just showing the URL's path is confusing, that would show '/' for
something like foo://bar.
2020-12-24 10:25:18 +01:00
Linus Groh
5bb0bd8c6d open: Handle file:// URLs properly
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-24 10:25:18 +01:00
Linus Groh
46a12e32d3 open: Remove extraneous newline from error output
This wasn't removed when fprintf was replaced by warnln.
2020-12-24 10:25:18 +01:00
Lenny Maiorani
8e1af483be CMake: Remove file globbing in AK/Tests
Problem:
- File globbing is performed at the time of build system
  generation. Any files which are not there at that time are not
  included. So, when a new file is added it is not built unless the
  build system is recreated.

Solution:
- Remove globbing from AK/Tests directory in favor of explicitly
  listing the files.
2020-12-23 20:51:29 +01:00
Andreas Kling
51713901b1 Kernel: Tweak parameter name in Inode::read_entire()
This is a descriptION, not a descriptOR. :^)
2020-12-23 20:36:14 +01:00
Andreas Kling
1e21d49e86 Kernel: Fix wrong-looking overflow check in sys$execve()
This was harmless since sizeof(length) and sizeof(strings) are both 4
on x86 but let's check the right things regardless.
2020-12-23 20:34:22 +01:00
Andreas Kling
c6a0694f50 Kernel: Don't assert when reading from a listening-mode local socket
Instead just fail with EINVAL as a listening socket is never suitable
for reading from.

Fixes #4511.
2020-12-23 20:25:29 +01:00
Andreas Kling
80ae407d73 LibGfx: Always compute the DIB mask shifts and sizes if needed
The pixel decoding logic later on assumes that if we have DIB masks,
we also have shifts and sizes, so we should make sure they are
always computed.

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28237
2020-12-23 20:16:53 +01:00
Andreas Kling
cd046fae44 LibGfx: Fail JPEG decode instead of asserting on bogus start-of-scan
Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28628
2020-12-23 19:22:15 +01:00
Andreas Kling
0fc8561029 LibGfx: Catch integer overflows in PNG decoder and fail the decode
Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28134&sort=reported&q=serenity
2020-12-23 19:04:12 +01:00
Andreas Kling
491a5f5e34 LibGfx: Avoid a ByteBuffer heap allocation in PNG filtering 2020-12-23 18:06:25 +01:00
Andreas Kling
068615fe5e LibGfx: Reject PNG files with invalid filter/interlace methods
Might as well reject these when parsing the IHDR chunk instead of
continuing to load something invalid.
2020-12-23 15:45:59 +01:00
Andreas Kling
5f182746b6 LibCore: Stop logging that a Core::Socket has disconnected in receive()
This is perfectly normal and nothing we need to inform about.
2020-12-23 15:45:59 +01:00
Xavier Cooney
5f58fe1643 Spreadsheet: Prompt user before closing with unsaved changes 2020-12-23 15:41:49 +01:00
Andreas Kling
23febb9d8e Kernel: Ptrace::handle_syscall() should return errors as KResult 2020-12-23 14:55:24 +01:00
Andreas Kling
eaa63fdda5 Kernel: Don't assert on PT_PEEK with kernelspace address
We were casting the address to Userspace<T> without validating it first
which is no good and will trap an assertion soon after.

Let's catch this sooner with an ASSERT in the Userspace<T> constructor
and update the PT_PEEK and PT_POKE handlers to avoid it.

Fixes #4505.
2020-12-23 14:50:20 +01:00
Andreas Kling
c25cf5fb56 Kernel: Panic if we're about to switch to a user thread with IOPL!=0
This is a crude protection against IOPL elevation attacks. If for
any reason we find ourselves about to switch to a user mode thread
with IOPL != 0, we'll now simply panic the kernel.

If this happens, it basically means that something tricked the kernel
into incorrectly modifying the IOPL of a thread, so it's no longer
safe to trust the kernel anyway.
2020-12-23 14:30:10 +01:00
Linus Groh
488a613858 TextEditor: Rename {Main => TextEditor}Window.gml
Calling the file MainWindow.gml (and subsequently using MainWindowGML.h
for the generated file's name) suggests that's possible for every
application, but having a second one anywhere results in the following
CMake error:

    add_custom_target cannot create target "generate_MainWindowGML.h"
    because another target with the same name already exists. The
    existing target is a custom target created in source directory [...]

It's now also more consistent with the other applications already using
GML, namely "BrowserWindow.gml" and "FileManagerWindow.gml".
2020-12-23 01:33:43 +01:00
Andreas Kling
8653128ca8 cp: Don't copy the set-uid or set-gid bits
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-23 01:03:32 +01:00
Andreas Kling
75da835ffb LibDebug: Allow DWARF compilation unit header version <= 4
I think this is okay, the main thing to protect against is new versions
of the format that we don't know about yet.

This happens because an .S file compiled into libc.so has version 2
instead of version 4 like everything else.

Fixes #4491.
2020-12-23 00:53:27 +01:00
Andreas Kling
c77dda6827 Kernel: Make KBuffer::try_create_with_bytes() actually copy the bytes
KBuffers created with this API were actually just zero-filled instead
of being populated with the provided bytes.

Fixes #4493.
2020-12-23 00:40:11 +01:00
Tom
99d6b3b80b Chess: Use the hourglass cursor while waiting for the ChessEngine 2020-12-22 23:37:25 +01:00
Érico Nogueira Rolim
a8f0e489a4
LibCore: Rename identifiers that can clash with libc macros (#4127)
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-22 23:37:11 +01:00
Alex McGrath
abc98dea09 FileManager: Allow creating desktop shortcut from FileManager 2020-12-22 23:35:41 +01:00
AnotherTest
ca2e7b6746 Spreadsheet: Fix invalid check in SheetGlobalObject::column_index() 2020-12-22 23:35:29 +01:00
AnotherTest
8f05e4e765 Spreadsheet: Improve sheet update efficiency
There's no need to leave the cell dirty when not updating it, and
there's definitely no need to update the cells as we're selecting them.
This makes navigating a sheet and selecting cells significantly faster
as we no longer update unrelated cells just because they appear to have
a cyclic update dependency :^)
2020-12-22 23:35:29 +01:00