Commit Graph

79 Commits

Author SHA1 Message Date
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Tim Schumacher
7834e26ddb Everywhere: Explicitly link all binaries against the LibC target
Even though the toolchain implicitly links against -lc, it does not know
where it should get LibC from except for the sysroot. In the case of
Clang this causes it to pick up the LibC stub instead, which might be
slightly outdated and feature missing symbols.

This is currently not an issue that manifests because we pass through
the dependency on LibC and other libraries by accident, which causes
CMake to link against the LibC target (instead of just the library),
and thus points the linker at the build output directory.

Since we are looking to fix that in the upcoming commits, let's make
sure that everything will still be able to find the proper LibC first.
2022-11-01 14:49:09 +00:00
Gunnar Beutner
808c43312d Tests+Userland: Implement AARCH64 support for some inline assembly blobs 2022-10-14 13:01:13 +02:00
Gunnar Beutner
dadf656dc9 Tests+Userland: Prefer using __builtin_trap() instead of UD2
This way we don't have to hard-code per-architecture instructions.
2022-10-14 13:01:13 +02:00
Gunnar Beutner
31bd5b1a02 AK+Userland: Stub out code that isn't currently implemented on AARCH64
Even though this almost certainly wouldn't run properly even if we had
a working kernel for AARCH64 this at least lets us build all the
userland binaries.
2022-10-14 13:01:13 +02:00
Nico Weber
2af028132a AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places
Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.

AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.

AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
2022-10-04 23:35:07 +01:00
Liav A
7d91724dd2 Tests/Kernel: Add tests to ensure we don't regress InodeVMObjects 2022-09-26 20:00:34 +03:00
Liav A
e181269da7 Revert "Tests/Kernel: Add tests to ensure we don't regress InodeVMObjects"
This reverts commit b0d555163bc724542ea6560a2bc82bc3b620c31d.
2022-09-24 13:49:40 +02:00
Liav A
a308331bb7 Kernel/Tests: Don't compile x86 IO for non-x86 builds
x86 IO space is not relevant for non-x86 builds so it doesn't make sense
to include it in such build as it will not compile anyway.
2022-09-20 18:43:05 +01:00
Liav A
e6306d459a Tests/Kernel: Add tests to ensure we don't regress InodeVMObjects 2022-09-16 14:55:45 +03:00
Andreas Kling
c713e76941 Tests/Kernel: Make sure inaccessible area in TestEFault is actually that
We were relying on luck to make the mapping before our first mmap() be
inaccessible. Let's make it explicit.
2022-08-24 18:35:41 +02:00
Undefine
97cc33ca47 Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
Tim Schumacher
5870484d1a LibC: Remove the LibPthread interface target 2022-07-19 11:00:35 +01:00
Tim Schumacher
e156f79f53 Everywhere: Refer to pthread.h by its non-prefixed name
This removes a bit of noise from the following patches, where we will
move the `pthread.h` header out of the `LibPthread` directory.
2022-07-19 11:00:35 +01:00
sin-ack
c8585b77d2 Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
Tim Schumacher
9e8c698ae8 Tests: Remove the RDTSC kernel crash test
We will remove the RDTSC instruction restriction to allow QEMU to read
an accurate time, so this will no longer crash and therefore fail the
test.
2022-07-08 22:27:38 +00:00
Tim Schumacher
60fc0ceabb Tests: Add tests for inheriting signal handlers 2022-07-05 20:58:38 +03:00
Daniel Bertalan
699bd9afc6 Tests: Fix new GCC 12 warnings 2022-05-12 13:12:37 +02:00
Liav A
e301af8352 Everywhere: Purge all support and usage of framebuffer devices
Long live the DisplayConnector object!
2022-05-05 20:55:57 +02:00
Liav A
d2e93ec50a Everywhere: Rename FB prefix name ioctls => GRAPHICS 2022-05-05 20:55:57 +02:00
Patrick Meyer
0bd131ad06 Kernel: Stop requiring working malloc for syscall.h includes
Fixes #13869
2022-05-02 12:44:34 +02:00
Andreas Kling
90a7b9e5b4 Tests: Make TestEFault not rely on automatic guard pages
I'm about to break automatic guard page allocation in sys$mmap(), so we
need to fix this test to not rely on it.
2022-04-03 21:51:58 +02:00
Andreas Kling
2d3fb6ac39 Tests: Clear errno before syscalls in TestEFault
This makes the debug output a little more helpful.
2022-04-03 21:51:58 +02:00
Andreas Kling
df64b85925 Tests: Remove unused macro in TestEFault 2022-04-03 21:51:58 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Kenneth Myhra
4a57be824c Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to
ErrorOr<String>.

The rest of the change is to support the potential of an Error being
returned and subsequent release of the value when no Error is returned.
Unfortunately at this stage none of the places affected can utililize
our TRY() macro.
2022-03-24 11:57:51 +01:00
Ali Mohammad Pur
4bd01b7fe9 Kernel: Add support for SA_SIGINFO
We currently don't really populate most of the fields, but that can
wait :^)
2022-03-04 20:07:05 +01:00
Sam Atkins
45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Liav A
1716105e73 Tests: Unmap memory ranges on /dev/mem after testing mmap(2) 2022-01-14 19:42:11 +02:00
Liav A
ca254699ec Kernel: Implement read functionality for MemoryDevice
So far we only had mmap(2) functionality on the /dev/mem device, but now
we can also do read(2) on it.

The test unit was updated to check we are doing it safely.
2022-01-08 13:21:16 +02:00
Liav A
5a649d0fd5 Kernel: Return EINVAL when specifying -1 for setuid and similar syscalls
For setreuid and setresuid syscalls, -1 means to set the current
uid/euid/gid/egid value, to be more convenient for programming.
However, for other syscalls where we pass only one argument, there's no
justification to specify -1.

This behavior is identical to how Linux handles the value -1, and is
influenced by the fact that the manual pages for the group of one
argument syscalls that handle ID operations is ambiguous about this
topic.
2021-12-20 11:32:16 +01:00
Idan Horowitz
8d3faecd9b Tests: Add tests for sigwait/sigwaitinfo/sigtimedwait 2021-12-12 08:34:19 +02:00
Idan Horowitz
246255527a Tests: Add a test to ensure sigaltstack() is working correctly 2021-12-01 21:44:11 +02:00
Ben Wiederhake
f20a42e871 Kernel: Write test that crashes ProcFS 2021-10-31 18:44:12 +01:00
Liav A
8554952690 Kernel + WindowServer: Re-define the interface to framebuffer devices
We create a base class called GenericFramebufferDevice, which defines
all the virtual functions that must be implemented by a
FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other
FramebufferDevice implementations inherit from it.
The most important consequence of rearranging the classes is that we now
have one IOCTL method, so all drivers should be committed to not
override the IOCTL method or make their own IOCTLs of FramebufferDevice.
All graphical IOCTLs are known to all FramebufferDevices, and it's up to
the specific implementation whether to support them or discard them (so
we require extensive usage of KResult and KResultOr, together with
virtual characteristic functions).
As a result, the interface is much cleaner and understandable to read.
2021-10-27 07:57:44 +03:00
Liav A
cf0dbc9069 Tests: Add a unit test to ensure the /dev/mem device works correctly
To ensure everything works as expected, a unit test was added with
multiple scenarios.
This binary has to have the SetUID flag, and we also bind-mount the
/usr/Tests directory to allow running of SetUID binaries.
2021-10-22 13:13:00 +02:00
Nico Weber
96666f3209 Tests: Fix -Wunreachable-code warnings from clang 2021-10-08 23:33:46 +02:00
Liav A
4974727dbb Kernel: Move x86 IO instructions code into the x86 specific folder 2021-10-01 12:27:20 +02:00
Nico Weber
841a5fe81b Tests: Fix typos 2021-10-01 01:33:43 +01:00
Ben Wiederhake
5f0f0ac413 crash: Don't test for qemu-unsupported feature
See #10042 for details. In short: qemu doesn't seem to implement that
feature, therefore the test correctly fails. However, that does not help
us, so we skip that test.
2021-09-16 20:51:24 +00:00
Ben Wiederhake
c680ef0a09 crash: Run automatically during CI 2021-09-16 20:51:24 +00:00
Brian Gianforcaro
a4efaa7b47 Tests/Kernel: Fix test after off-by-one fix in Memory::is_user_range()
Commit 890c647e0f fixed an off-by-one bug, so the mapping of the page
at the very end of the user address space now works correctly.

This change adjusts the test so cover the corner cases the original
version was designed too.validate.
2021-09-11 04:15:16 +00:00
Ali Mohammad Pur
97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Andrew Kaster
58797a1289 Tests: Remove all file(GLOB) from CMakeLists in Tests
Using a file(GLOB) to find all the test files in a directory is an easy
hack to get things started, but has some drawbacks. Namely, if you add
a test, it won't be found again without re-running CMake. `ninja` seems
to do this automatically, but it would be nice to one day stop seeing it
rechecking our globbed directories.
2021-09-02 09:08:23 +02:00
Brian Gianforcaro
4df1657898 Tests: Add coverage for sys$alarm() success case 2021-08-03 18:44:01 +02:00
Brian Gianforcaro
ea401fb3c3 Tests: Add coverage for sys$alarm() canceling a stale timer
This is a regression test to validate the functionality that was
reported broken in #9071, where the kernel would spin attempting
to cancel a stale timer.
2021-08-03 18:44:01 +02:00
Andreas Kling
bccdc08487 Kernel: Unmapping a non-mapped region with munmap() should be a no-op
Not a regression per se from 0fcb9efd86
since we were crashing before that which is obviously worse.
2021-07-30 13:16:55 +02:00
Brian Gianforcaro
c9395d7e9a Tests: Validate unmapping 0x0 doesn't crash the Kernel
Previously unmapping any offset starting at 0x0 would assert in the
kernel, add a regression test to validate the fix.

Co-authored-by: Federico Guerinoni <guerinoni.federico@gmail.com>
2021-07-30 11:28:55 +02:00
Brian Gianforcaro
c2282ee28d Tests: Add test coverage for sys$pledge(..) argument validation 2021-07-23 19:02:25 +02:00