summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2021-04-29Kernel: Add MSG_PEEK support for the IPv4SocketJustin
This commit will add MSG_PEEK support, which allows a package to be seen without taking it from the buffer, so that a subsequent recv() without the MSG_PEEK flag can pick it up.
2021-04-29Kernel: Implement peek() function for DoubleBufferJustin
This allows us to "peek" into a DoubleBuffer without incrementing the m_read_buffer_index, which is needed to implement MSG_PEEK.
2021-04-29Everywhere: Use "the SerenityOS developers." in copyright headersLinus Groh
We had some inconsistencies before: - Sometimes "The", sometimes "the" - Sometimes trailing ".", sometimes no trailing "." I picked the most common one (lowecase "the", trailing ".") and applied it to all copyright headers. By using the exact same string everywhere we can ensure nothing gets missed during a global search (and replace), and that these inconsistencies are not spread any further (as copyright headers are commonly copied to new files).
2021-04-29Everywhere: Add missing comma between copyright year and nameLinus Groh
2021-04-28Kernel: Avoid overrunning the user-specified buffers in select()Gunnar Beutner
2021-04-28Kernel: Check kernel symbol's name length matches searched nameIdan Horowitz
The current implementation would only check the first name.length() characters match, which means any kernel symbol that the provided name is a prefix of would match, instead of the actual matching symbol. This commit fixes that by using StringView::operator==() for the comparison, which already checks the equality correctly.
2021-04-28Kernel+LibC: Implement the socketpair() syscallGunnar Beutner
2021-04-27Build: Provide the user with a nice message after Toolchain upgradeBrian Gianforcaro
Lots of people are confused by the error message you get when the Toolchain is behind/messed up: 'initializer-list: No such file or directory' Before this error can happen, catch the problem at CMake configure time, and provide them with an actionable error message.
2021-04-27Build: Use variables when concatenating Toolchain paths.Brian Gianforcaro
Make this stuff a bit easier to maintain by using the root level variables to build up the Toolchain paths. Also leave a note for future editors of BuildIt.sh to give them warning about the other changes they'll need to make.
2021-04-27Kernel: Move PCI vendor and device IDs into Kernel/PCI/IDs.hGunnar Beutner
2021-04-27Kernel: Avoid resetting the IRQ mask for E1000 on each interruptGunnar Beutner
2021-04-27Kernel: Add logging for E1000 RX buffer overrunGunnar Beutner
2021-04-27Kernel: Use macros instead of hard-coded magic valuesGunnar Beutner
2021-04-27Kernel: Make sure the E1000 network adapter keeps receiving packetsGunnar Beutner
Previously the E1000 network adapter would stop receiving further packets when an RX buffer overrun occurred. This was the case when connecting the adapter to a real network where enough broadcast traffic caused the buffer to be full before the kernel had a chance to clear the RX buffer.
2021-04-27Kernel: Check futex command if realtime clock is usedJelle Raaijmakers
2021-04-27Kernel: Simplify BlockTimeout constructorJelle Raaijmakers
2021-04-27Kernel: Silence a few more network dbgln()sGunnar Beutner
2021-04-26Kernel: Fix incorrect argument for thread_exit eventsGunnar Beutner
2021-04-26Kernel: Log thread exits for global profilesGunnar Beutner
2021-04-26Kernel: Avoid calling characters() where not necessaryGunnar Beutner
2021-04-26Kernel: Use the correct union member for unmap eventsGunnar Beutner
2021-04-26Kernel: Ensure IO and memory accesses are allowed for IDE channelsLiav A
2021-04-26Kernel/Storage: Make the IDEChannel design more robustLiav A
The overall design is the same, but we change a few things, like decreasing the amount of blocking forever loops. The goal is to ensure the kernel won't hang forever when dealing with buggy hardware. Also, we reset the channel when initializing it, just in case the hardware was in bad state before we start use it.
2021-04-26Kernel/PCI: Add helpers to enable IO and memory accessesLiav A
2021-04-26Kernel/Storage: Fix sending IOGroup parametersLiav A
2021-04-26Kernel: Respond to packets sent to the directed broadcast addressGunnar Beutner
The last IP address in an IPv4 subnet is considered the directed broadcast address, e.g. for 192.168.3.0/24 the directed broadcast address is 192.168.3.255. We need to consider this address as belonging to the interface. Here's an example with this fix applied, SerenityOS has 192.168.3.190: [gunnar@nyx ~]$ ping -b 192.168.3.255 WARNING: pinging broadcast address PING 192.168.3.255 (192.168.3.255) 56(84) bytes of data. 64 bytes from 192.168.3.175: icmp_seq=1 ttl=64 time=0.950 ms 64 bytes from 192.168.3.188: icmp_seq=1 ttl=64 time=2.33 ms 64 bytes from 192.168.3.46: icmp_seq=1 ttl=64 time=2.77 ms 64 bytes from 192.168.3.41: icmp_seq=1 ttl=64 time=4.15 ms 64 bytes from 192.168.3.190: icmp_seq=1 ttl=64 time=29.4 ms 64 bytes from 192.168.3.42: icmp_seq=1 ttl=64 time=30.8 ms 64 bytes from 192.168.3.55: icmp_seq=1 ttl=64 time=31.0 ms 64 bytes from 192.168.3.30: icmp_seq=1 ttl=64 time=33.2 ms 64 bytes from 192.168.3.31: icmp_seq=1 ttl=64 time=33.2 ms 64 bytes from 192.168.3.173: icmp_seq=1 ttl=64 time=41.7 ms 64 bytes from 192.168.3.43: icmp_seq=1 ttl=64 time=47.7 ms ^C --- 192.168.3.255 ping statistics --- 1 packets transmitted, 1 received, +10 duplicates, 0% packet loss, time 0ms, rtt min/avg/max/mdev = 0.950/23.376/47.676/16.539 ms [gunnar@nyx ~]$
2021-04-26Kernel+Profiler: Improve profiling subsystemGunnar Beutner
This turns the perfcore format into more a log than it was before, which lets us properly log process, thread and region creation/destruction. This also makes it unnecessary to dump the process' regions every time it is scheduled like we did before. Incidentally this also fixes 'profile -c' because we previously ended up incorrectly dumping the parent's region map into the profile data. Log-based mmap support enables profiling shared libraries which are loaded at runtime, e.g. via dlopen(). This enables profiling both the parent and child process for programs which use execve(). Previously we'd discard the profiling data for the old process. The Profiler tool has been updated to not treat thread IDs as process IDs anymore. This enables support for processes with more than one thread. Also, there's a new widget to filter which process should be displayed.
2021-04-26Kernel: Increase max frame count to 64Gunnar Beutner
Even just profiling Piano hits the previous limit.
2021-04-26Kernel: Stop walking the stack when we encounter return address 0Gunnar Beutner
2021-04-25Everywhere: Remove empty line after function body opening curly braceLinus Groh
2021-04-25Kernel: Remove the now defunct `LOCKER(..)` macro.Brian Gianforcaro
2021-04-25Kernel: Remove the now defunct `RESTORE_LOCK(..)` macro.Brian Gianforcaro
2021-04-25Kernel: Utilize AK::SourceLocation for LOCK_DEBUG instrumentation.Brian Gianforcaro
The previous `LOCKER(..)` instrumentation only covered some of the cases where a lock is actually acquired. By utilizing the new `AK::SourceLocation` functionality we can now reliably instrument all calls to lock automatically. Other changes: - Tweak the message in `Thread::finalize()` which dumps leaked lock so it's more readable and includes the function information that is now available. - Make the `LOCKER(..)` define a no-op, it will be cleaned up in a follow up change.
2021-04-25Kernel: Add lock_count to procfs$all when LOCK_DEBUG is enabled.Brian Gianforcaro
2021-04-25Kernel: Fix LOCK_DEBUG feature to work againBrian Gianforcaro
- UBSAN detected cases where we were calling thread->holding_lock(..) but current_thread was nullptr. - Fix Lock::force_unlock_if_locked to not pass the correct ref delta to holding_lock(..).
2021-04-24Kernel: Support null act argument for sigaction syscallJelle Raaijmakers
Userspace can provide a null argument for the `act` argument to the `sigaction` syscall to not set any new behavior. This is described here: https://pubs.opengroup.org/onlinepubs/007904875/functions/sigaction.html Without this fix, the `copy_from_user(...)` invocation on `user_act` fails and makes the syscall return early.
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-23Kernel: Don't allow to kill kernel processesMaciej Zygmanowski
The protection was only for SIGKILL before.
2021-04-22Everywhere: Use linusg@serenityos.org for my copyright headersLinus Groh
2021-04-22Everywhere: Use bgianf@serenityos.org for my copyright attributionBrian Gianforcaro
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-21Kernel: Convert String::format() => String::formatted()Andreas Kling
2021-04-21Kernel: Annotate more AsyncDeviceRequest API's with [[nodiscard]]Brian Gianforcaro
2021-04-21Kernel: Make AsyncDeviceRequest sub-req management alloc freeBrian Gianforcaro
The previous implementation could allocate on insertion into the completed / pending sub request vectors. There's no reason these can't be intrusive lists instead. This is a very minor step towards improving the ability to handle OOM, as tracked by #6369 It might also help improve performance on the IO path in certain situations. I'll benchmark that later.
2021-04-21Meta: Add an option to precompile some very common AK headersAli Mohammad Pur
Until we get the goodness that C++ modules are supposed to be, let's try to shave off some parse time using precompiled headers. This commit only adds some very common AK headers, only to binaries, libraries and the kernel (tests are not covered due to incompatibility with AK/TestSuite.h). This option is on by default, but can be disabled by passing `-DPRECOMPILE_COMMON_HEADERS=OFF` to cmake, which will disable all header precompilations. This makes the build about 30 seconds faster on my machine (about 7%).
2021-04-20Kernel: Don't consider kernel memory regions for syscall origin checkAndreas Kling
We should never enter the syscall handler from a kernel address.
2021-04-20Kernel: Remove requirement for the thread entitlement for the futex syscallGunnar Beutner
GCC inserts calls to pthread_mutex_lock when compiling C++ code with threads enabled.
2021-04-20Ext2FS: Put bg_used_dirs_count debug logging behind EXT2_DEBUGAndreas Kling
2021-04-19Kernel: Stop treating port 0 (ephemeral auto bind) as a privileged portIdan Horowitz
Binding to port 0 is used to signal to listen() to bind to any port that is available. (in serenity's case, to the port range of 32768 to 60999, which are not privileged ports)
2021-04-19Kernel: Add a syscall to clear the profiling bufferBrian Gianforcaro
While profiling all processes the profile buffer lives forever. Once you have copied the profile to disk, there's no need to keep it in memory. This syscall surfaces the ability to clear that buffer.