Commit Graph

16395 Commits

Author SHA1 Message Date
Ben Wiederhake
2f92c8cad5 Base: Replace unnecessary escapes by actual codepoints
I used this arcane incantation by @emanuele6:

    < <(grep -hoP -e '\\u[A-Za-z0-9]{4}' ./*.json) grep -i -ve '\\u001b' \
    | sort -u \
    | while read -r; do
        sed -i "s,\\$REPLY,$(eval "echo $'$REPLY'"),g" ./*.json
    done

Plus some manual editing to re-align everything. Thanks! :)
2021-02-01 09:54:32 +01:00
Ben Wiederhake
fa642eb7d0 Base: Fix wrong offset for Numpad and later keys
This seems to be the last remaining fallout of
8733da652e.
2021-02-01 09:54:32 +01:00
Ben Wiederhake
aa3d915260 LibTextCodec: Avoid duplicate definition of standard encodings 2021-02-01 09:54:32 +01:00
Ben Wiederhake
03b11af00f KeyboardMapper: Export keymap not as a byte, but as unicode
What a silly mixup. Loading and saving no longer loses any data! :^)
2021-02-01 09:54:32 +01:00
Ben Wiederhake
4deb0f8343 KeyboardMapper: Remove duplicate 'save' button
There already is a standard action in the menu, and Ctrl-S also works.
No need to have an extra button for that.
2021-02-01 09:54:32 +01:00
Ben Wiederhake
6c04629ff8 KeyboardMapper: Make all of the GUI visible 2021-02-01 09:54:32 +01:00
Mart G
9068398f6b AK: Make single pivot quick_sort guarantee a max stack depth of log(n)
- The change to quick_sort requires SimpleIterator to support
  assignment.
- Rename quick_sort to single_pivot_quick_sort to make it easier
  to choose a specific implementation (not based on signature).
- Ensure single_pivot_quick_sort does not copy the pivots
- Expand sorts_without_copy test case to cover both single and dual
  pivot implementations.
2021-02-01 09:52:36 +01:00
Matteo Sozzi
40da077f6c HackStudio: added new directory action
Added the possibility to create a new directory in the current project.
2021-02-01 09:52:13 +01:00
Jean-Baptiste Boric
b48d8d1d6d Userland: Rename PCI slot to PCI device terminology 2021-01-31 19:06:40 +01:00
Jean-Baptiste Boric
06d76a4717 Kernel: Fix PCI bridge enumeration
The enumeration code is already enumerating all buses, recursively
enumerating bridges (which are buses) makes devices on bridges being
enumerated multiple times. Also, the PCI code was incorrectly mixing up
terminology; let's settle down on bus, device and function because ever
since PCIe came along "slots" isn't really a thing anymore.
2021-01-31 19:06:40 +01:00
Thomas Mangin
34508c0b01 LibX86: sanity check for Instruction read size
During "Emulator hacking: Let's make the userspace emulator go faster!",
the switch implented in read() was inlined (toward the end of the video).

This patch restore the assert check for any read other than 8, 16 or 32
bits was lost during the code conversion.
2021-01-31 19:06:24 +01:00
AnotherTest
3b9ead985c LibLine: Only print ascii characters in caret form
ctype's `iscntrl` truncates its input, making some codepoints appear as
control characters. Avoid this by checking whether the character is in
ascii to begin with.
2021-01-31 19:06:02 +01:00
Linus Groh
521a38d9c5 LibWeb: Use URL::to_string_encoded() for the crash error page URL's href
Just wrapping to_string() in urlencode() will break the link as too many
characters are encoded. Also wrap in escape_html_entities() as well -
most relevant chars are already URL-encoded, but this will change '&' to
'&amp;', for example.
2021-01-31 19:05:55 +01:00
Linus Groh
e0066ff2d7 AK: Add URL::to_string_encoded()
The result of to_string() passed to urlencode(), with some characters
excluded - basically like JavaScript's encodeURI().
2021-01-31 19:05:55 +01:00
Linus Groh
50e3b122c7 AK: Add optional parameter for excluding chars to urlencode() 2021-01-31 19:05:55 +01:00
Andreas Kling
1320b9351e Revert "Kernel: Don't clone kernel mappings for bottom 2 MiB VM into processes"
This reverts commit da7b21dc06.

This broke SMP boot, oops! :^)
2021-01-31 19:00:53 +01:00
Andreas Kling
da7b21dc06 Kernel: Don't clone kernel mappings for bottom 2 MiB VM into processes
I can't think of anything that needs these mappings anymore, so let's
get rid of them.
2021-01-31 15:20:18 +01:00
Andreas Kling
fc4eae87f8 LibC: Don't honor LIBC_* malloc debugging flags in AT_SECURE context
Just ignore all these environment flags if the AT_SECURE flag is set in
the program's auxiliary vector.

This prevents a user from tricking set-uid programs into dumping debug
information via environment flags.
2021-01-31 14:37:21 +01:00
Andreas Kling
9984201634 Kernel: Use KResult a bit more in the IPv4 networking code 2021-01-31 12:13:16 +01:00
Ben Wiederhake
b00799b9ce Kernel: Make /proc/self/ work again
I have no idea when it broke.

Inspired by https://www.thanassis.space/bashheimer.html
2021-01-31 12:03:14 +01:00
Andreas Kling
e313323317 LibELF: Split the DynamicLoader's loading mechanism into two steps
load_from_image() becomes map() and link(). This allows us to map
an object before mapping its dependencies.

This solves an issue where fixed-position executables (like GCC)
would clash with the ASLR placement of their own shared libraries.
2021-01-31 11:46:00 +01:00
Andreas Kling
36525c0572 LibELF: Assert on multiple calls to DynamicLoader::load_from_image()
It would be a mistake to recreate the cached DynamicObject.
2021-01-31 11:32:16 +01:00
Andreas Kling
2b862e4569 LibELF: Don't validate ELF twice in DynamicLoader
Validation was happening in two steps, some in the constructor, and then
some later on, in load_from_image().

This made no sense so just move all the validation to the constructor.
2021-01-31 11:29:23 +01:00
Andreas Kling
68576bcf1b LibELF: Call mmap() before constructing the DynamicLoader object
Refactor DynamicLoader construction with a try_create() helper so that
we can call mmap() before making a loader. This way the loader doesn't
need to have an "mmap failed" state.

This patch also takes care of determining the ELF file size in
try_create() instead of expecting callers to provide it.
2021-01-31 11:06:00 +01:00
Andreas Kling
d71bfb9614 LibC: Fix bad error check after open() in dlopen() 2021-01-31 11:06:00 +01:00
Lenny Maiorani
be5311be99 Vector: Correctly pass args to insert, insert_before_matching, prepend
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.

Note:
- `append` is not being changed because there are several overloads
  for appending single values and concatenating vectors. This
  conflation needs to be addressed first.
2021-01-31 10:48:12 +01:00
Lenny Maiorani
537bedbf38 HashTable: Correctly pass args to set
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.
2021-01-31 10:48:12 +01:00
Lenny Maiorani
2490fc79ad CircularQueue: Correctly pass args to enqueue
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.
2021-01-31 10:48:12 +01:00
Lenny Maiorani
a2501c3981 CircularDeque: Correctly pass args to enqueue
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.
2021-01-31 10:48:12 +01:00
Lenny Maiorani
b754121da7 Queue: Correctly pass args to enqueue
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.
2021-01-31 10:48:12 +01:00
Lenny Maiorani
73d6c73b48 SinglyLinkedList: Correctly pass args to append, insert_before, insert_after
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.
2021-01-31 10:48:12 +01:00
Lenny Maiorani
5cee5725e7 SinglyLinkedListWithCount: Correctly pass args to append, insert_before, insert_after
Problem:
- Using regular functions rather than function templates results in
  the arguments not being deduced. This then requires the same
  function to be written multiple times and for `move` to be used
  rather than `forward`.

Solution:
- Collapse multiple function overloads to a single function template
  with a deduced argument. This allows the argument to be a forwarding
  reference and bind to either an l-value or r-value and forward the
  value.
2021-01-31 10:48:12 +01:00
Andreas Kling
6e4e3a7612 Kernel: Remove pledge exception for sys$getsockopt() with SO_PEERCRED
We had an exception that allowed SOL_SOCKET + SO_PEERCRED on local
socket to support LibIPC's PID exchange mechanism. This is no longer
needed so let's just remove the exception.
2021-01-31 09:29:27 +01:00
Andreas Kling
1b5be4a342 LibIPC: Stop exchanging client/server PIDs in greeting handshake
The PIDs were used for sharing shbufs between processes, but now that
we have migrated to file descriptor passing, we no longer need to know
the PID of the other side.
2021-01-31 09:29:27 +01:00
Brendan Coles
50092ea0ca Inspector: Exit if inspected process has not pledged accept 2021-01-31 09:08:51 +01:00
Andreas Kling
df2a4adcd2 Browser+LibWeb+WebContent: Make the "Debug" menu work in multi-process
This patch adds an IPC call for debugging requests. It's stringly typed
and very simple, and allows us to easily implement all the features in
the Browser's Debug menu.
2021-01-31 09:07:46 +01:00
Andreas Kling
1dad47c0f9 WebContent: Set the main thread name based on the current page host
We now show up as "WebContent: www.serenityos.org" in System Monitor,
which is just super neat. :^)
2021-01-30 23:43:18 +01:00
Andreas Kling
4d777a9bf4 Kernel: Allow changing thread names with the "stdio" promise
It's useful for programs to change their thread names to say something
interesting about what they are working on. Let's not require "thread"
for this since single-threaded programs may want to do it without
pledging "thread".
2021-01-30 23:38:57 +01:00
Andreas Kling
ded78fc074 Browser: Turn on multi-process mode by default :^)
Frick it, let's just enable this by default and give ourselves a reason
to improve things! Some things are broken, and there's a bit of flicker
when resizing, but we can do this.

This drastically improves our web browsing security model by isolating
each tab into its own WebContent process that runs as an unprivileged
user with a tight pledge+unveil sandbox.

To get a single-process browser, you can start it with -s.
2021-01-30 23:16:41 +01:00
Andreas Kling
74c8490acd LibWeb: Don't try to create GUI::TextBox inside multi-process web views
This is a workaround until we can implement a proper <input type=text>
in terms of LibWeb primitives.

This makes google.com not crash in multi-process mode (but there is no
search box.)
2021-01-30 23:16:41 +01:00
Matteo Sozzi
32a363ded5 HackStudio: removed toggle_index
Removed `m_project_tree_view->toggle_index()` when adding new file to
project.
2021-01-30 22:59:59 +01:00
etaIneLp
e625ae1130 WindowManager: Restore a window's geometry when untiling it
Specifically, when untiling it using the Super-{Left,Right} shortcuts

Fixes #5182
2021-01-30 22:59:16 +01:00
Peter Elliott
c0e88b9710 Kernel: Add FIBMAP ioctl to Ext2FileSystem
FIBMAP is a linux ioctl that gives the location on disk of a specific
block of a file
2021-01-30 22:54:51 +01:00
Linus Groh
e8aae033f1 LibWeb: URL-encode/escape variables used in OOPWV's crash error page
This fixes arbitrary HTML injections via the URL on OOPWV's crash error
page - probably not a security issue, but annoying nonetheless.
2021-01-30 22:49:34 +01:00
Linus Groh
ec57c6c836 Meta: Fix sync-local.sh file check
Missing '{'. Thanks to @BenWiederhake for noticing!
2021-01-30 22:49:02 +01:00
Andreas Kling
f3e85e43c7 LibWeb: Handle WebContent process crashes gracefully :^)
The OOPWV will now detect WebContent process crashes/disconnections and
simply create a new WebContent process in its place. We also generate a
little error page with a link to the crashing URL so you can reload and
try again.

This a huge step forward for OOPWV since it now has a feature that IPWV
can never replicate. :^)
2021-01-30 18:27:39 +01:00
AnotherTest
322936115e LibProtocol: Bump download stream buffer to PAGE_SIZE
I think this should scale based on the network speed (or download
rate?), but for the time being, 4K seems to be good-enough.
2021-01-30 14:12:14 +01:00
AnotherTest
904e1002b8 pro: Use a rolling average for the download rate calculation
This makes it jump around less, and give a decent-ish representation of
download speed.
2021-01-30 14:12:14 +01:00
AnotherTest
bdda1600d0 WebServer: Stream the downloaded files
...instead of reading them into memory first.
This makes it possible to download large files from WebServer.
2021-01-30 14:12:14 +01:00
Brendan Coles
58abdde2e4 Inspector: Allow browsing inspection data in UI after process exits 2021-01-30 14:10:10 +01:00