Commit Graph

26347 Commits

Author SHA1 Message Date
Andrew Kaster
d6de0613f5 LibCore: Store ObjectRegistration names as StringViews
We don't need to be allocating Strings for these names during static
initialization. The C-string literals will be stored in the .rodata ELF
section, so they're not going anywhere. We can just wrap the .rodata
storage for the class names in StringViews and use those in Object
registration and lookup APIs.
2021-08-28 23:34:30 +02:00
Luke Wilde
ea364af965 MailSettings: Add unveil 2021-08-28 23:29:28 +02:00
Luke Wilde
9e6d8f7c25 MailSettings: Use LibConfig instead of Core::ConfigFile
This also tightens the pledges.
2021-08-28 23:29:28 +02:00
Luke Wilde
173ba4e19b Mail: Add unveil 2021-08-28 23:29:28 +02:00
Luke Wilde
d486560aee Mail: Use LibConfig instead of Core::ConfigFile
This also tightens the pledges.
2021-08-28 23:29:28 +02:00
Nico Weber
585edb8cff Kernel: Omit all actual code from the kernel on aarch64 for now 2021-08-28 21:51:30 +01:00
Nico Weber
9c5e947e0e Prekernel: Make build on aarch64
Add a dummy Arch/aarch64/boot.S that for now does nothing but
let all processor cores sleep.

For now, none of the actual Prekernel code is built for aarch64.
2021-08-28 21:51:30 +01:00
Nico Weber
da785bd4bd Prekernel: Move boot.S and multiboot.S into an Arch/x86 subfolder 2021-08-28 21:51:30 +01:00
Nico Weber
ce98aa567c Meta: Don't pass net -device flags in aarch64 buils in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
ad480505af Meta: Introduce SERENITY_MACHINE variable in run.sh
Set it to all the `-m`, `-display`, `-device` flags for Intel,
and to just "-M raspi3" for aarch64 builds.
2021-08-28 21:51:30 +01:00
Nico Weber
4f3c0fa659 Meta: Disable spice in aarch64 buils in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
230ea3754d Meta: Run qemu-system-aarch64 in aarch64 builds in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
00c5e68b11 Meta: Disable kvm for aarch64 in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
23bc752c5d Meta: Make build-root-filesystem.sh omit libgcc_so.so in aarch64 builds 2021-08-28 21:51:30 +01:00
Nico Weber
57f95bd724 CMake: Don't build Userland and Tests in aarch64 builds for now 2021-08-28 21:51:30 +01:00
Nico Weber
a900792921 Toolchain: Also build aarch64-softmmu in BuildQemu.sh 2021-08-28 21:51:30 +01:00
Andrew Kaster
72de228695 Kernel: Verify interrupts are disabled when interacting with Mutexes
This should help prevent deadlocks where a thread blocks on a Mutex
while interrupts are disabled, and makes it impossible for the holder of
the Mutex to make forward progress because it cannot be scheduled in.

Hide it behind a new debug macro LOCK_IN_CRITICAL_DEBUG for now, because
Ext2FS takes a series of Mutexes from the page fault handler, which
executes with interrupts disabled.
2021-08-28 20:53:38 +02:00
Andrew Kaster
4f2520674c Kernel: Don't acquire Mutex for hostname() before scheduling is enabled
There's no reason to acquire the mutex for this resource before APs are
booted, before scheduling is enabled, and before interrupts are enabled.
2021-08-28 20:53:38 +02:00
Andrew Kaster
54161bf5b4 Kernel: Acquire reference to waitee before trying to block in sys$waitid
Previously, we would try to acquire a reference to the all processes
lock or other contended resources while holding both the scheduler lock
and the thread's blocker lock. This could lead to a deadlock if we
actually have to block on those other resources.
2021-08-28 20:53:38 +02:00
Andrew Kaster
dea62fe93c Kernel: Guard the all processes list with a Spinlock rather than a Mutex
There are callers of processes().with or processes().for_each that
require interrupts to be disabled. Taking a Mutexe with interrupts
disabled is a recipe for deadlock, so convert this to a Spinlock.
2021-08-28 20:53:38 +02:00
Andrew Kaster
70518e69f4 Kernel: Unlock ptrace lock before entering a critical section in execve
While it might not be as bad to release a mutex while interrupts are
disabled as it is to acquire one, we don't want to mess with that.
2021-08-28 20:53:38 +02:00
Andrew Kaster
8e70b85215 Kernel: Don't disable interrupts in validate_inode_mmap_prot
There's no need to disable interrupts when trying to access an inode's
shared vmobject. Additionally, Inode::shared_vmobject() acquires a Mutex
which is a recipe for deadlock if acquired with interrupts disabled.
2021-08-28 20:53:38 +02:00
Brian Gianforcaro
2038d2c49e LibELF: Apply some minor optimizations to symbol lookup
Optimizations:

- Make sure `DT_SYMTAB` is a string view literal, instead of string.

- DynamicObject::HashSection::lookup_sysv_symbol should be using
  raw_name() from symbol comparison to avoid needlessly calling
  `strlen`, when the StrinView::operator= walks the cstring without
  calling `strlen` first.

- DynamicObject::HashSection::lookup_gnu_symbol shouldn't create a
  symbol unless we know the hashes match first.

In order to test these changes I enabled Undefined behavior sanitizer
which creates a huge amount of relocations, and then ran the browser
with the help argument 100 times. The browser is a fairly big app with
a few different libraries being loaded, so it seemed liked a good
target.

Command: `time -n 100 br --help`

Before:
```
Timing report:
==============
Command:         br --help
Average time:    3897.679931 ms
Excluding first: 3901.242431 ms
```

After:
```
Timing report:
==============
Command:         br --help
Average time:    3612.860107 ms
Excluding first: 3613.54541 ms
```
2021-08-28 20:03:08 +02:00
Brian Gianforcaro
ad1051089c UserspaceEmulator: Profiles are now expected to have a strings array
The kernel profiles were recently changed to have a `strings` array
as part of the profile objects. The `ProfileViewer` now checks for
that during startup and declares the profile invalid if the array
is not present.

The UserspaceEmulator doesn't use the API which the kernel exposed
the string array for, so just fake it by always adding an empty array
to the generated profiles.
2021-08-28 20:03:08 +02:00
Brian Gianforcaro
e00c871f65 UserspaceEmulator: Make generated profiles debugable with cli tools
The fact that profiles are json on one giant line makes them very
difficult to debug when things go wrong. Instead make sure to wrap
each event or sample on a newline so you can easily grep/heap/tail
the profile files.
2021-08-28 20:03:08 +02:00
Ali Mohammad Pur
74c3359bed Shell: Use a relative path in builtin_cd for chdir if possible
This kinda sorta addresses the Shell side of #9655, however the fact
that `chdir` (and most other syscalls that take paths) are artifically
limited to a length of PATH_MAX remains.
2021-08-28 20:02:27 +02:00
Nico Weber
bbad4758b2 CMake: Let Meta/serenity.sh run aarch64 make it past cmake
This adds just enough scaffolding to make cmake succeed.
The build falls over immediately.
2021-08-28 14:43:07 +01:00
Nico Weber
a43ad0e706 LibELF: Reindent .S files to be consistent with other .S files
Most .S files don't indent directives, so don't indent them here either.
Also, one file had tabs instead of spaces, `:retab` that file.
2021-08-28 14:43:07 +01:00
Nico Weber
7052f403c8 Toolchain: Enough to make rebuild-toolchain aarch64 work
The gcc patch might not be completely correct, but at least the
toolchain completes building.
2021-08-28 14:43:07 +01:00
Nico Weber
61b6f69947 Toolchain: Regenerate binutils.patch and gcc.patch
I locally modified Meta/serenity.sh to pass `--dev` to BuildIt.sh
in build_toolchain(). Then I ran `Meta/serenity.sh rebuild-toolchain`,
cd'd into Toolchain/Tarballs/binutils-2.37, `git add`ed unadded files in
`git status`, and then ran `git diff > ../../Patches/binutils.patch`.
Then I did the same for Toolchain/Tarballs/gcc-11.2.0 (and was careful
not to `git add` serenity-kernel.h, since that's created by
Toolchain/BuildIt.sh).

No behavior change. This just rewrites the patch like git writes it.
2021-08-28 14:43:07 +01:00
Linus Groh
21dafc11d5 Spreadsheet: Use strict mode for runtime.js 2021-08-28 13:33:04 +01:00
Linus Groh
527efc1d52 Spreadsheet: Replace loose with strict equality operators in runtime.js 2021-08-28 13:33:04 +01:00
Linus Groh
f70bed7339 Spreadsheet: Remove custom JS string split function implementation 2021-08-28 13:33:04 +01:00
Linus Groh
dc8e69eb44 Spreadsheed: Call native functions in runtime.js on thisSheet
I think this *should* be working as-is, but there's probably something
wrong with the this value of native functions. Either way, not relying
on the implicit this value will allow us to use strict mode here
eventually.

Fixes #9240.
2021-08-28 13:33:04 +01:00
Mahmoud Mandour
ac7c83689b ps: Sort using input order in case of -q
Now the output of `ps -q <list>` is sorted according to the order the
user specified.
2021-08-28 15:08:00 +04:30
Mahmoud Mandour
259ecb3d11 ps: Select specific processes by their PIDs
This adds a `-q` option, which expects a comma-separated list of PIDs as
a value. On using it, only the processes associated with the supplied
PIDs are output.
2021-08-28 15:08:00 +04:30
Linus Groh
95751987fb MailSettings: Remove proc and exec from pleges 2021-08-28 11:26:32 +01:00
Linus Groh
c5e5ea71d7 MailSettings: Use the app-mail icon for the window
No app-mail-settings icon exists (yet). app-mail is also what's being
embedded in the executable, so let's stick with it.
2021-08-28 11:22:50 +01:00
Linus Groh
822566ff1a Meta: Let serenity.sh's TARGET default to SERENITY_ARCH, not i686
This environment variable is already widely used across our build
scripts and tooling, so serenity.sh should respect it as well.
It still uses i686 as the fallback.
2021-08-28 11:20:52 +01:00
Luke Wilde
041007e9f6 2048: Remove wpath and cpath pledges
With the move to LibConfig, these are no longer needed.
2021-08-28 12:22:16 +04:30
Luke Wilde
c0c33a4604 Spider: Remove wpath and cpath pledges and pledge earlier
With the move to LibConfig, the wpath and cpath pledges are no longer
needed.
2021-08-28 12:22:16 +04:30
Luke Wilde
34dc275005 Solitaire: Remove wpath and cpath pledges and pledge earlier
With the move to LibConfig, the wpath and cpath pledges are no longer
needed.
2021-08-28 12:22:16 +04:30
Luke Wilde
4332b35798 Chess: Perform pledges earlier 2021-08-28 12:22:16 +04:30
Luke Wilde
fd51a3cf15 FlappyBug: Remove wpath and cpath pledges
With the move to LibConfig, these are no longer needed.
2021-08-28 12:22:16 +04:30
Luke Wilde
5d6fccc52b GameOfLife: Add pledge and unveil 2021-08-28 12:22:16 +04:30
Luke Wilde
7a0fbb94b6 Pong: Remove wpath and cpath pledges
With the move to LibConfig, these are no longer needed.
2021-08-28 12:22:16 +04:30
Luke Wilde
efe0a3d415 Snake: Remove wpath and cpath pledges
With the move to LibConfig, these are no longer needed.
2021-08-28 12:22:16 +04:30
Luke Wilde
9d428a65d1 Minesweeper: Remove wpath and cpath pledges
With the move to LibConfig, these are no longer needed.
2021-08-28 12:22:16 +04:30
Andrew Kaster
834be1a895 Meta: Remove write-only-on-difference script
It's now been replaced with "${CMAKE_PROGRAM}" -E copy_if_different in
all previous usage locations.
2021-08-28 08:44:17 +01:00
Andrew Kaster
63956b36d0 Everywhere: Move all host tools into the Lagom/Tools subdirectory
This allows us to remove all the add_subdirectory calls from the top
level CMakeLists.txt that referred to targets linking LagomCore.

Segregating the host tools and Serenity targets helps us get to a place
where the main Serenity build can simply use a CMake toolchain file
rather than swapping all the compiler/sysroot variables after building
host libraries and tools.
2021-08-28 08:44:17 +01:00