Commit Graph

286 Commits

Author SHA1 Message Date
Lenny Maiorani
765936ebae
Everywhere: Switch from (void) to [[maybe_unused]] (#4473)
Problem:
- `(void)` simply casts the expression to void. This is understood to
  indicate that it is ignored, but this is really a compiler trick to
  get the compiler to not generate a warning.

Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.

Note:
- Functions taking a `(void)` argument list have also been changed to
  `()` because this is not needed and shows up in the same grep
  command.
2020-12-21 00:09:48 +01:00
Andreas Kling
822dc56ef3 LibGUI: Introduce GML - a simple GUI Markup Language :^)
This patch replaces the UI-from-JSON mechanism with a more
human-friendly DSL.

The current implementation simply converts the GML into a JSON object
that can be consumed by GUI::Widget::load_from_json(). The parser is
not very helpful if you make a mistake.

The language offers a very simple way to instantiate any registered
Core::Object class by simply saying @ClassName

@GUI::Label {
    text: "Hello friends!"
    tooltip: ":^)"
}

Layouts are Core::Objects and can be assigned to the "layout" property:

@GUI::Widget {
    layout: @GUI::VerticalBoxLayout {
        spacing: 2
        margins: [8, 8, 8, 8]
    }
}

And finally, child objects are simply nested within their parent:

@GUI::Widget {
    layout: @GUI::HorizontalBoxLayout {
    }
    @GUI::Button {
        text: "OK"
    }
    @GUI::Button {
        text: "Cancel"
    }
}

This feels a *lot* more pleasant to write than the JSON we had. The fact
that no new code was being written with the JSON mechanism was pretty
telling, so let's approach this with developer convenience in mind. :^)
2020-12-20 11:59:40 +01:00
Andreas Kling
48d74c5356 LibHTTP: Make HTTPRequest::from_raw_request() take a ReadonlyBytes
This allows us to get rid of some ByteBuffer::wrap() usage.
2020-12-19 18:29:13 +01:00
AnotherTest
eb7a943641 Meta: Set a 10 second timeout on Shell tests
Shell-backgrounding seems to be deadlocking at times, until that's
fixed, let's not take 5 hours to fail the build.
2020-12-15 20:58:32 +01:00
Itamar
b1e01066fe Lagom/Fuzzers: Fix creation of ELF::Loader 2020-12-14 23:05:53 +01:00
Itamar
e2d695eabb Build: Build libgcc_s.so
This is the shared version of libgcc
2020-12-14 23:05:53 +01:00
Ben Wiederhake
4b4f23165f Meta+LibHTTP: Fuzz HTTP request parsing 2020-12-02 10:46:40 +01:00
Ben Wiederhake
e85aad6acc Meta: Always check completeness of ALL_THE_DEBUG_MACROS 2020-12-01 11:06:53 +01:00
Ben Wiederhake
59091e1861 Meta: Nicer wording in lint 2020-12-01 11:06:53 +01:00
Ben Wiederhake
a0f6db246e Meta: Document fuzz dump 2020-12-01 11:06:23 +01:00
Luke
030dac8c4d Lagom/Fuzzers: Add URL fuzzer 2020-11-30 11:35:16 +01:00
Luke
5c911ad4b1 Meta: Add GitHub Actions workflow for Lagom with Fuzzers
There are cases where Lagom will build with GCC but not Clang.
This often goes unnoticed for a while as we don't often build with
Clang.

However, this is now important to test in CI because of the
OSS-Fuzz integration.

Note that this only tests the build, it does not run any tests.
Note that it also only builds LagomCore, Lagom and the fuzzers.
It does not build the other programs that use Lagom.
2020-11-29 20:22:56 +01:00
Nico Weber
29e4dc7634 Lagom: Mention OSS-Fuzz in ReadMe
We added OSS-Fuzz integration in #4154, but documentation about it
is spread across several pull requests, IRC, and issues. Let's collect
the important bits in the ReadMe.
2020-11-29 20:22:09 +01:00
AnotherTest
1ecea2f105 Lagom: Add a Shell parser fuzzer 2020-11-29 16:22:44 +01:00
Linus Groh
6a37285d93 Lagom: Add Regex fuzzers 2020-11-29 09:29:26 +01:00
DavidKorczynski
ff8ac60184
Lagom: Various fixes to make Lagom run on OSS-Fuzz (#4176) 2020-11-27 23:57:02 +01:00
Emanuel Sprung
55450055d8 LibRegex: Add a regular expression library
This commit is a mix of several commits, squashed into one because the
commits before 'Move regex to own Library and fix all the broken stuff'
were not fixable in any elegant way.
The commits are listed below for "historical" purposes:

- AK: Add options/flags and Errors for regular expressions

Flags can be provided for any possible flavour by adding a new scoped enum.
Handling of flags is done by templated Options class and the overloaded
'|' and '&' operators.

- AK: Add Lexer for regular expressions

The lexer parses the input and extracts tokens needed to parse a regular
expression.

- AK: Add regex Parser and PosixExtendedParser

This patchset adds a abstract parser class that can be derived to implement
different parsers. A parser produces bytecode to be executed within the
regex matcher.

- AK: Add regex matcher

This patchset adds an regex matcher based on the principles of the T-REX VM.
The bytecode pruduced by the respective Parser is put into the matcher and
the VM will recursively execute the bytecode according to the available OpCodes.
Possible improvement: the recursion could be replaced by multi threading capabilities.

To match a Regular expression, e.g. for the Posix standard regular expression matcher
use the following API:

```
Pattern<PosixExtendedParser> pattern("^.*$");
auto result = pattern.match("Well, hello friends!\nHello World!"); // Match whole needle

EXPECT(result.count == 1);
EXPECT(result.matches.at(0).view.starts_with("Well"));
EXPECT(result.matches.at(0).view.end() == "!");

result = pattern.match("Well, hello friends!\nHello World!", PosixFlags::Multiline); // Match line by line

EXPECT(result.count == 2);
EXPECT(result.matches.at(0).view == "Well, hello friends!");
EXPECT(result.matches.at(1).view == "Hello World!");

EXPECT(pattern.has_match("Well,....")); // Just check if match without a result, which saves some resources.
```

- AK: Rework regex to work with opcodes objects

This patchsets reworks the matcher to work on a more structured base.
For that an abstract OpCode class and derived classes for the specific
OpCodes have been added. The respective opcode logic is contained in
each respective execute() method.

- AK: Add benchmark for regex

- AK: Some optimization in regex for runtime and memory

- LibRegex: Move regex to own Library and fix all the broken stuff

Now regex works again and grep utility is also in place for testing.
This commit also fixes the use of regex.h in C by making `regex_t`
an opaque (-ish) type, which makes its behaviour consistent between
C and C++ compilers.
Previously, <regex.h> would've blown C compilers up, and even if it
didn't, would've caused a leak in C code, and not in C++ code (due to
the existence of `OwnPtr` inside the struct).

To make this whole ordeal easier to deal with (for now), this pulls the
definitions of `reg*()` into LibRegex.

pros:
- The circular dependency between LibC and LibRegex is broken
- Eaiser to test (without accidentally pulling in the host's libc!)

cons:
- Using any of the regex.h functions will require the user to link -lregex
- The symbols will be missing from libc, which will be a big surprise
  down the line (especially with shared libs).

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2020-11-27 21:32:41 +01:00
Nico Weber
f160df123b Lagom: Rename FuzzBMP to FuzzBMPLoader 2020-11-26 09:59:46 +01:00
Nico Weber
ec4c2f971b Lagom: Make BMP fuzzer look like the other image loader fuzzers 2020-11-26 09:59:46 +01:00
Nico Weber
4f12efe191 Lagom: Add fuzzers for remaining image loaders: ICO, PNG, PBM, PGM 2020-11-26 09:59:46 +01:00
Ben Wiederhake
ec36388f40 Meta: Reduce IRC spam
Fixes #4145.
2020-11-25 20:50:22 +01:00
Linus Groh
4e68f179d6 Lagom: Fix FuzzJs build
This was broken with the JS::Parser::Error position changes, but I don't
actually see a reason to do anything with the parser errors here, so
let's remove it and consider simply not crashing a success. :^)
2020-11-25 20:00:23 +01:00
Nico Weber
f13a38aa4d Lagom: Add a gif loader fuzzer 2020-11-20 21:17:58 +01:00
Nico Weber
812892ef86 Lagom: Add a jpg fuzzer 2020-11-19 21:21:45 +01:00
Nico Weber
3f3a7d128b Lagom: Make fuzzer cmake less repetitive 2020-11-19 21:21:45 +01:00
Nico Weber
f5967c4745 Lagom: Add a PPM fuzzer
It finds the problem fixed in 69518bd178 but nothing else.
2020-11-19 14:04:35 +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
Ben Wiederhake
ef9ac8a8a2 Meta: Use SerenityBot for IRC notifications
This avoids "useless" join/part notifications.
2020-11-14 15:30:29 +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
Ben Wiederhake
cf9419fc4f Meta: Nicer IRC notifications 2020-11-13 08:56:56 +01:00
Nico Weber
5c2e8b6189 Lagom: Add ntpquery to lagom build 2020-11-12 21:21:33 +01:00
Nico Weber
5fcd34b810 Userland: Add an "adjtime" utility
It's a thin userland wrapper around adjtime(2). It can be used
to view current pending time adjustments, and root can use it to
smoothly adjust the system time.

As far as I can tell, other systems don't have a userland utility
for this, but it seems useful. Useful enough that I'm adding it to
the lagom build so I can use it on my linux box too :)
2020-11-10 19:03:08 +01:00
Linus Groh
46cd9157cd Lagom/Fuzzers: Add a Dockerfile for FuzzilliJs
Based on Fedora. This allows building and running FuzzilliJs and Fuzzilli
itself in a Docker/Podman container.
2020-11-08 11:01:07 +01:00
Ben Wiederhake
3cd39097f6 Meta: Add script that runs all lints 2020-11-08 09:58:55 +01:00
Linus Groh
2c9e6585f8 Documentation: Update required GCC version to >= 10
I initially thought as long as Lagom is not built >= 9 would be fine,
but LagomCore is always built for the code generators.
2020-11-07 18:22:18 +01:00
Luke
8928607455 Lagom/Fuzzers: Add Fuzzilli version of FuzzJs
Fuzzilli is a JavaScript engine fuzzer made by googleprojectzero.

https://github.com/googleprojectzero/fuzzilli/
2020-11-07 10:09:55 +01:00
Linus Groh
21912123c4 Travis: Update host GCC to version 10
This allows us to use the latest C++20 features in programs which we
compile and run as part of Lagom.
2020-11-02 13:12:35 +01:00
Brendan Coles
c1bfb8cb0e Meta: lint-shell-scripts: Exit if shellcheck is not installed 2020-11-01 10:29:33 +01:00
AnotherTest
37c089fb7b LibTLS: (Almost) verify certificate chain against root CA certificates
Also adds a very primitive systemwide ca_certs.ini file.
2020-10-30 23:42:03 +01:00
asynts
607931268e CMake: Use CONFIGURE_DEPENDS in existing globs. 2020-10-29 11:52:47 +01:00
Laurent Cimon
b4790010a8 Build: Modify various parts to allow the build to succeed on FreeBSD 2020-10-20 14:40:47 +02:00
Andreas Kling
75d5f436bc Toolchain: Upgrade to GCC 10.2.0 2020-10-12 19:53:25 +02:00
Linus Groh
bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
Ben Wiederhake
df4c9b729d Meta: Provide script to automatically flag bad formatting 2020-09-25 21:18:17 +02:00
Valtteri Koskivuori
f0fdbb1d83 Meta: Fix build-root-filesystem.sh on macOS 2020-09-20 21:45:00 +02:00
Tom
e317ee7541 Meta: Add env variable SERENITY_RUN to be able to choose qemu, bochs, etc
This allows picking for example bochs: SERENITY_RUN=b ninja run
2020-09-19 00:33:02 +02:00
AnotherTest
961661ea1d Build: Preserve hard/symbolic links when building root fs
This fixes the issue where there would not be enough space to copy
things when at least the git port and the gcc port are installed.
2020-09-16 15:56:35 +02:00
Andreas Kling
2b17d980cf Meta: Include .json files in the Qt Creator refresh script 2020-09-14 19:55:18 +02:00
Andreas Kling
2f97590409 Meta: Make the text-to-cpp-string thingy pass shellcheck 2020-09-14 16:33:53 +02:00
Andreas Kling
40892ac72e Meta: Add helper for generating a C++ string from a text file 2020-09-14 16:16:36 +02:00
Linus Groh
e9562e1920 Userland: Add {md5,sha1,sha256,sha512}sum 2020-09-13 11:37:56 +02:00
Ben Wiederhake
8498a5678d Meta: Avoid deprecated qemu option
Apparently "-soundhw pcspk" is deprecated too. However, I don't know which "name"
to insert, and I can't test it, hence I didn't touch it.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
25ccd40d5a Meta: Describe how to analyze an LLVM fuzzer crash 2020-09-12 00:13:29 +02:00
Ben Wiederhake
98bfcb4b57 Meta+LibGfx: Fuzz BMP parsing 2020-09-12 00:13:29 +02:00
Ben Wiederhake
5d3c437cce LibJS: Fix start position of multi-line tokens
This broke in case of unterminated regular expressions, causing goofy location
numbers, and 'source_location_hint' to eat up all memory:

Unexpected token UnterminatedRegexLiteral. Expected statement (line: 2, column: 4294967292)
2020-09-12 00:13:29 +02:00
Andreas Kling
18ff9c3fc2 Meta: Fix shellcheck whines in check-symbols.sh 2020-09-07 00:00:12 +02:00
Itamar
1c20e684f3 Travis: Run script that checks for forbidden symbols in LibC
check-symbols.sh fails the build if undefined __cx_guard_* symbols are
found in  LibC.

This will help us catch port breakage sooner.
2020-09-06 21:36:36 +02:00
Andreas Kling
dcd47655d0 utmpupdate: Add a program for updating /var/run/utmp
To keep track of ongoing terminal sessions, we now have a sort-of
traditional /var/run/utmp file, like other Unix systems.
Unlike other Unix systems however, ours is of course JSON. :^)

The /bin/utmpupdate program is used to update the file, which is
not writable by regular user accounts. This helper program is
set-GID "utmp".
2020-09-06 16:10:27 +02:00
Ben Wiederhake
c8668e9b7c Meta: Fix wonky copyright headers in Tests 2020-09-05 14:19:38 +02:00
Andreas Kling
e834c24eea Kernel/USB: Start fleshing out a basic UHCI controller driver :^)
Let's see if we can talk to some USB devices. We will now detect
a UHCI controller if present on the PCI bus.
2020-09-04 21:21:41 +02:00
Andreas Kling
e002cbb06b Build: Add some -Wno-unknown-warning-option flags to CXXFLAGS
Patch from Anonymous.
2020-09-01 12:00:53 +02:00
AnotherTest
465d46c665 Meta+Userland: Run the TLS test too
While this _does_ add a point of failure, it'll be a pretty bad day when
google goes down.
And this is unlikely to put a (positive) dent in their incoming
requests, so let's just roll with it until we have our own TLS server.
2020-08-24 09:29:39 +02:00
Andreas Kling
370624bc37 Meta: Actually exclude the Build/ directory from QtCreator refresh 2020-08-16 16:44:09 +02:00
Ben Wiederhake
8d680dd1ad Meta: Lint for duplicate endpoint IDs
We currently have 16 endpoints. The IDs are typed by a human at creation time.
This check will detect with we ever use an endpoint ID twice.

Since the large irrelevant directories are ignored, this should be quick enough.
2020-08-15 20:48:52 +02:00
Ben Wiederhake
f19b88c965 Meta: Don't require setting SERENITY_ROOT for refresh script
The need for SERENITY_ROOT was basically eliminated in
73c953b674. The existing guess
'git rev-parse --show-toplevel' should be correct in all conceivable cases.
Most code just assumes the layout in git, or depends on SERENITY_ROOT as
set in the CMakeLists.txt. *Requiring* the user to set it doesn't make
sense anymore.

While I was in there anyway, I added exit code propagation. Also, 'find' should
be a tad faster now, because it doesn't enumerate files in the large ignored
directories Build/ and Toolchain/ anymore.
2020-08-15 13:38:24 +02:00
Andreas Kling
a37331e236 Lagom: Add LibHTTP to Lagom (it builds fine without changes) 2020-08-15 00:05:45 +02:00
Peter Nelson
a8ad0d120d Meta: allow override of QEMU -cpu argument via environment variable
Introduces a SERENITY_QEMU_CPU environment variable that allows
overriding of the qemu -cpu command line parameter. If not specified,
the argument defaults to "max".

The primary motivation behind this is to be able to enable or disable
specific features for the vCPU in order to workaround QEMU issues with
certain hardware accelerators. For example, QEMU on Windows with WPHX
sometimes fails to start unless Virtual Machine eXtensions are
disabled. This can now be done with:

  export SERENITY_QEMU_CPU="max,vmx=off"
2020-08-14 15:09:59 +02:00
Linus Groh
b1e8807bc5 Meta: Check that "#include <LibM/math.h>" is not being used 2020-08-12 16:18:33 +02:00
Nico Weber
00f658b984
Lagom+LibELF: Add an ELF fuzzer, and tweak the code to survive a few minutes of fuzzing (#3071)
If a buffer smaller than Elf32_Ehdr was passed to Image, header()
would do an out-of-bounds read.

Make parse() check for that. Make most Image methods assert that the image
is_valid(). For that to work, set m_valid early in Image::parse()
instead of only at its end.

Also reorder a few things so that the fuzzer doesn't hit (valid)
assertions, which were harmless from a security PoV but which still
allowed userspace to crash the kernel with an invalid ELF file.

Make dbgprintf()s configurable at run time so that the fuzzer doesn't
produce lots of logspam.
2020-08-10 15:55:17 +02:00
Nico Weber
700f5cfc90 Lagom: Pass -Wno-deprecated-copy to clang too
Due to Serenity's use of concepts, it now requires clang 10 or newer,
and clang 10 or newer both understands and requires
-Wno-deprecated-copy.
2020-08-09 21:13:06 +02:00
Nico Weber
9c136be08b disasm: For ELF files, disassemble .text section
Since disasm is built in lagom, this requires adding LibELF to lagom.
2020-08-09 21:12:54 +02:00
Luke
4b6036bc33 Meta: Update CLion configuration to include LibM and generated files
Also bumps the CXX Standard to C++20.
2020-08-06 09:43:03 +02:00
Nico Weber
a619943001 Build: Make things build with clang without needing local changes
Useful for sanitizer fuzzer builds.

clang doesn't have a -fconcepts switch (I'm guessing it just enables
concepts automatically with -std=c++2a, but I haven't checked),
and at least the version on my system doesn't understand
-Wno-deprecated-move, so pass these two flags only to gcc.
In return, disable -Woverloaded-virtual which fires in many places.

The preceding commits fixed the handful of -Wunused-private-field
warnings that clang emitted.
2020-08-04 17:42:08 +02:00
Ben Wiederhake
aaa13e5739 Meta: Provide a way to only update a file if the output changes
This is only useful for build commands that update their destination in all cases
and thus sometimes confuse cmake into rebuilding everything needlessly.
2020-08-04 11:27:14 +02:00
stelar7
98e18d7339 LibCompress: Add LibCompress
For now this only contains DEFLATE, and a very simple Zlib
Eventually GZip, etc. can go here as well.
2020-08-04 11:27:07 +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
Ben Wiederhake
eccf96b703 Meta: Find potentially missing resources 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
Peter Elliott
fc425a218d Meta: Fix style of image building scripts
Oops. I didn't know there was a style guide for the scripts.
2020-07-28 19:09:44 +02:00
Peter Elliott
6f12ab3ced Meta: Calculate image size based on size of Build/Root and Base
This reduces the size of the default build, while allowing people to
install as many ports as they want, without having to manually specify
disk size.
2020-07-28 18:32:05 +02:00
Peter Elliott
207fb054e5 Userland: Add passwd utility 2020-07-28 17:07:22 +02:00
Andreas Kling
96dce6893f Lagom: Build with -std=c++2a -Wno-deprecated-copy 2020-07-27 21:54:22 +02:00
Nico Weber
3f45e9ab1e Lagom: Add LibGemini, LibGfx
They are dependencies of LibWeb and might be useful for
running test-web on GitHub actions one day.
2020-07-23 23:02:28 +02:00
Luke
60599d03dd LibWeb+test-web: Create test-web program, add doctype test
LibWeb currently has no test suite or program. Let's change that :^)

test-web is mostly a copy of test-js, but modified for LibWeb.
test-web imports both LibJS/Tests/test-common.js and
LibWeb/Test/test-common.js

LibWeb's suite provides the ability to specify the page to load,
what to do before the page is loaded, and what to do after it's
loaded.

This also provides a test of document.doctype and its close sibling
document.compatMode.

Currently, this isn't added to Lagom because of CodeGenerators.
2020-07-23 13:11:41 +02:00
Nico Weber
c22790adb2 Lagom: Add a markdown fuzzer 2020-07-14 17:45:16 +02:00
Nico Weber
417caeb14a Lagom: Add a note on how to build the fuzzers to readme 2020-07-14 17:45:16 +02:00
Andreas Kling
81ea9d1ef6 Base: Turn a whole bunch of /bin symlinks into shell aliases :^) 2020-07-07 11:35:22 +02:00
Matthew Olsson
b9cf7a833f LibJS/test-js: Create test-js program, prepare for test suite refactor
This moves most of the work from run-tests.sh to test-js.cpp. This way,
we have a lot more control over how the test suite runs, as well as how
it outputs. This should result in some cool functionality!

This commit also refactors test-common.js to mimic the jest library.
This should allow tests to be much more expressive :)
2020-07-06 23:40:35 +02:00
Nico Weber
e91dd14fab run.sh: Remove cpu_reset debug output
It's fairly wordy and early OS startup seems to work well,
so this doesn't have to be on by default.
2020-07-06 17:03:26 +02:00
AnotherTest
2b80a45f82 Meta: Do not run shellcheck on our Shell's scripts 2020-07-05 15:43:14 +02:00
AnotherTest
639c1a1737 Shell: Build as part of Lagom as well
Bringing the Serenity Shell to your very own host system :^)
2020-07-05 15:43:14 +02:00
Andreas Kling
8661af9b72 Profiler: Rename from ProfileViewer :^) 2020-07-01 19:43:17 +02:00
Emanuele Torre
6f8042d8e5 Meta: make Meta/run.sh qgrub work. 2020-07-01 12:53:39 +02:00
Emanuele Torre
8f071137d1 Meta: Give SERENITY_ROOT a default value in CLion/run.sh 2020-07-01 12:53:39 +02:00
Emanuele Torre
e62475d6e7 Meta: run.sh: fix usage comments 2020-07-01 12:53:39 +02:00
Emanuele Torre
1d9791bcdf Meta: Allow running run.sh from any where by setting SERENITY_BUILD
If SERENITY_BUILD is not set or empty, SERENITY_BUILD is treated as if
it was set to '.'.

`run.sh` will cd to SERENITY_BUILD before running the emulator.

Also, export SERENITY_BUILD in `Meta/CLion/run.sh` since we are using it
in `Meta/run.sh`.

Also, allow using a different bochs configuration file by setting the
SERENITY_BOCHSRC variable.
2020-07-01 12:53:39 +02:00
Emanuele Torre
aabb482d5c Meta: move Kernel/.bochsrc => Meta/bochsrc
The run script is not in Kernel/ anymore, let's move `.bochsrc` in Meta/
so that it can be used with the new build system.

Also make bochs use `grub_disk_image` instead of `_disk_image`
2020-07-01 12:53:39 +02:00
Emanuele Torre
86685623a2 Meta: CLion/run.sh should be executable 2020-07-01 12:53:39 +02:00
Emanuele Torre
8233ab197f Meta: make CLion/run.sh use run.sh
We don't need to copy `run.sh` and modify it: we can just set
environment variables.

Now, we don't have to modify two files everytime we make a change to the
run.sh script.

Also make SERENITY_BUILD overridable with environment variables,why not?
2020-07-01 12:53:39 +02:00
Emanuele Torre
f7f1c3d748 Meta: use "better" syntax to set SERENITY_KERNEL_CMDLINE in run.sh :^)
This removes some FIXMEs.

In bash, we could avoid `shift`:
    SERENITY_KERNEL_CMDLINE="${@:2}"

But let's stick to POSIX sh for now.
2020-07-01 12:53:39 +02:00
Emanuele Torre
0cee39355c Meta: quote variables in run.sh where it makes sense 2020-07-01 12:53:39 +02:00
AnotherTest
880c3fb83f Userland: Add a 'test' utility
This adds an incomplete implementation of the test util, missing some
user/group checks, and `-l STRING`.
It also symlinks '[' to 'test'.
2020-06-27 16:08:52 +02:00
Emanuele Torre
8e24a17d0d Meta: default SUDO_UID and SUDO_GID to 0 in build-image-*.sh scripts
In the GNU coreutils version of chown, ":" is a valid argument
(the command will result in a no-op), but POSIX chown does not
consider that valid.

If the user who ran build-image-*.sh was root, SUDO_UID and SUDO_GID
would not be set and, if the version of chown installed on the system
did not allow passing just a ":" as argument, the script would fail.

Let's default the value of SUDO_UID and SUDO_GID to 0 just in case.
2020-06-21 10:13:04 +02:00
Emanuele Torre
4a784d4d1b Meta: get rid of sync.sh using the technique used in the previous commit 2020-06-21 10:13:04 +02:00
Emanuele Torre
e42f4abd61 Meta: tweak build-image-grub.sh to allow running make grub-image..
without sudo.
2020-06-21 10:13:04 +02:00
Andreas Kling
fbfae033cc Meta: Tweak QtCreator .files sync script to include .idl files 2020-06-21 00:58:55 +02:00
Andreas Kling
6e78279614 keymap: Add back a tiny utility for setting the system keyboard layout
This patch removes the setuid-root flag from the KeyboardSettings GUI
application and adds back the old "keymap" program.

It doesn't feel very safe and sound to have a GUI program runnable
as setuid-root, so in the next patch I'll be making KeyboardSettings
call out to the "keymap" program to do its bidding.
2020-06-18 22:19:57 +02:00
Andreas Kling
c45c5ded34 WebContent: Start work on browser process separation :^)
The "WebContent" service provides a very restricted instance of LibWeb
running as an unprivileged user account. This will be used to implement
process separation in Browser, among other things.

This first cut of the service only spawns a single WebContent process
when someone connects to /tmp/portal/webcontent. We will soon switch
this over to spawning a new process for each connection.

Since this feature is very immature, we'll be bringing it up inside of
Demos/WebView as a separate demo program. Eventually this will become
a reusable widget that anyone can embed and easily get out-of-process
web content in their GUI.

This is pretty, pretty cool! :^)
2020-06-17 20:09:44 +02:00
Andreas Kling
723f4e5ee6 Meta: Scale back overly informal user-facing strings
We were getting a little overly memey in some places, so let's scale
things back to business-casual.

Informal language is fine in comments, commits and debug logs,
but let's keep the runtime nice and presentable. :^)
2020-06-17 18:35:49 +02:00
Sergey Bugaev
8ecac16c03 Base+Meta: Rename the wheel group to goodboys :^) 2020-06-17 15:02:03 +02:00
Matthew Olsson
e8e728454c AK: JsonParser improvements
- Parsing invalid JSON no longer asserts
    Instead of asserting when coming across malformed JSON,
    JsonParser::parse now returns an Optional<JsonValue>.
- Disallow trailing commas in JSON objects and arrays
- No longer parse 'undefined', as that is a purely JS thing
- No longer allow non-whitespace after anything consumed by the initial
  parse() call. Examples of things that were valid and no longer are:
    - undefineddfz
    - {"foo": 1}abcd
    - [1,2,3]4
- JsonObject.for_each_member now iterates in original insertion order
2020-06-13 12:43:22 +02:00
Andreas Kling
5448a670c0 Base: Symlink /dev/urandom to /dev/random
Some software expects to find /dev/urandom so we might as well provide.
Gets rid of one dropbear patch. :^)
2020-06-08 21:42:33 +02:00
Hüseyin ASLITÜRK
ddeb0ab1ad Applications: Add new KeyboardSettings application
GUI application to manage Keyboard settings.
2020-06-08 09:28:18 +02:00
AnotherTest
40829b849a Meta: Run Crypto tests in CI
We skip the tests that are not self-contained (TLS) to avoid adding
extra variables to the tests.
2020-06-07 19:29:40 +02:00
Nico Weber
7675812efd build-root-filesystem: Explicitly add +rX for group and others to copied files.
This lets Serenity boot even when the repository is cloned with a
umask of 027.
2020-06-05 09:30:42 +02:00
Nico Weber
309a91847f build-root-filesystem: Move "cp -R" block up.
I want to add a "chmod -R" right after the cp command.
This needs to happen before all the other chmods, to not
undo their effect.
2020-06-05 09:30:42 +02:00
Nico Weber
1539a976c8 run.sh: Pass -drive instead of -hda to qemu.
run.sh currently makes qemu print this as the very first output:

WARNING: Image format was not specified for '_disk_image' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.

This is scary for people who don't know that this is normal, and
write operations to block 0 being restricted could be confusing
for some operations happening from within serenity too at some point.

So specify the 'raw' format explicitly, like the warning suggests.
Requires using -drive instead of -hda.

From `man qemu-system`:

    Instead of -hda, -hdb, -hdc, -hdd, you can use:
        qemu-system-x86_64 -drive file=file,index=0,media=disk

So use that, and also pass format=raw.
2020-06-05 09:29:02 +02:00
Andreas Kling
1c6e4e04a8 Meta: Time for a new screenshot! :^)
This one is pretty similar to the previous one, but the increase in
polish is noticeable.
2020-06-02 19:29:31 +02:00
Sergey Bugaev
80f671e16c Lagom: Fix target name 2020-06-01 17:37:44 +02:00
Emanuele Torre
d963be795d Meta: update lint-shell-scripts.sh so that it does not search in Build/
We now use git-ls-files(1) instead of find(1).
2020-05-29 07:59:45 +02:00
Emanuele Torre
937d0be762 Meta: Add a script check the presence of "#pragma once" in header files
.. and make travis run it.

I renamed check-license-headers.sh to check-style.sh and expanded it so
that it now also checks for the presence of "#pragma once" in .h files.

It also checks the presence of a (single) blank line above and below the
"#pragma once" line.

I also added "#pragma once" to all the files that need it: even the ones
we are not check.
I also added/removed blank lines in order to make the script not fail.

I also ran clang-format on the files I modified.
2020-05-29 07:59:45 +02:00
etaIneLp
330aecb5d8
Build: Use a separate byproduct name for the GRUB disk image (#2424)
The grub-image target no longer conflicts with normal image target.
This unbreaks using CMake with Ninja.

Fixes #2423.
2020-05-28 10:08:38 +02:00
etaIneLp
7bc871ca8d Kernel: Stop bootloader from setting video mode with Multiboot
Meta: Update INSTALL.md and grub configs for new boot_mode option
2020-05-28 00:50:55 +02:00
etaIneLp
2ec07655cf Meta: Grub configs use correct kernel image name 2020-05-28 00:50:55 +02:00
etaIneLp
0c1ed0ebf3 Meta: build-image-grub.sh looks for grub configs in the right place 2020-05-28 00:50:55 +02:00
Andreas Kling
5f9de61bf2 Lagom: Build LibCrypto, LibTLS and test-crypto :^) 2020-05-27 12:28:39 +02:00
Nick Vella
e53fa97cfb LibGUI, About: Implement system-wide W2k-esque About dialog
The new About dialog reads version information from /res/version.ini,
which is generated at build time.
2020-05-27 11:44:19 +02:00
Itamar
773ed930cb Debugger: Re-introduce the sdb alias 2020-05-24 10:42:21 +02:00
Yonatan Goldschmidt
00c0650f96 Build: Add Dockerfile 2020-05-22 01:19:15 +02:00
Andreas Kling
58fa9c6e89 PixelPaint: Rename from PaintBrush :^) 2020-05-20 20:35:35 +02:00
Devashish
e4f7080bbd Meta: Update CLion and WSL configuration documentations
This commit updates CLionConfiguration.md and NotesOnWSL.md so that
they comply with new build system. In addition to that, the WSL doc
is updated to include instructions to run qemu (and serenity) natively
on Windows, without needing an X-window server.
2020-05-17 23:07:35 +02:00
Shannon Booth
2ffbdf5680 Toolchain/Ports: Update to gcc 10.1.0 2020-05-16 09:51:31 +02:00
Linus Groh
33defef267 LibJS: Let parser keep track of errors
Rather than printing them to stderr directly the parser now keeps a
Vector<Error>, which allows the "owner" of the parser to consume them
individually after parsing.

The Error struct has a message, line number, column number and a
to_string() helper function to format this information into a meaningful
error message.

The Function() constructor will now include an error message when
throwing a SyntaxError.
2020-05-15 09:53:52 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Linus Groh
358694567f Meta: Add script to enforce license headers & run it on Travis 2020-05-09 23:55:58 +02:00
Linus Groh
82cb751907 Lagom: Add missing copyright header to FuzzJS.cpp 2020-05-09 23:45:16 +02:00
Andreas Kling
cf3b58fbe8 Services: Renamed from Servers
It didn't feel right to have a "DHCPClient" in a "Servers" directory.
Rename this to Services to better reflect the type of programs we'll
be putting in there.
2020-05-08 21:57:44 +02:00
Emanuele Torre
21712ed0a3 Meta: We don't need to ignore run-tests in lint-shell-scripts.sh 2020-05-07 12:20:41 +02:00
Devashish
f22c973ba3 Meta: Add configuration for setting up project in CLion
This commit adds a CMakeLists.txt file that will be used by CLion to
configure the project and documentation explaining the steps to follow.
Configuring CLion this way enables important features like code
completion and file search. The configuration isn't perfect. There are
source files for which CLion cannot pick up the headers and asks to
manually include them from certain directories. But for the most part,
it works all right.
2020-05-04 09:50:45 +02:00
Linus Groh
660fd04063 Meta: Build Lagom js and run LibJS tests on Travis 2020-04-20 22:44:13 +02:00
Andreas Kling
32d83fdee4 LibX86: Add an X86 instruction decoder library + basic disassembler
This will be very useful for developer tools like ProfileView, and also
for future tools like debuggers and such. :^)
2020-04-11 13:16:17 +02:00
Paul Redmond
7291d5c86f
Lagom: Add fuzz testing for LibJS using libFuzzer (#1692)
Note: clang only (see https://llvm.org/docs/LibFuzzer.html)

- add FuzzJs which will run the LibJS parser on random javascript inputs
- added a basic dictionary of javascript tokens

To use fuzzer:
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DENABLE_FUZZER_SANITIZER=1 ..
Fuzzers/FuzzJs -dict=../Fuzzers/FuzzJs.dict
2020-04-08 10:40:02 +02:00
Brian Gianforcaro
1e67efc5c1 Lagom: Add clang address/memory/undefined-behavior analyzer support
Adding the ability to turn on Clang analyzer support in the Lagom build.
Right now the following are working warning free on the LibJS test suite:

 -DENABLE_MEMORY_SANITIZER:BOOL=ON

 -DENABLE_ADDRESS_SANITIZER:BOOL=ON

The following analyzer produces errors when running the LibJS test suite:

 -DENABLE_UNDEFINED_SANITIZER:BOOL=ON
2020-04-05 12:49:06 +02:00
Andreas Kling
6529b78d08 Lagom: Build LibLine since "js" depends on it 2020-03-31 18:58:59 +02:00
Andreas Kling
faa3bf195a Meta: Ignore the LibJS test runner script when linting
Making this work in the absence of bash is more cumbersome than simply
skipping it at the moment.
2020-03-25 16:30:58 +01:00
Andreas Kling
e31dac3ba4 Lagom: Build LibJS + "js" test program
You can now get a full Linux build of the "js" test program by simply
building in Meta/Lagom :^)
2020-03-23 13:15:32 +01:00
Shannon Booth
084e67f267 Meta: Integrate Shellcheck into Travis
lint-shell-scripts searches over the repository looking for shell
scripts. On those found, shellcheck is run against them. If any linting
fails print those warnings and exit with a non-zero exit code.

Run this script automatically in Travis.
2020-02-10 10:46:25 +01:00