Commit graph

10016 commits

Author SHA1 Message Date
Sergey Bugaev d395b93b15 Kernel: Misc tweaks 2020-05-29 07:53:30 +02:00
Sergey Bugaev ec4902d1dd LibCore+Inspector: Move RPC sockets to /tmp/rpc
We have a hierarchical filesystem, let's make use of it :^)
2020-05-29 07:53:30 +02:00
Sergey Bugaev 8afcf0d87a LibCore: Do not assert that we can start the RPC server
Now that the Shell uses Core::EventLoop, we can't afford to just crash if /tmp
is unwritable.
2020-05-29 07:53:30 +02:00
Sergey Bugaev 53647e347f Kernel+Base: Mount root filesystem read-only :^)
We remount /home and /root as read-write, to keep the ability to modify files
there. /tmp remains read-write, as it is mounted from a TmpFS.
2020-05-29 07:53:30 +02:00
Sergey Bugaev 39cde80545 Base: Document MS_RDONLY
Also fix a couple of issues with the man pages.
2020-05-29 07:53:30 +02:00
Sergey Bugaev 4b300e085d Userland+SystemMonitor: Recognize the MS_RDONLY mount flag 2020-05-29 07:53:30 +02:00
Sergey Bugaev fdb71cdf8f Kernel: Support read-only filesystem mounts
This adds support for MS_RDONLY, a mount flag that tells the kernel to disallow
any attempts to write to the newly mounted filesystem. As this flag is
per-mount, and different mounts of the same filesystems (such as in case of bind
mounts) can have different mutability settings, you have to go though a custody
to find out if the filesystem is mounted read-only, instead of just asking the
filesystem itself whether it's inherently read-only.

This also adds a lot of checks we were previously missing; and moves some of
them to happen after more specific checks (such as regular permission checks).

One outstanding hole in this system is sys$mprotect(PROT_WRITE), as there's no
way we can know if the original file description this region has been mounted
from had been opened through a readonly mount point. Currently, we always allow
such sys$mprotect() calls to succeed, which effectively allows anyone to
circumvent the effect of MS_RDONLY. We should solve this one way or another.
2020-05-29 07:53:30 +02:00
Sergey Bugaev b905126365 Kernel+LibC: Move O_* and MS_* flags to UnixTypes.h
That's where the other similar definitions reside. Also, use bit shift
operations for MS_* values.
2020-05-29 07:53:30 +02:00
Sergey Bugaev b6845de3f6 Kernel: Fix error case in Process::create_user_process()
If we fail to exec() the target executable, don't leak the thread (this actually
triggers an assertion when destructing the process), and print an error message.
2020-05-29 07:53:30 +02:00
Sergey Bugaev 6627c3ea3a Kernel: Fix some failing assertions
When mounting Ext2FS, we don't care if the file has a custody (it doesn't if
it's a device, which is a common case). When doing a bind-mount, we do need a
custody; if none is provided, let's return an error instead of crashing.
2020-05-29 07:53:30 +02:00
Sergey Bugaev f945d7c358 Kernel: Always require read access when mmaping a file
POSIX says, "The file descriptor fildes shall have been opened with read
permission, regardless of the protection options specified."
2020-05-29 07:53:30 +02:00
Sergey Bugaev 6af2418de7 Kernel: Pass a Custody instead of Inode to VFS methods
VFS no longer deals with inodes in public API, only with custodies and file
descriptions. Talk directly to the file system if you need to operate on a
inode. In most cases you actually want to go though VFS, to get proper
permission check and other niceties. For this to work, you have to provide a
custody, which describes *how* you have opened the inode, not just what the
inode is.
2020-05-29 07:53:30 +02:00
Sergey Bugaev a9946a99f2 Kernel: Pass a FileDescription to File::chmod() and File::chown()
We're going to make use of it in the next commit. But the idea is we want to
know how this File (more specifically, InodeFile) was opened in order to decide
how chown()/chmod() should behave, in particular whether it should be allowed or
not. Note that many other File operations, such as read(), write(), and ioctl(),
already require the caller to pass a FileDescription.
2020-05-29 07:53:30 +02:00
Sergey Bugaev 67cbc015d5 Userland: Fix displaying mount source
The key is now called "source" instead of "device".
2020-05-29 07:53:30 +02:00
Sergey Bugaev 2d412c5ad1 Kernel: Report source of synthetic filesystems as "none"
As opposed to the fs name.

This matches the new convention we have for specifying it in mount(8).
2020-05-29 07:53:30 +02:00
Linus Groh 8ff4587f65 LibJS: Throw in strict mode when assigning property to primitive value 2020-05-29 07:45:22 +02:00
Andreas Kling 5f2632f121 Meta: Tweak license in celebration of 10'000 commits :^) 2020-05-28 19:07:31 +02:00
Andreas Kling 68b1bdc234 LibWeb: Add a way to stop the new HTML parser
Some things are specced to "stop parsing", which basically just means
to stop fetching tokens and jump to "The end"
2020-05-28 18:55:18 +02:00
Andreas Kling 00b44ab148 LibWeb: Implement more of the "after body" insertion mode 2020-05-28 18:52:32 +02:00
Andreas Kling cba5d59adc LibWeb: Parse comments in the "in body" insertion mode 2020-05-28 18:46:39 +02:00
Andreas Kling bb2f22577b LibWeb: Implement a bunch more script-related tokenization states 2020-05-28 18:44:17 +02:00
Andreas Kling 4788bcd6f8 LibWeb: Add HTMLToken::make_character()
It's tedious to make character tokens manually all the time.
2020-05-28 18:43:52 +02:00
Andreas Kling 42243d2e06 LibWeb: Rename Web::HtmlView => Web::PageView
This widget doesn't just view HTML, it views a web page. :^)
2020-05-28 18:22:54 +02:00
Andreas Kling 5f8cbe6a1b LibWeb: Fix HTMLDocumentParser build 2020-05-28 18:20:55 +02:00
Andreas Kling 308cb69329 LibWeb: Remove a misplaced call to close_a_p_element() in "in body"
This should only be done for the corresponding start tags.
2020-05-28 18:18:20 +02:00
Andreas Kling c84212aaba LibWeb: Add a StackOfOpenElements helper for "popping until a tag name" 2020-05-28 18:18:20 +02:00
Andreas Kling e026a50777 Browser: Switch focus to the web page after pressing return in URL bar
Instead of dropping focus entirely, which felt weird.
2020-05-28 18:18:20 +02:00
Marcin Gasperowicz eadce65e04
LibJS: Implement standard semantics for relational operators (#2417)
Previously, the relational operators where casting any value to double
and comparing the results according to C++ semantics.

This patch makes the relational operators in JS behave according to the
standard specification.

Since we don't have BigInt yet, the implementation doesn't take it into
account. 

Moved PreferredType from Object to Value. Value::to_primitive now
passes preferred_type to Object::to_primitive.
2020-05-28 17:19:59 +02:00
Matthew Olsson cbe506020b LibJS: Strict mode assignment to 'eval' & 'arguments' is a syntax error 2020-05-28 17:18:42 +02:00
Matthew Olsson 786722149b LibJS: Add strict mode
Adds the ability for a scope (either a function or the entire program)
to be in strict mode. Scopes default to non-strict mode.

There are two ways to determine the strict-ness of the JS engine:

1. In the parser, this can be accessed with the parser_state variable
   m_is_strict_mode boolean. If true, the Parser is currently parsing in
   strict mode. This is done so that the Parser can generate syntax
   errors at parse time, which is required in some cases.

2. With Interpreter.is_strict_mode(). This allows strict mode checking
   at runtime as opposed to compile time.

Additionally, in order to test this, a global isStrictMode() function
has been added to the JS ReplObject under the test-mode flag.
2020-05-28 17:18:42 +02:00
Matthew Olsson 5ae9419a06 LibJS: Object index properties have descriptors; Handle sparse indices
This patch adds an IndexedProperties object for storing indexed
properties within an Object. This accomplishes two goals: indexed
properties now have an associated descriptor, and objects now gracefully
handle sparse properties.

The IndexedProperties class is a wrapper around two other classes, one
for simple indexed properties storage, and one for general indexed
property storage. Simple indexed property storage is the common-case,
and is simply a vector of properties which all have attributes of
default_attributes (writable, enumerable, and configurable).

General indexed property storage is for a collection of indexed
properties where EITHER one or more properties have attributes other
than default_attributes OR there is a property with a large index (in
particular, large is '200' or higher).

Indexed properties are now treated relatively the same as storage within
the various Object methods. Additionally, there is a custom iterator
class for IndexedProperties which makes iteration easy. The iterator
skips empty values by default, but can be configured otherwise.
Likewise, it evaluates getters by default, but can be set not to.
2020-05-28 17:17:13 +02:00
Matthew Olsson cc54974431 LibJS: Fix out-of-range error in Parser::Error::source_location_hint 2020-05-28 17:02:16 +02:00
Emanuele Torre cd507d0408 LibC: run clang-format on getopt.h to remove tab characters 2020-05-28 17:01:31 +02:00
Emanuele Torre 0b0036f430 LibWeb: replace some tab characters with spaces
also add missing "#pragma once" in StylePropertiesModel.h
2020-05-28 17:01:31 +02:00
Emanuele Torre 97b5fbda7f IRCClient: remove some unused headers and replace tabs with spaces 2020-05-28 17:01:31 +02:00
Andreas Kling 68177fd9a1 Meta: Move INSTALL.md into Documentation/ 2020-05-28 13:09:43 +02:00
Andreas Kling 0e777c0ac6 LibWeb: Fall back to block layout for unimplemented CSS display values
This seems to have a higher chance of generating somewhat recognizable
content compared to inline layout. This problem will gradually go away
as we implement more display values.
2020-05-28 12:44:34 +02:00
Andreas Kling 3d09bac888 LibWeb: Add default UA style for some table-related elements 2020-05-28 12:43:29 +02:00
Andreas Kling 5e53c45113 LibWeb: Plumb content encoding into the new HTML parser
We still don't handle non-ASCII input correctly, but at least now we'll
convert e.g ISO-8859-1 to UTF-8 before starting to tokenize.
This patch also makes "view source" work with the new parser. :^)
2020-05-28 12:35:19 +02:00
Andreas Kling 772b51038e LibWeb: Parse "input" tags during the "in body" insertion mode 2020-05-28 12:19:18 +02:00
Andreas Kling 7aa7a2078f LibWeb: Parse "td" start tags during "in cell" insertion mode 2020-05-28 11:46:08 +02:00
Andreas Kling 49f3323fa8 LibGUI: Don't show big Buggie in app about dialogs
It was getting to crowded between two Buggies and the app icon.
2020-05-28 11:45:01 +02:00
Andreas Kling 5c35f3c9ba LibWeb: Support named character references (e.g "&") 2020-05-28 11:44:19 +02:00
AnotherTest ca6e361279 Base: Add manpage for xargs 2020-05-28 11:01:08 +02:00
AnotherTest 0b98924ee7 Userland: Add a basic xargs
This adds a basic implementation of xargs.
The implemenation is missing quite a few options, and is not entirely
POSIX-compliant, but it gets the job done :^)
2020-05-28 11:01:08 +02:00
AnotherTest dd2f9658f3 LibC: Add a O_CLOEXEC mode element to fopen()
This commit also changes the mode parsing to allow specifying the modes
in any order.
2020-05-28 11:01:08 +02:00
AnotherTest f9bf2c7e78 AK: Add StringView::split_view() taking a StringView
Since the task of splitting a string via another is pretty common, we
might as well have this overload of split_view() as well.
2020-05-28 11:01:08 +02:00
Andreas Kling d83d46fd7a Kernel: Remove outdated FIXME in InterruptManagement::locate_apic_data 2020-05-28 10:55:51 +02:00
FalseHonesty 112b4de430 IRCClient: Enable history on the message box 2020-05-28 10:33:20 +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