Idan Horowitz
e84bbfed44
Kernel: Remove big lock from sys$mkdir
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
165a23b68c
Kernel: Remove big lock from sys$rename
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
5c064d3e8e
Kernel: Remove big lock from sys$rmdir
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
d4ce43cf45
Kernel: Remove big lock from sys$statvfs
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
4ae93179f1
Kernel: Remove big lock from sys$symlink
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
1474b18070
Kernel: Remove big lock from sys$link
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
fa360f7d88
Kernel: Remove big lock from sys$unlink
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
5a96260e25
Kernel: Remove big lock from sys$setsockopt
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
c2372242b1
Kernel: Remove big lock from sys$getsockopt
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
849c227f72
Kernel: Remove big lock from sys$shutdown
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
e620487b66
Kernel: Remove big lock from sys$connect
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
9547a8e8a2
Kernel: Remove big lock from sys$close
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
0297349922
Kernel: Remove big lock from sys$chown
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
8458313e8a
Kernel: Remove big lock from sys$fchown
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
f986a3b886
Kernel: Remove big lock from sys$bind
...
This syscall doesn't access any unprotected shared data.
2022-04-09 23:46:02 +02:00
Idan Horowitz
2c025d6334
Kernel: Move NNRP<Socket>s instead of copying in queue_connection_from
2022-04-09 23:46:02 +02:00
Idan Horowitz
4a270c93ed
Kernel: Accept NNRP<Socket> instead of RP<Socket> in release_for_accept
...
This value is always non-null, so let's make it explicit.
2022-04-09 23:46:02 +02:00
Luke Wilde
1682b0b6d8
Kernel: Remove big lock from sys$set_coredump_metadata
...
The only requirement for this syscall is to make
Process::m_coredump_properties SpinlockProtected.
2022-04-09 21:51:16 +02:00
Jelle Raaijmakers
cc411b328c
Kernel: Remove big lock from sys$accept4
...
The only thing we needed to check is whether `socket.accept()` returns
a socket, and if not, we go back to blocking again.
2022-04-09 17:53:18 +02:00
Jelle Raaijmakers
14fc05e912
Kernel: Verify mutex big lock behavior
...
These two methods are big lock specific, so verify our mutex' behavior.
2022-04-09 15:55:20 +02:00
Jelle Raaijmakers
bb02e9a7b9
Kernel: Unblock big lock waiters correctly
...
If the regular exclusive and shared lists were empty (which they
always should be for the big lock), we were not unblocking any waiters.
2022-04-09 15:55:20 +02:00
Linus Groh
62185452f0
Kernel: Query OS-enabled CPUID features again at the end of cpu_setup()
...
For OSPKE this is a no-op as we don't enable PKU yet, but the state of
the OSXSAVE flag might have changed if we enabled XSAVE.
2022-04-08 18:53:42 +01:00
Linus Groh
87aabb5ef7
Kernel: Rename OSPKU CPUID feature flag to OSPKE
...
Unlike "XSAVE enabled by OS" being indicated by the OSXSAVE flag, in
this case it's "PKU enabled by OS" being indicated by the OSPKE flag.
2022-04-08 18:53:42 +01:00
Tiaan Louw
678555af97
Kernel: Adjust includes after file reorganization
2022-04-08 15:06:33 +01:00
Jelle Raaijmakers
7826729ab2
Kernel: Track big lock blocked threads in separate list
...
When we lock a mutex, eventually `Thread::block` is invoked which could
in turn invoke `Process::big_lock().restore_exclusive_lock()`. This
would then try to add the current thread to a different blocked thread
list then the one in use for the original mutex being locked, and
because it's an intrusive list, the thread is removed from its original
list during the `.append()`. When the original mutex eventually
unblocks, we no longer have the thread in the intrusive blocked threads
list and we panic.
Solve this by making the big lock mutex special and giving it its own
blocked thread list. Because the process big lock is temporary and is
being actively removed from e.g. syscalls, it's a matter of time before
we can also remove the fix introduced by this commit.
Fixes issue #9401 .
2022-04-06 18:27:19 +02:00
James Mintram
d94c7fa417
Kernel: Improve the aarch64 kernel source files disk layout
2022-04-06 08:56:20 +01:00
Andreas Kling
9b9b05eabf
Kernel: Make sys$mmap() round requested VM size to page size multiple
...
This fixes an issue where File::mmap() overrides would fail because they
were expecting to be called with a size evenly divisible by PAGE_SIZE.
2022-04-05 22:26:37 +02:00
Andreas Kling
b28beb691e
Kernel: Protect Mutex's thread lists with a spinlock
2022-04-05 14:44:50 +02:00
Andreas Kling
0a83c03546
Kernel: Don't unregister Region from RegionTree *before* unmapping it
...
If we unregister from the RegionTree before unmapping, there's a race
where a new region can get inserted at the same address that we're about
to unmap. If this happens, ~Region() will then unmap the newly inserted
region, which now finds itself with cleared-out page table entries.
2022-04-05 13:46:50 +02:00
Andreas Kling
a3db0ab14f
Kernel: Remove MemoryManager::region_tree() accessor
...
Let's not have a way to grab at the RegionTree from outside of MM.
2022-04-05 13:45:10 +02:00
Andreas Kling
f8d798b667
Kernel: Move allocate_unbacked_region_anywhere() to MemoryManager
...
This didn't need to be in RegionTree, and since it's specific to kernel
VM anyway, let's move it to MemoryManager.
2022-04-05 13:45:10 +02:00
Andreas Kling
e0da8da657
Kernel: Move create_identity_mapped_region() to MemoryManager
...
This had no business being in RegionTree, since RegionTree doesn't track
identity-mapped regions anyway. (We allow *any* address to be identity
mapped, not just the ones that are part of the RegionTree's range.)
2022-04-05 13:45:10 +02:00
Andreas Kling
cfb61cbd54
Kernel: Add RegionTree::find_region_containing(address or range)
...
Let's encapsulate looking up regions so clients don't have to dig into
RegionTree internals.
2022-04-05 12:23:47 +02:00
Andreas Kling
da7ea2556e
Kernel: Add RegionTree::remove(Region&)
...
This allows clients to remove a region from the tree without reaching
into the RegionTree internals.
2022-04-05 11:57:53 +02:00
Andreas Kling
f0f97e1db0
Kernel: Take the RegionTree spinlock when inspecting tree from outside
...
This patch adds RegionTree::get_lock() which exposes the internal lock
inside RegionTree. We can then lock it from the outside when doing
lookups or traversal.
This solution is not very beautiful, we should find a way to protect
this data with SpinlockProtected or something similar. This is a stopgap
patch to try and fix the currently flaky CI.
2022-04-05 01:15:22 +02:00
Andreas Kling
e3e1d79a7d
Kernel: Remove unused ShouldDeallocateVirtualRange parameters
...
Since there is no separate virtual range allocator anymore, this is
no longer used for anything.
2022-04-05 01:15:22 +02:00
James Mintram
df9a833d7a
Kernel: Add VERIFY_NOT_REACHED to aarch64 PageDirectory.cpp
2022-04-04 14:35:54 -07:00
James Mintram
283d8e8f51
Kernel: Add VERIFY_NOT_REACHED to aarch64 locking functions
2022-04-04 14:35:54 -07:00
James Mintram
e98ea8a977
Kernel: Add VERIFY_NOT_REACHED to the aarch64 handle_crash function
2022-04-04 14:35:54 -07:00
James Mintram
d014c0501d
Kernel: Remove unused dummy function from dummy.cpp
2022-04-04 14:35:54 -07:00
James Mintram
bd7acd4b90
Kernel: Add VERIFY_NOT_REACHED to stub functions in aarch64 dummy.cpp
2022-04-04 14:35:54 -07:00
James Mintram
92a8383101
Kernel: Add VERIFY_NOT_REACHED to stub aarch64 Processor functions
2022-04-04 14:35:54 -07:00
James Mintram
463910df98
Kernel: Print out assertion info in __assertion_failed on aarch64
2022-04-04 22:25:33 +01:00
Andreas Kling
9bb45ab3a6
Kernel: Add debug logging to learn more about unexpected NP faults
2022-04-04 17:10:30 +02:00
Andreas Kling
d1f2d63840
Kernel: Remove unused Region::try_create_kernel_only()
2022-04-04 12:34:13 +02:00
Andreas Kling
63ddbaf68a
Kernel: Tweak broken dbgln_if() in sys$fork() after RegionTree changes
2022-04-04 11:05:49 +02:00
Andreas Kling
12b612ab14
Kernel: Mark sys$adjtime() as not needing the big lock
...
This syscall works on global kernel state and so doesn't need protection
from threads in the same process.
2022-04-04 00:42:18 +02:00
Andreas Kling
4306422f29
Kernel: Mark sys$clock_settime() as not needing the big log
...
This syscall ends up disabling interrupts while changing the time,
and the clock is a global resource anyway, so preventing threads in the
same process from running wouldn't solve anything.
2022-04-04 00:42:18 +02:00
Andreas Kling
55814f6e0e
Kernel: Mark sys$sched_{set,get}param() as not needing the big lock
...
Both of these syscalls take the scheduler lock while accessing the
thread priority, so there's no reliance on the process big lock.
2022-04-04 00:42:18 +02:00
Andreas Kling
9250ac0c24
Kernel: Randomize non-specific VM allocations done by sys$execve()
...
Stuff like TLS regions, main thread stacks, etc. All deserve to be
randomized unless the ELF requires specific placement. :^)
2022-04-04 00:42:18 +02:00