Commit Graph

16513 Commits

Author SHA1 Message Date
Ben Wiederhake
d24e287f8c Base: Make /www read-write by default
Since it is owned by root anyway, there is no need for 'additional security' to prevent
modification of that directory. This makes it easier to quickly export files from
Serenity. Fixes #5152.
2021-02-03 21:23:15 +01:00
Andreas Kling
6503b4b3c1 Revert "Meta: Enable CodeQL static analysis for Serenity"
This reverts commit f0bf723424.

CodeQL never finds anything and regularly crashes, failing the build.
2021-02-03 18:42:02 +01:00
Andreas Kling
c10e0adaca Kernel: Move perf event backtrace capture out of Thread class
There's no need for this to be generic and support running from an
arbitrary thread context. Perf events are always generated from within
the thread being profiled, so take advantage of that to simplify the
code. Also use Vector capacity to avoid heap allocations.
2021-02-03 11:53:05 +01:00
Andreas Kling
9c77980965 Everywhere: Remove some bitrotted "#if 0" blocks 2021-02-03 11:17:47 +01:00
Andreas Kling
ac59903c89 Kernel: Don't try to symbolicate user addresses with ksyms
That's just not gonna work. :^)
2021-02-03 11:08:23 +01:00
Andreas Kling
e1236dac3e Kernel: Check for off_t overflow in FileDescription::read/write
We were checking for size_t (unsigned) overflow but the current offset
is actually stored as off_t (signed). Fix this, and also fail with
EOVERFLOW correctly.
2021-02-03 10:54:35 +01:00
Andreas Kling
9f05044c50 Kernel: Check for off_t overflow before reading/writing InodeFile
Let's double-check before calling the Inode. This way we don't have to
trust every Inode subclass to validate user-supplied inputs.
2021-02-03 10:51:37 +01:00
Andreas Kling
342b787d1c LibWeb: Move main thread JavaScript VM to its own file
Instead of being a weird little global function in DOM/Document.cpp,
you can now get the main thread JS VM via Bindings::main_thread_vm().
2021-02-03 10:45:39 +01:00
Zac
cc2f35badd TextEditor: Implement word wrapping
Add a new wrapping mode to the TextEditor that will wrap lines at the
spaces between words.

Replace the previous menubar checkbox 'Wrapping Mode' in HackStudio and
the TextEditor with an exclusive submenu which allows switching between
'No wrapping', 'Wrap anywhere' and 'Wrap at words'. 'Wrap anywhere' (the
new 'Wrap lines') is still the default mode.

Setting the wrapping mode in the constructors of the TextEditorWidget
and HackStudio has been removed, it is now set when constructing the
menubar actions.
2021-02-03 10:33:23 +01:00
Andreas Kling
db1c6cf9cf LibC+LibELF: Run clang-format 2021-02-03 10:21:04 +01:00
Andreas Kling
c94392a1cc Applications: Remove "Welcome" application
This was a cute application for its time, but it's far too jokey and
non-serious for how I'd like this project to treat itself.
2021-02-03 10:20:17 +01:00
Liav A
36f6351edc Kernel: Restore IDE PIO functionality
This change can be actually seen as two logical changes, the first
change is about to ensure we only read the ATA Status register only
once, because if we read it multiple times, we acknowledge interrupts
unintentionally. To solve this issue, we always use the alternate Status
register and only read the original status register in the IRQ handler.

The second change is how we handle interrupts - if we use DMA, we can
just complete the request and return from the IRQ handler. For PIO mode,
it's more complicated. For PIO write operation, after setting the ATA
registers, we send out the data to IO port, and wait for an interrupt.
For PIO read operation, we set the ATA registers, and wait for an
interrupt to fire, then we just read from the data IO port.
2021-02-03 10:18:16 +01:00
EvilHowl
a0c773da9e DisplaySettings: Show a confirmation message when applying changes
The changes will be reverted after 10 seconds of no user input.
2021-02-03 10:17:19 +01:00
Matteo Sozzi
2031baebce HackStudio: do not open empty directories as file
When _double clicking_ or _right click > Open_ in the tree view, the
selected directory, if empty, was open in the editor section as file.
2021-02-03 10:15:09 +01:00
Matteo Sozzi
a8dfba6348 HackStudio: tree_view on_activiation changes
When opening a file in the tree view with _double click_, the file name
was not the same as opening the same file with _right click > Open_.

This caused the opne_files_view to have the same file in it, but with
two different names.
2021-02-03 10:15:09 +01:00
AnotherTest
e3ec759f97 Shell: Make history range values larger than u32 a syntax error
Found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29792&sort=reported&q=serenity
2021-02-03 10:14:32 +01:00
Andreas Kling
d4dd4a82bb Kernel: Don't allow sys$msyscall() on non-mmap regions 2021-02-02 20:16:13 +01:00
Andreas Kling
603d36c599 LibELF: Make syscall region exceptions for UE and libkeyboard.so
These two are currently making some syscalls so we'll have to make
exceptions for them until we can clean them up.
2021-02-02 20:13:44 +01:00
Andreas Kling
de149dc7fa LibX86: Don't assert just because insn has no immediate bytes
It's perfectly fine to not have immediate bytes. Many insns don't :^)
2021-02-02 20:13:44 +01:00
Andreas Kling
df7ddfb803 LibELF: Mark libc.so and libpthread.so as syscall regions
Also, before calling the main program entry function, inform the kernel
that no more syscall regions can be registered.

This effectively bans syscalls from everywhere except LibC and
LibPthread. Pretty neat! :^)
2021-02-02 20:13:44 +01:00
Andreas Kling
47d0ca85e8 pmap+SystemMonitor: Mark syscall regions with 'C' 2021-02-02 20:13:44 +01:00
Andreas Kling
823186031d Kernel: Add a way to specify which memory regions can make syscalls
This patch adds sys$msyscall() which is loosely based on an OpenBSD
mechanism for preventing syscalls from non-blessed memory regions.

It works similarly to pledge and unveil, you can call it as many
times as you like, and when you're finished, you call it with a null
pointer and it will stop accepting new regions from then on.

If a syscall later happens and doesn't originate from one of the
previously blessed regions, the kernel will simply crash the process.
2021-02-02 20:13:44 +01:00
Andreas Kling
d57b4128a1 LibCore: Use serenity_readlink() instead of making syscalls directly 2021-02-02 20:13:44 +01:00
Andreas Kling
1658df9b6e LibC: Add LibC wrapper for sys$readlink()
To avoid having to make direct syscalls in LibCore, let's add a wrapper
for the kernel's readlink syscall in LibC.
2021-02-02 20:13:44 +01:00
Andreas Kling
775ae27a55 Revert "StatusBar: Allow GML files to set the number of labels to create"
This reverts commit e11ec20650.

Broke FileManager, Browser, etc.
2021-02-02 19:02:01 +01:00
Andreas Kling
31e04907b4 Revert "TextEditor: Add vim status indicators to the statusbar"
This reverts commit bd6d0d2295.
2021-02-02 19:01:54 +01:00
Andreas Kling
d4f40241f1 Ext2FS: Avoid unnecessary parent inode lookup during inode creation
Creation of new inodes is always driven by the parent inode, so we can
just refer directly to it instead of looking up the parent by ID.
2021-02-02 18:58:26 +01:00
Andreas Kling
9e4dd834ab Ext2FS: Simplify inode creation by always starting empty
We had two ways of creating a new Ext2FS inode. Either they were empty,
or they started with some pre-allocated size.

In practice, the pre-sizing code path was only used for new directories
and it didn't actually improve anything as far as I can tell.

This patch simplifies inode creation by simply always allocating empty
inodes. Block allocation and block list generation now always happens
on the same code path.
2021-02-02 18:58:26 +01:00
Andreas Kling
dbb668ddd3 Ext2FS: Propagate error codes from write_directory() 2021-02-02 18:58:26 +01:00
Andreas Kling
b0b51c3955 Kernel: Limit the size of stack traces
Let's not allow infinitely long stack traces. Cap it at 4096 frames.
2021-02-02 18:58:26 +01:00
Linus Groh
7b50d3cda4 Base: Update keymap(1) manpage
- Keymap name/file is now optional
- No root shell required (/bin/keymap is setuid root)
- Add example for getting the current keymap name
2021-02-02 16:53:11 +01:00
Linus Groh
ee41d6e154 Base: Rename some keymaps to use xx-xx format where appropriate
- en.json -> en-us.json
- gb.json -> en-gb.json
- ptbr.json -> pt-br.json
- ptpt.json -> pt-pt.json
2021-02-02 16:53:11 +01:00
Linus Groh
de676bbf97 Ports: Build python3 with zlib
With the right include paths and linker flags, the _zlib module now
builds & works. :^)
2021-02-02 16:53:06 +01:00
Linus Groh
404dab5383 Ports: Build most python3 extension modules statically
Attempting to import C-extensions (lib-dynload/*.so) currently asserts
in the dynamic loader - let's just build them statically instead for the
time being.
This makes a large number of modules available for use and the port a
lot more functional! :^)
2021-02-02 16:53:06 +01:00
Linus Groh
92ca22a5e1 Ports: Add post_configure function
There's pre_configure to do things required by the configure script,
let's also add post_configure for things not covered by the configure
script.
The specific use case is overwriting a file created by python3's
configure script.
2021-02-02 16:53:06 +01:00
Linus Groh
50957ec78e LibJS: Fix variable name coding style int{Part => _part}
...and rename intpart_end to int_part_end for consistency.
2021-02-02 16:52:55 +01:00
Zac
bd6d0d2295 TextEditor: Add vim status indicators to the statusbar
When using the VimEditingEngine in the TextEditor, vim's mode and the
previous key are shown in the editor's statusbar.
2021-02-02 16:08:20 +01:00
Zac
e11ec20650 StatusBar: Allow GML files to set the number of labels to create 2021-02-02 16:08:20 +01:00
Ben Wiederhake
ab9cc49fd8 Meta: Remove now-obsolete import from lint script
I'm sorry :(
2021-02-01 22:58:56 +01:00
Ben Wiederhake
a6ed034f89 Meta: Remove 'keymap exploration' in favor of precommit hook 2021-02-01 22:35:30 +01:00
Andreas Kling
1d394b8a76 LibELF: Close dynamic objects after mapping and linking them
Oops, we were leaving the file descriptors open.
2021-02-01 20:10:03 +01:00
Linus Groh
02520f16e3 Ports: Move packages.db from Ports/ to Build/
When removing and recreating the Build directory, it's quite annoying
having to edit/remove Ports/packages.db as the installer won't install
previously installed port dependencies again if they're still listed.
This problem is easily solved by just considering packages.db a
build-specific file.
2021-02-01 19:40:34 +01:00
Liav A
878d353c3d Documentation: Add a manual page about the new MemoryDevice file 2021-02-01 17:13:23 +01:00
Liav A
6e8f86b44b Ports: Upgrade dmidecode to version 3.3 2021-02-01 17:13:23 +01:00
Liav A
65c27bfe52 Kernel: Set file size for smbios_entry_point and DMI blobs in ProcFS
This is needed to support dmidecode version 3.3, so it can read the 2
blobs in ProcFS.
2021-02-01 17:13:23 +01:00
Liav A
338c6eec65 Ports: Add dmidecode to the available ports list 2021-02-01 17:13:23 +01:00
Liav A
a1e20aa04f Kernel: Fix enum of sysconf values to be in the correct order
This prevented from dmidecode to get the right PAGE_SIZE when using the
sysconf syscall.

I found this bug, when I tried to figure why dmidecode fails to mmap
/dev/mem when I passed --no-procfs, and the conclusion is that it tried
to mmap unaligned physical address 0xf5ae0 (SMBIOS data), and that was
caused by a wrong value returned after using the sysconf syscall to get
the plaform page size, therefore, allowing to send an unaligned address
to the mmap syscall.
2021-02-01 17:13:23 +01:00
Liav A
a9d1ddb1a5 Ports: Add a port of dmidecode 2021-02-01 17:13:23 +01:00
Liav A
c6fe1de30e LibC: Expose various option variables for later usage
These variables are used by the dmidecode utility to parse the
commandline arguments that were specified by the user.
2021-02-01 17:13:23 +01:00
Liav A
5ab1864497 Kernel: Introduce the MemoryDevice
This is a character device that is being used by the dmidecode utility.
We only allow to map the BIOS ROM area to userspace with this device.
2021-02-01 17:13:23 +01:00