Commit graph

11646 commits

Author SHA1 Message Date
Andreas Kling 314dbc10d4 Kernel: Use Userspace<T> for sys$read() and sys$stat()
Add validation helper overloads as needed.
2020-07-31 16:28:37 +02:00
Andreas Kling e39a410546 AK: Add Userspace<T>, a wrapper for userspace pointers
This will be used in the kernel to wrap pointers into userspace memory
without convenient direct access. The idea is to use the compiler to
enforce that we don't dereference userspace pointers.
2020-07-31 16:26:44 +02:00
Ben Wiederhake 538a3a2579 Userland: Add missing checks for MappedFile.is_valid() 2020-07-31 11:34:06 +02:00
Ben Wiederhake 17248ab6fe AK: On failed mmap, don't claim that there's a readable page 2020-07-31 11:34:06 +02:00
Andreas Kling d19d6a63c6 Kernel: Add missing license headers to some syscall files 2020-07-31 01:01:41 +02:00
Andreas Kling 3023a89e9b Kernel: Remove SmapDisabler in sys$setsockopt() 2020-07-31 00:29:26 +02:00
Andreas Kling 292cd53192 Kernel: Remove SmapDisabler in sys$ioctl()
Use copy_{to,from}_user() in the various File::ioctl() implementations
instead of disabling SMAP wholesale in sys$ioctl().

This patch does not port IPv4Socket::ioctl() to those API's since that
will be more involved. That function now creates a local SmapDisabler.
2020-07-31 00:17:25 +02:00
Andreas Kling be7add690d Kernel: Rename region_from_foo() => find_region_from_foo()
Let's emphasize that these functions actually go out and find regions.
2020-07-30 23:52:28 +02:00
Andreas Kling 2e2de125e5 Kernel: Turn Process::FileDescriptionAndFlags into a proper class 2020-07-30 23:50:31 +02:00
Andreas Kling f2a152e930 Kernel: Simplify the ScopedSpinLock template
We can just templatize the LockType here. This makes my Qt Creator
syntax highlighting work again. :^)
2020-07-30 23:43:37 +02:00
Andreas Kling 949aef4aef Kernel: Move syscall implementations out of Process.cpp
This is something I've been meaning to do for a long time, and here we
finally go. This patch moves all sys$foo functions out of Process.cpp
and into files in Kernel/Syscalls/.

It's not exactly one syscall per file (although it could be, but I got
a bit tired of the repetitive work here..)

This makes hacking on individual syscalls a lot less painful since you
don't have to rebuild nearly as much code every time. I'm also hopeful
that this makes it easier to understand individual syscalls. :^)
2020-07-30 23:40:57 +02:00
Andreas Kling 027c450d6d Kernel: Run clang-format on Scheduler.cpp 2020-07-30 21:46:06 +02:00
AnotherTest 07ea2b672b Shell: Tweak tests to use 'echo -n' when newlines are significant 2020-07-30 18:47:41 +02:00
AnotherTest 6df2f8a8cb Userland: Add support for the '-n' flag to 'echo' 2020-07-30 18:47:41 +02:00
AnotherTest 3b3e90714f Shell: Add tests for '&&' and '||' parsing and evaluation 2020-07-30 18:47:41 +02:00
AnotherTest c4888f4b5f Shell: Fix parse mistake in '&&' not being recursive 2020-07-30 18:47:41 +02:00
AnotherTest 4be2cb895c Shell: Do not assume that wstatus is valid after wait() returns 0
According to the linux waitid manpage, the value of wstatus is
unspecified if wait() returns 0, so we should not assume that any
value it holds is correct (including the exit code).
This is only applicable to the Lagom build.
2020-07-30 18:47:41 +02:00
AnotherTest 681bb1fb23 AK: Add (more) tests for String(View)::split*
This patchset adds some tests for String(View)::split*, hopefully
documenting their behaviour in some cases.
2020-07-30 18:47:41 +02:00
stelar7 dad22c5d5a LibCrypto: Add some checksum algorithms
Namely CRC32 and Adler32
2020-07-30 17:08:19 +02:00
stelar7 8c5f08ea94 Meta: Add .gitattributes file
This file is used to configure Git to properly handle line endings
2020-07-30 17:07:40 +02:00
Luke 98bea083c4 Kernel: Make BXVGA detection actually detect VBoxVGA
I decided to play around with trying to run Serenity in VirtualBox.
It crashed WindowServer with a beautiful array of multi-color
flashing letters :^)

Skipping getting side-tracked seeing that it chose MBVGA in the
serial debug and trying to debug why it caused such a display,
I finally checked BXVGA.

While find_framebuffer_address checks for VBoxVGA, init_stage2 didn't.
Whoops!
2020-07-30 17:01:41 +02:00
AnotherTest 1df9293ea4 LibWeb: Complete the redirect URL before loading it
the "Location" header is allowed to be a relative URL (as is the case in
our very own WebServer!)
2020-07-30 16:56:15 +02:00
Nico Weber 8e8cbe6a12 LibX86: FPU instructions never have a lock prefix 2020-07-30 16:53:33 +02:00
Nico Weber 8593bdb711 LibX86: Disassemble most remaining FPU instructions
Some of the remaining instructions have different behavior for
register and non-register ops.  Since we already have the
two-level flags tables, model this by setting all handlers in
the two-level table to the register op handler, while the
first-level flags table stores the action for the non-reg handler.
2020-07-30 16:53:33 +02:00
Nico Weber 06c59cce6f Toolchain: Strip cc1 2020-07-29 17:36:38 +02:00
Emanuele Torre f128d3baf7 Meta: make check-style.sh ignore Libraries/LibCore/puff.cpp
This file was formerly named `Libraries/LibCore/puff.c` and it was not
checked by `check-style.sh` because it only checks .h and .cpp files.

Since this file was not written by us, we shouldn't check its style.

This file was also causing our Travis builds to fail.
2020-07-29 17:36:21 +02:00
Nico Weber c7652a2166 Lagom: Clean up glob after puff.c -> puff.cpp rename 2020-07-29 15:11:04 +02:00
Andreas Kling 9dcd776da9 Toolchain: Let's leave cc1 in place for now 2020-07-29 15:10:00 +02:00
Andreas Kling 5e2b8d160b LibCore: Rename puff.c => puff.cpp
Now that we don't keep a C compiler around in the toolchain (to save
space) we can't have .c files in the build.

This reminds me that #362 exists and we should fix that at some point.
2020-07-29 14:41:57 +02:00
Ben Wiederhake eccf96b703 Meta: Find potentially missing resources 2020-07-29 01:34:22 +02:00
Ben Wiederhake 5692fa6c39 Eyes: Introduce and use icons
The icons are made using a screenshot which was then scaled down.
The 16x16 icon needed some light post-processing to look good.
2020-07-29 01:34:22 +02:00
Ben Wiederhake be89627bf5 FileManager: Improce icon contrast (filetypes music and sound) 2020-07-29 01:34:22 +02:00
Ben Wiederhake 2ac8a2dfac PixelPaint: Improve icon contrast 2020-07-29 01:34:22 +02:00
Ben Wiederhake 5ad3db9bc0 DisplaySettings: Improve icon contrast 2020-07-29 01:34:22 +02:00
Ben Wiederhake 84dac4eff5 Screensaver: Improve icon contrast 2020-07-29 01:34:22 +02:00
Ben Wiederhake 58282ed5a7 Snake: Improve icon contrast 2020-07-29 01:34:22 +02:00
Ben Wiederhake 8aa6b13caa Meta: Ensure that icons and other resources remain non-executable 2020-07-29 01:34:22 +02:00
Ben Wiederhake 3a04e75774 Icons: Unset executable flag
Icons cannot be executed. Or at least they *really* shouldn't be executed.
2020-07-29 01:34:22 +02:00
Ben Wiederhake f29fbe3c76 Meta: Fix shellcheck issues in BuildIt.sh 2020-07-29 01:24:24 +02:00
Ben Wiederhake 962e7855c5 Travis: Reduce Toolchain cache item size by 73%
Empirically, every single push or PR has to download *and then upload*
about 3.6 GiB of "cache stuff", which takes up about 400 seconds:
https://travis-ci.com/github/SerenityOS/serenity/builds/177500795
On every single push/PR! No matter what!

Those 3.6 GB consist of:
- 3.2 GB Toolchain cache (around 260 MB per compressed item)
- 0.4 GB ccache, but is capped at 0.5 GB: https://travis-ci.com/github/BenWiederhake/serenity/builds/177528549
- (And 200 KB for some weird debian package? Dunno.)

Investigating in the size, the Toolchain consists mostly of *DEBUG SYMBOLS IN
THE COMPILER BINARIES* which comically misses the point. If we ever run into
compiler crashes, any stacktrace would be lost anyway as soon as the Travis VM
shuts down. Furthermore, Travis will only ever compile Serenity itself, and
Serenity forbids C in it's Contribution Guidelines. That's another 20 MB we
don't need to cache.

Stripping the binaries and deleting the C compiler reduces the uncompressed size
from 1200 MB down to 220 MB. The compressed size gets reduced from 260 MB to 70MB.
That's a reduction of 73%.

It'll take a while until the 'old' toolchains get deleted.
I guess it'll take less than a week.

From that point onward, the Travis cache will be 1.2 GB, consisting of:
- 0.7 GB Toolchain cache
- 0.5 GB ccache
- (And that weird 200 KB deb file)

If network speeds are linear, then this should reduce the "cache network
overhead time" from about 400 seconds to about 120 seconds.

tl;dr: Strip unnecessary debug infos, delete an unused files, and speed
everything up by two minutes. (Both Toolchain cache hits and Toolchain rebuilds!)
2020-07-29 01:24:24 +02:00
Ben Wiederhake c6c9679cfc Travis: Show cache sizes before upload
Uploading the cache takes several minutes. This gives us a handy way to tell
which parts the worst culprits are.

The Toolchain cache seems to be the worst offender by far, because the binary
size nearly doubled when we upgraded from gcc9 to gcc10.
2020-07-29 01:24:24 +02:00
Andreas Kling a2ad0ae5fc Net: Fix IPv4 fragmentation not working for larger payloads
We were masking the fragment offset bits incorrectly in the IPv4 header
sent out with fragments. This worked up to ~32KB but after that, things
would get very confused. :^)
2020-07-28 20:33:24 +02:00
Andreas Kling f5ac4da993 Kernel: Use AK::Span a bunch in the network adapter code 2020-07-28 20:19:22 +02:00
Andreas Kling fffc5896d8 LibWeb: Make layout tree have non-const pointers to the DOM
Const pointers into the DOM was a nice idea, but in practice, there are
too many situations where the layout tree wants to some non-const thing
to the DOM.
2020-07-28 19:48:57 +02:00
Andreas Kling a4eadeb80d LibWeb: Oops, provide the correct WrapperType for UIEvent 2020-07-28 19:40:11 +02:00
Andreas Kling c95a1fe3a3 LibWeb: Add UIEvent class (base of MouseEvent, and others) 2020-07-28 19:39:17 +02:00
Andreas Kling ef711f501e LibWeb: Move the Page/Frame/EventHandler classes into Page/ 2020-07-28 19:28:29 +02:00
Andreas Kling 481e838054 LibWeb: Fix bad #include in CSSParser.cpp 2020-07-28 19:28:29 +02:00
Andreas Kling 7daeddb9e9 LibWeb: Move the CSS parser into CSS/Parser/ 2020-07-28 19:23:18 +02:00
Andreas Kling cc4109c03b LibWeb: Move the HTML parser into HTML/Parser/ 2020-07-28 19:23:18 +02:00