Commit graph

21194 commits

Author SHA1 Message Date
Brian Gianforcaro
dc54a0fbd3 CMake: Verify the GCC host version is new enough to build serenity
There are lots of people who have issues building serenity because
they don't read the build directions closely enough and have an
unsupported GCC version as their host compiler. Instead of repeatedly
having to answer these kinds of questions, lets just error out upfront.
2021-05-31 14:28:50 +04:30
Andrew Kaster
0af192ff8d AK: Handle LEB128 encoded values that are too large for the result type
Previously, we would go crazy and shift things way out of bounds.
Add tests to verify that the decoding algorithm is safe around the
limits of the result type.
2021-05-31 14:25:27 +04:30
Andrew Kaster
c59cf0da07 AK: Add tests for LEB128 decoder 2021-05-31 14:25:27 +04:30
Luke
2ad25aa8f8 LibWeb: Return null in Window.{top,parent} if browsing context is null
We were asserting that it exists, but the spec says to return null in
this case.

Top: https://html.spec.whatwg.org/multipage/browsers.html#dom-top
Parent: https://html.spec.whatwg.org/multipage/browsers.html#dom-parent
2021-05-31 14:22:38 +04:30
Brian Gianforcaro
5bfba3f789 LibELF + LibDebug: Reduce allocations during symbolification
Avoid promotion of static strings to AK::String, instead use
AK::StringView and operator ""sv, to force string view's instead
which avoids allocation of String. This code path isn't hot enough
that it makes a huge difference, but every bit counts.
2021-05-31 14:09:11 +04:30
Brian Gianforcaro
35a97884aa Kernel: Move CommandLine API to use AK::StringView instead of AK::String
The current CommandLine API unfortunately allocates Strings just to
query the presence of arguments on the command line. Switch the API
to use StringView instead to reduce the number of String allocations.
2021-05-31 14:04:00 +04:30
Andreas Kling
89dceb178b Documentation: Remove outdated info about pls from build instructions 2021-05-31 08:53:21 +02:00
Gunnar Beutner
7dedf09f3d Toolchain: Remove dependency check for texinfo
Turns out we don't need that after all.
2021-05-30 23:36:10 +01:00
Andreas Kling
597539aa4c pls: Fix typo in TERM environment variable propagation 2021-05-30 23:13:52 +02:00
Andreas Kling
33f2eeea4a pls: Drastically simplify this program
Since this program is setuid-root, it should be as simple as possible.

To that end, remove `/etc/plsusers` and use filesystem permissions to
achieve the same thing. `/bin/pls` is now only executable by `root` or
members of the `wheel` group.

Also remove all the logic that went to great lengths to `unveil()` a
minimal set of filesystem paths that may be used for the command.
The complexity-to-benefit ratio did not seem justified, and I think
we're better off keeping this simple.

Finally, remove pledge promises the moment they are no longer needed.
2021-05-30 23:09:37 +02:00
Ben Wiederhake
dfd988707c Revert "AK: Fix accidentally-quadratic behavior in StringBuilder"
This reverts commit 2d011961c9.
2021-05-30 21:39:39 +01:00
Ben Wiederhake
05d49cc0cb LibCrypto: Fix bound checks when reading bitmaps
This only affects malformed RSA keys. Instead of accepting and
continuing with potentially broken pointers (and in ASAN, crashing), we
now consider bitmaps malformed, and stop parsing.

Found by OSS Fuzz: #31698, long-standing-bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31698

Fun fact: The "if" only exists because of OSS Fuzz.
8cc279ed74
2021-05-31 00:47:43 +04:30
Andreas Kling
3e0266c9e9 Kernel: Unnamed regions still need a null-terminator in core dumps
Fixes #7595.
2021-05-30 20:00:03 +02:00
Tim Schumacher
8c3e4ccd72 AK: Honor variable precision argument when formatting
printf didn't check whether the additional integer variable belongs to
the field width specifier or to the precision specifier, and always
applied it to the field width instead.

Implement the case distinction that we already use in literal width
and precision specifiers for the variable version as well so that
they are correctly attributed.
2021-05-30 18:45:06 +01:00
Tim Schumacher
d5bf9182dd LibC: Don't clear errno on success
POSIX (`errno(3p)`) states that errno should not be set to zero.

This helps with applications that don't expect errno to get updated
unless an intermediate syscall also fails.
2021-05-30 19:37:32 +02:00
Gunnar Beutner
01c75e3a34 Kernel: Don't log profile data before/after the process/thread lifetime
There were a few cases where we could end up logging profiling events
before or after the associated process or thread exists in the profile:

After enabling profiling we might end up with CPU samples before we
had a chance to synthesize process/thread creation events.

After a thread exits we would still log associated kmalloc/kfree
events. Instead we now just ignore those events.
2021-05-30 19:03:03 +02:00
brapru
d24dd7a3df Utilities: Implement ArmedScopeGuard in userdel to unlink temp files 2021-05-30 17:42:03 +01:00
brapru
af8b7248c8 LibC: Allow empty spwd members when writing shadow entries via putspent
Previously there was no way to output an empty value into the shadow
file entries when the spwd members were disabled. This would cause new
user entries to the shadow file to be cluttered with disabled values.
This commit checks if the spwd member value is diabled (-1) and will
output as appropriate.
2021-05-30 17:42:03 +01:00
brapru
54578ec5d4 Utilities: Update userdel to use /etc/shadow
Updates userdel to delete entries from /etc/shadow.

Fixes #4884
2021-05-30 17:42:03 +01:00
brapru
ff4f3dd586 Utilities: Update useradd to use /etc/shadow
This updates useradd to write the spwd struct entry into
the /etc/shadow file via putspent.

Fixes #4884
2021-05-30 17:42:03 +01:00
brapru
1560775494 Utilities: Change default shell of useradd to /bin/sh 2021-05-30 17:42:03 +01:00
Edwin Hoksberg
e68780e1ad WebServer: Put dbgln's behind WEBSERVER_DEBUG
These dbgln's caused excessive load in the WebServer process,
accounting for ~67% of the processing time when serving a webpage
with a bunch of resources like serenityos.org/happy/2nd/.
2021-05-30 17:41:56 +01:00
Max Wipfli
a557f83f8c AK: Verify that m_impl is non-null in String::operator[]
This helps to find bugs where null strings are indexed into with
operator[], as this would previously only report a RefPtr null
dereference.
2021-05-30 17:41:49 +01:00
Tim Schumacher
040d2479bf Ports: Add port for wget 2021-05-30 14:56:50 +01:00
Tim Schumacher
c2b47c0676 LibC: Add stubs for wctype and iswctype 2021-05-30 14:56:50 +01:00
Tim Schumacher
d364abe4d5 LibC: Stub out btowc
wint_t is also not supposed to be defined by sys/types.h, but should
be defined in wchar.h instead. Since we require it for our definition of
btowc, let's move it to the correct place.
2021-05-30 14:56:50 +01:00
Tim Schumacher
ccef5fe234 LibC: Implement __fpurge 2021-05-30 14:56:50 +01:00
Tim Schumacher
cd970928a0 LibC: Implement getprogname and setprogname 2021-05-30 14:56:50 +01:00
Tim Schumacher
a3b4e43dd8 LibC: Implement __freading and __fwriting
These functions are used by gnulib (and therefore many GNU utilities)
to provide access to internal details of the stdio FILE structure.
2021-05-30 14:56:50 +01:00
Ben Wiederhake
a49c77b76d LibGfx: Load correct durations for gifs
The wrong shift effectively set the upper byte to 0, meaning that
durations longer than 255 centiseconds (2.55 seconds) were wrapped
around. See serenity-fuzz-corpora for an example.
2021-05-30 14:42:34 +01:00
Ben Wiederhake
774107f37c Fuzz+LibGfx: When fuzzing GIFLoader, try to load all frames 2021-05-30 14:42:34 +01:00
Ben Wiederhake
2d011961c9 AK: Fix accidentally-quadratic behavior in StringBuilder
Found by OSS Fuzz:
#34451 (old bug)

Related commit: 3908a49661
2021-05-30 14:39:30 +01:00
Andrew Kaster
7b4dc590e7 AK+Userland: Use akaster@serenityos.org for my copyright headers 2021-05-30 14:35:34 +01:00
Linus Groh
75ea1bd346 WebServer: Exit when the given port is invalid
Similar to an invalid listen address, we should not fallback to the
default port (8000) but instead exit with an error.
2021-05-30 14:11:53 +01:00
Linus Groh
7fa3033ca8 WebServer: Replace printf()/fprintf(stderr) with outln()/warnln() 2021-05-30 14:07:58 +01:00
Linus Groh
5d80aab038 which: Replace printf() with outln()/warnln() 2021-05-30 14:07:58 +01:00
Linus Groh
7b79758fc6 userdel: Replace fprintf(stderr) with warnln() 2021-05-30 14:07:58 +01:00
Linus Groh
65528d86d5 ntpquery: Replace printf()/fprintf(stderr) with out{,ln}()/warnln() 2021-05-30 14:07:58 +01:00
Andreas Kling
c584421592 AK: Make HashTable::operator=(HashTable&&) clear the moved-from table
This is consistent with how other AK containers behave when moved from.
2021-05-30 14:34:32 +02:00
Gunnar Beutner
259822493f Toolchain: Check whether required tools and libraries are available
Rather than having the toolchain build fail half-way through we should
check whether the user has installed all the required tools and
libraries early on.
2021-05-30 13:06:28 +01:00
Edwin Hoksberg
2deffeb74d WebServer: Add optional listen address argument
With this we can make the Webserver listen on
another address than the default of "0.0.0.0".
2021-05-30 13:03:59 +01:00
Andreas Kling
4190fd2199 LibWeb: Rename Web::Frame to Web::BrowsingContext
Our "frame" concept very closely matches what the web specs call a
"browsing context", so let's rename it to that. :^)

The "main frame" becomes the "top-level browsing context",
and "sub-frames" are now "nested browsing contexts".
2021-05-30 12:39:53 +02:00
sin-ack
8be98af77c AK: Declare malloc_good_size as extern "C"
This would otherwise cause an error with clang when __serenity__ wasn't
defined.
2021-05-30 11:10:47 +01:00
Brendan Coles
340cecaf80 pls: Unveil search paths with browse permissions 2021-05-30 10:41:25 +01:00
Ali Mohammad Pur
f387da4a90 LibTest+test-js: Add back the lost test262 parser test option
Fixes #7566.
2021-05-30 10:34:44 +01:00
Ali Mohammad Pur
724b89f90c LibJS: Make missing variable decls in for..in/of a syntax error
...instead of a hard crash :P
2021-05-30 10:34:44 +01:00
Ali Mohammad Pur
e10006b3fa LibJS: Don't try to parse binding patterns after a syntax error
Otherwise we'd be spinning there forever.
2021-05-30 10:34:44 +01:00
Idan Horowitz
6bfeb87572 LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-30 10:32:05 +01:00
Andreas Kling
460c0f9847 LibGUI: Don't scroll TreeView horizontally to bring index into view
This behavior was really irritating and basically never what you wanted
so let's stop doing it.
2021-05-30 09:28:19 +02:00
Andreas Kling
42b27d9f87 LibGUI: Avoid a bunch of virtual calls during TreeView painting
The index of the tree column will not change while painting.
Neither will the number of columsn. So avoid a whole bunch of virtual
function calls by caching these two values at the start of painting.
2021-05-30 09:05:37 +02:00