Commit Graph

17563 Commits

Author SHA1 Message Date
Ben Wiederhake
2b6546c40a Kernel: Make Thread use AK::Time internally
This commit is very invasive, because Thread likes to take a pointer and write
to it. This means that translating between timespec/timeval/Time would have been
more difficult than just changing everything that hands a raw pointer to Thread,
in bulk.
2021-03-02 08:36:08 +01:00
Ben Wiederhake
65b36e42b8 Kernel: Make TimerId a distinct type
Well, that was easy\! :^)
2021-03-02 08:36:08 +01:00
Ben Wiederhake
94e0a603f2 Kernel: Make TimerQueue use AK::Time internally 2021-03-02 08:36:08 +01:00
Ben Wiederhake
340813e087 AK: Make Time more usable 2021-03-02 08:36:08 +01:00
Ben Wiederhake
e510c41fd2 Kernel: Prevent using copy_from_user() for timespec/timeval
These structs can be inconsistent, for example if the amount of microseconds is
negative or larger than 1'000'000. Therefore, they should not be copied as-is.
Use copy_time_from_user instead.
2021-03-02 08:36:08 +01:00
Ben Wiederhake
8598240193 Kernel: Sanitize all user-supplied timeval's/timespec's
This also removes a bunch of unnecessary EINVAL. Most of them weren't even
recommended by POSIX.
2021-03-02 08:36:08 +01:00
Ben Wiederhake
649abc01bc Kernel: Implement 'copy_time_from_user' functions to sanitize arguments 2021-03-02 08:36:08 +01:00
Ben Wiederhake
bd6be910e5 AK: Implement C++ 'Time' type for easier time-calculations
This adds a bunch of code in the hope that other, wrong code can be deleted.

Related to #5315.
2021-03-02 08:36:08 +01:00
Ben Wiederhake
b374dd03bd Kernel: Prevent inconsistent state after invalid read
copy_from_user can fail, for example when the user-supplied pointer is just before
the end of mapped address space. In that case, the first few bytes would get copied,
permanently overwriting the internal state of the Socket, potentially leaving it
in an inconsistent or at least difficult-to-predict state.
2021-03-02 08:36:08 +01:00
Ben Wiederhake
b7c5d977c7 AK: Remove unused template 2021-03-02 08:36:08 +01:00
Ben Wiederhake
90c070cb1d AK+Tests: Test Checked for main functionality 2021-03-02 08:36:08 +01:00
Jean-Baptiste Boric
6f668ca3a4 LibJS: Fix crash due to AST node tracking inside call stack 2021-03-01 22:27:27 +01:00
Andreas Kling
74d1caf7d1 Ports: Build curl with --disable-ipv6 2021-03-01 19:51:23 +01:00
Andreas Kling
14aa8e3708 Kernel: Oops, SC_abort was actually calling sys$exit_thread() 2021-03-01 19:47:16 +01:00
Andreas Kling
4d006de2b9 Kernel: Fix build with IO_DEBUG 2021-03-01 16:07:50 +01:00
Andreas Kling
272c2e6ec5 Kernel: Use Userspace<T> in sys${munmap,mprotect,madvise,msyscall}() 2021-03-01 15:53:33 +01:00
Andreas Kling
bebceaa32c Kernel: Use Userspace<T> in sys$select() 2021-03-01 15:07:01 +01:00
Andreas Kling
a1a82c1d95 Kernel: Use Userspace<T> in sys$get_dir_entries() 2021-03-01 15:04:31 +01:00
Andreas Kling
b5f32be577 Kernel: Use Userspace<T> in sys$get_stack_bounds() 2021-03-01 14:50:36 +01:00
Andreas Kling
122c7b6cbb Kernel: Use Userspace<T> in sys$write() 2021-03-01 14:35:06 +01:00
Andreas Kling
6a6eb8844a Kernel: Use Userspace<T> in sys$sigaction()
fuzz-syscalls found a bunch of unaligned accesses into struct sigaction
via this syscall. This patch fixes that issue by porting the syscall
to Userspace<T> which we should have done anyway. :^)

Fixes #5500.
2021-03-01 14:06:20 +01:00
Andreas Kling
261b30e120 Kernel: Detach any attached thread tracer on sys$abort() 2021-03-01 13:57:20 +01:00
Andreas Kling
ac71775de5 Kernel: Make all syscall functions return KResultOr<T>
This makes it a lot easier to return errors since we no longer have to
worry about negating EFOO errors and can just return them flat.
2021-03-01 13:54:32 +01:00
Andreas Kling
9af1e1a3bf LibVT: New terminal cells should be filled with whitespace, not '\0' 2021-03-01 11:37:22 +01:00
Idan Horowitz
147d30ae4f Spreadsheet: Implement the cut operation for cells
This is done by adding another field to our custom
text/x-spreadsheet-data mime-type that specifies the
action (just copy/cut for now)
2021-03-01 11:37:02 +01:00
ry755
b474f49164 TextEditor: Add a command line option to jump to a specific line number 2021-03-01 11:18:14 +01:00
Brian Gianforcaro
e60d394b32 test-web: Utilize new LibTest types from test-web
test-web has alot of similar code to test-js, so
re-use some of the types we already pulled out
into LibTest.
2021-03-01 11:17:05 +01:00
Brian Gianforcaro
0a49877fdc LibTest + test-js: Add initial skelaton of LibTest and migrate code there.
The test-js reporter is arguably the nicest test runner / reporter that
exists in the serenity code base. To the goal of leveling up all the
other unit test environments, start a new LibTest library so that we
can share code and reporting utilities to make all the test systems
look and behave similarly.
2021-03-01 11:17:05 +01:00
speles
0b5ca28475 FileManager: Focus on file when opening file's location from Properties 2021-03-01 11:16:18 +01:00
speles
e964d238b8 FileManager+LaunchServer: Add launching FileManager with focus on file 2021-03-01 11:16:18 +01:00
speles
aa9c5d4418 LibGUI: Add possibility to search for exact match in model 2021-03-01 11:16:18 +01:00
speles
dff31d5885 LaunchServer: Make spawn() helper accept arguments list 2021-03-01 11:16:18 +01:00
Jean-Baptiste Boric
8dca96fb61 LibWeb: Provide file name to JavaScript interpreter 2021-03-01 11:14:36 +01:00
Jean-Baptiste Boric
6172cb3599 LibJS: Keep track of current AST node inside the call stack 2021-03-01 11:14:36 +01:00
Jean-Baptiste Boric
0039ecb189 LibJS: Keep track of file names, lines and columns inside the AST 2021-03-01 11:14:36 +01:00
Brian Gianforcaro
007b6edce4 Profiler: Print addresses as pointers in new Samples view
The previous formatting was missing the "0x" prefix.
2021-03-01 11:12:53 +01:00
Andrew Kaster
e8fd53c247 Base: Add test-math to set of tests run on CI
It currently fails though :( Likely contributes to innacuracies in LibJS
tests as well.
2021-03-01 11:12:36 +01:00
Andrew Kaster
669b6c43aa AK/Lagom: Modify TestSuite to return how many tests failed from main
This allows us to remove the FAIL_REGEX logic from the CTest invocation
of AK and LibRegex tests, as they will return a non-zero exit code on
failure :^).

Also means that running a failing TestSuite-enabled test with the
run-test-and-shutdown script will actually print that the test failed.
2021-03-01 11:12:36 +01:00
Tom
5b1edc0678 Meta: Allow specifying custom grub config file for build-image-grub.sh
This allows passing a custom grub config file as second argument to
build-image-grub.sh.
2021-03-01 11:11:56 +01:00
Tom
cdbd878a14 Kernel: Fix APIC timer calibration to be more accurate
We were calibrating it to 260 instead of 250 ticks per second (being
off by one for the 1/10th second calibration time), resulting in
ticks of only ~3.6 ms instead of ~4ms. This gets us closer to ~4ms,
but because the APIC isn't nearly as precise as e.g. HPET, it will
only be a best effort. Then, use the higher precision reference
timer to more accurately calculate how many ticks we actually get
each second.

Also the frequency calculation was off, causing a "Frequency too slow"
error with VMware.

Fixes some problems observed in #5539
2021-03-01 11:11:09 +01:00
Paweł Łukasik
f66adbdd95
Meta: Use ninja instead of make in the WSL docs (#5575)
Co-authored-by: Paweł Łukasik <lukasik.pawel@gmail.com>
2021-03-01 11:10:50 +01:00
Tom
b4c1b96d96 Kernel: Fix scrolling up in VMware
The mouse wheel delta is provided as a signed 8 bit value.
2021-03-01 11:10:10 +01:00
Luke
152af3a297 LibAudio: Move format and BPS checks before VERIFYs in WAV loader
It was accidentally checking the format/bits per sample too late,
which would crash with the assertion.
2021-03-01 11:09:09 +01:00
Luke
69df86c1d6 LibAudio: Use handle_any_error in WAV loader
It was using has_any_error, which causes an assertion failure when
destroying the stream. Instead, use handle_any_error, as the
WAV loader does handle errors.
2021-03-01 11:09:09 +01:00
Luke
a66f96ff62 Lagom/Fuzzers: Add WAV fuzzer 2021-03-01 11:09:09 +01:00
Torben Thaysen
a723a97750 LibGUI: Implemented line wrapping for new spanned text drawing 2021-03-01 09:16:07 +01:00
Torben Thaysen
b76d2450fa LibGUI: drawing spanned text no longer *horribly* inefficient
This makes drawing text with spans a lot faster.
The previous implentation went character by character and then
checked every span whether it contained the current character.

This implentation asumes that the spans are sorted and goes span by
span drawing all the characters contained at once.
Any spans that are out of order will be ignored!

Note: text wrapping is not (yet) supported
2021-03-01 09:16:07 +01:00
Mițca Dumitru
00ef931f79 LibC: Implement fenv.h 2021-03-01 09:14:26 +01:00
Adam Hodgen
53c4be926b LibWeb: Set link cursor via the default CSS
This removes the custom handling of cursor for the link element, which
also allows overriding the cursor on a link element via CSS
2021-02-28 18:19:52 +01:00
Adam Hodgen
bedcd9cd88 LibWeb: Support setting the cursor in OutOfProcessWebView 2021-02-28 18:19:52 +01:00