Commit graph

14302 commits

Author SHA1 Message Date
Nico Weber
be73f9f544 UserspaceEmulator: Implement FISUBR_RM32
Fixes crash when playing `ue Breakout` with the mouse.
2020-11-15 09:36:37 +01:00
Brendan Coles
d739483ee8 Userland: Tests: Use mkstemp temporary files in tests 2020-11-15 00:50:57 +01:00
Andreas Kling
12d923bb7e UserspaceEmulator: Fix some FPU instructions' handling of RM32/RM64
m32int is a 32-bit integer stored in memory, and should not be mistaken
for a floating point number. :^)

Also add missing handling of 64-bit FPU register operands to some of
the RM64 instructions.
2020-11-14 23:47:50 +01:00
Andreas Kling
647e92b74f UserspaceEmulator: Skip destroying the Emulator object on shutdown
There are some destruction order races that can cause hangs while
shutting down UE. Since there's no particular value right now in
destroying the Emulator object properly, just avoid destruction and
add a FIXME about looking into it later.
2020-11-14 23:39:44 +01:00
Andreas Kling
b5b535aa81 UserspaceEmulator: Untaint flags in FCOMI and FUCOMI for now
This makes UE logging bearable until we can get proper shadow data
support for the FPU stack.
2020-11-14 23:11:07 +01:00
Andreas Kling
8fd97bee7f UserspaceEmulator: Forget ChunkedBlocks after they are munmap()'ed
This is not ideal since we lose free() backtraces, but it will require
some thinking to get this right.
2020-11-14 23:07:07 +01:00
Andreas Kling
2066f48b87 UserspaceEmulator: Avoid one hash lookup in target_did_malloc() 2020-11-14 22:52:07 +01:00
Andreas Kling
d88b36448b UserspaceEmulator: Add some helpers to tidy up TrackedChunkedBlock 2020-11-14 22:52:04 +01:00
Andreas Kling
2fceffff6f UserspaceEmulator: Track malloc ChunkedBlocks for faster auditing
Instead of doing an O(n) scan over all the mallocations whenever we're
doing a read/write audit, UE now keeps track of ChunkedBlocks and their
chunks. Both the block lookup and the chunk lookup is O(1).

We know what ChunkedBlocks look like via mallocdefs.h from LibC.

Note that the old linear scan is still in use for big mallocations,
but the vast majority of mallocations are chunked, so this helps a lot.

This makes malloc auditing significantly faster! :^)
2020-11-14 22:51:58 +01:00
Andreas Kling
b494cfea38 LibC: Move some of malloc's data structures into mallocdefs.h
This allows UE to see what the heap metadata looks like.
2020-11-14 22:51:49 +01:00
Tom
53cffb5ad9 Kernel: Fix mouse lag when VMWareBackdoor absolute mode is enabled
We won't be receiving full PS/2 mouse packets when the VMWareBackdoor
absolute mouse mode is enabled. So, read just one byte every time
and retrieve the latest mouse packet from VMWareBackdoor immediately.

Fixes #4086
2020-11-14 22:09:48 +01:00
Tom
13383f3267 Revert "Kernel: Keep reading from i8042 until the buffer is empty"
This reverts commit 467f6c74a4.
2020-11-14 22:09:48 +01:00
Andreas Kling
467f6c74a4 Kernel: Keep reading from i8042 until the buffer is empty
Otherwise we might not drain the mouse buffer until the next IRQ.
2020-11-14 17:20:17 +01:00
Andreas Kling
a5982f8605 AK: Mark SimpleIterator::operator*() as ALWAYS_INLINE
This gives the compiler enough information to optimize index validation
when using range-for to iterate over a Vector, drastically reducing the
cost of such loops.
2020-11-14 17:20:17 +01:00
Ben Wiederhake
c4933f9bd7 Meta: Fix IRC notification script
What a silly mistake. How did I manage to do that?
2020-11-14 17:14:45 +01:00
Brendan Coles
f8c980a06b Userland: chroot: Add --userspec/-u flag to set uid/gid for chroot 2020-11-14 17:14:30 +01:00
Andreas Kling
677af891b4 UserspaceEmulator: Implement FISUB_RM32 2020-11-14 15:34:53 +01:00
Andreas Kling
ca85ecc032 UserspaceEmulator: Remove some FPU debug spam 2020-11-14 15:34:53 +01:00
Andreas Kling
a031c6c754 UserspaceEmulator: Implement FABS 2020-11-14 15:34:48 +01:00
Andreas Kling
60ff27c633 UserspaceEmulator: Improve FCOMI/FCOMIP/FUCOMI/FUCOMIP
These instructions now operate on the specified FPU stack entry instead
of always using ST(0) and ST(1).

FUCOMI and FUCOMIP also handle NaN values slightly better.
2020-11-14 15:33:56 +01:00
Andreas Kling
d4509647d8 UserspaceEmulator: Honor the read/write/execute bits in mmap regions
UE will now correctly crash when accessing an mmap memory region in
some way it's not supposed to be accessed.
2020-11-14 15:33:56 +01:00
Ben Wiederhake
ef9ac8a8a2 Meta: Use SerenityBot for IRC notifications
This avoids "useless" join/part notifications.
2020-11-14 15:30:29 +01:00
Ben Wiederhake
80d1e12116 Meta: Let toolchain patches invalidate toolchain cache
Fixes #4072.
2020-11-14 15:30:29 +01:00
Ben Wiederhake
58b70e8dc8 Meta: Fix broken IRC notification for drafts and skips 2020-11-14 13:16:48 +01:00
Andreas Kling
8ee6768d11 UserspaceEmulator: Print an emulator backtrace on OOB access
This makes OOB accesses much more actionable than just having UE itself
asserting with no hint about what the emulated program was doing.
2020-11-14 11:29:14 +01:00
Andreas Kling
f568aed2e7 LibC: strtok_r() should not go past the last token
When we hit the last token, make the saved pointer point to the null
terminator instead of to the next token. This ensures that the next
call to strtok_r() returns null as expected.

Found by running GCC in UE. :^)
2020-11-14 11:24:42 +01:00
Andreas Kling
a65e7db533 LibC: Fix OOB access in strerror() with invalid input
Calling strerror() with a negative number should not access below the
error string array.

Found by running GCC in UE. :^)
2020-11-14 11:23:39 +01:00
Andreas Kling
abe9cec612 TmpFS: Set the root inode's timestamp to the current time
cc @bcoles :^)
2020-11-14 10:44:47 +01:00
AnotherTest
1172746633 LibTLS: Add support for AEAD cipher suites
And integrate AES-GCM.
2020-11-14 10:18:54 +01:00
AnotherTest
d3c52cef86 LibCrypto: Implement GCM mode 2020-11-14 10:18:54 +01:00
AnotherTest
2cc867bcba test-crypto: Silence the "creating bytebuffer..." debug 2020-11-14 10:18:54 +01:00
AnotherTest
740089d24a LibCrypto: Move out 'VerificationConsistency' into its own header file 2020-11-14 10:18:54 +01:00
AnotherTest
b9822d606d LibCrypto: Templatise CTR<T> on the increment function 2020-11-14 10:18:54 +01:00
Luke
ed2689c00a LibWeb: Use standardized encoding names, add encoding attribute to document 2020-11-14 10:14:03 +01:00
Luke
f3d2053bff LibTextCodec: Add a function to convert encodings to standardized names
https://encoding.spec.whatwg.org/#names-and-labels
2020-11-14 10:14:03 +01:00
Linus Groh
826096bac3 LibGUI: Make FileIconProvider aware of all supported image formats
By using Gfx::Bitmap::is_path_a_supported_image_format() we can
automatically provide the image icon for all supported image formats,
without keeping a second list of image file extensions.
2020-11-14 10:11:26 +01:00
Linus Groh
f0c2ee3c56 LibGUI: Add more extensions to FileIconProvider
This adds the following:

- cplusplus: .cxx, .cc, .c++
- header: .hpp, .hxx, .hh, .h++
- javascript: .mjs
2020-11-14 10:11:26 +01:00
Linus Groh
5b68ea8dde LibGfx: Make Bitmap path handling case insensitive
Bitmap::is_path_a_supported_image_format() and Bitmap::load_from_file()
now check the file extension with CaseSensitivity::CaseInsensitive.

This fixes a couple of inconsistencies, for example would
FileSystemModel::icon_for() recognize image files uppercase extensions
but couldn't create thumbnails for them (any attempt to create a bitmap
from such files would fail).
2020-11-14 10:11:26 +01:00
Linus Groh
d3ee3fc68a AK: Fix StringUtils::contains() case insensitive search
It would incorrectly return false if needle was at the end the string.
2020-11-14 10:11:26 +01:00
Linus Groh
b1754bf8f8 HackStudio: Use GUI::FileIconProvider::icon_for_path() for Locator icons
No need to duplicate file icon association logic as well as artificially
limiting the number of recognized file types.
2020-11-14 10:11:26 +01:00
Linus Groh
d773795195 HackStudio: Make Locator search case insensitive
Typing "make" should find "Makefile", for example. :^)
2020-11-14 10:11:26 +01:00
Nico Weber
39ce7251f7 Lagom: Use -fsanitize=fuzzer, not -fsanitize=fuzzer-no-link
Fuzzers don't link for me without this change.
2020-11-14 10:09:03 +01:00
Nico Weber
d775dea13c Lagom: Add a gemini fuzzer
Didn't find anything interesting, but might as well check it in.
2020-11-14 10:09:03 +01:00
Nico Weber
8ed83f9a1d Lagom: Augment fuzzing readme a bit
Recommend using asan, don't set the c compiler (c++ compiler is
sufficient), mention how to run on several cores, and how to get less
output.
2020-11-14 10:09:03 +01:00
Brendan Coles
664322d34b Userland: Add test-gfx-font for Gfx::Font tests 2020-11-14 10:08:25 +01:00
Andreas Kling
69518bd178 LibGfx: Fail PPM decode if there's not enough pixel data in the input
Fixes #3820.
2020-11-13 12:01:32 +01:00
Andreas Kling
f234b8c129 LibGfx: Add missing stream error handling in GIF frame descriptor parse
If we try to read a sentinel byte but the stream is fresh out of data,
we have to take care of the stream error and bail out right away, or
we'll hit an assertion when exiting the function soon after.

Fixes #3486.
2020-11-13 12:01:29 +01:00
Andreas Kling
c0aa455f76 LibGfx: Refuse to decode PNG images with geometry outside i32 bounds
Just fail the decode immediately when encountering an IHDR chunk with
width and/or height larger than the maximum i32 value.

Fixes #3818.
Fixes #3819.
2020-11-13 12:01:25 +01:00
Andreas Kling
ddc5ce1800 UserspaceEmulator: When auditing accesses, show nearest mallocation
Instead of always showing the preceding mallocation, prefer showing the
following one *if* it's closer to the audited address.

This makes it easier to find bugs where the access is just before an
allocation instead of just after it.
2020-11-13 11:05:46 +01:00
Andreas Kling
3a2727844c LibC: Adjust malloc size classes to ensure 8-byte aligned pointers
The pointers returned by malloc should always be 8-byte aligned on x86.
We were not consistent about this, as some ChunkedBlock size classes
were not divisible by 8.

This fixes some OOB reads found by running GCC in UE.
2020-11-13 11:05:46 +01:00