After two months of development, Linus Torvalds has released the Linux kernel 6.1. Among the most notable changes are: support for developing drivers and modules in the Rust language, an upgraded mechanism for identifying used memory pages, a special memory manager for BPF programs, a memory issue diagnostics system called KMSAN, a protection mechanism known as KCFI (Kernel Control-Flow Integrity), and the introduction of the Maple tree structure.
The new version includes 15,115 fixes from 2,139 developers, with a patch size of 51 MB, which is about half the size of the patches from kernels 6.0 and 5.19. These changes affected 13,165 files, adding 716,247 lines of code and removing 304,560 lines. About 45% of all changes presented in 6.1 are related to device drivers, approximately 14% pertain to updates for hardware architecture-specific code, 14% involve the network stack, 3% relate to file systems, and 3% concern internal kernel subsystems.
Key innovations in kernel 6.1:
- Memory and system services
- Support for using Rust as a second language for developing drivers and kernel modules has been added. The main motivation for supporting Rust is to simplify the writing of safe and high-quality device drivers by reducing the likelihood of errors when handling memory. Rust support is disabled by default and does not make Rust a mandatory build dependency for the kernel. The kernel currently accepts a minimal trimmed version of patches, reduced from 40,000 to 13,000 lines of code, ensuring only the necessary minimum required to build a simple kernel module written in Rust. Future plans include gradually increasing the existing functionality by migrating other changes from the Rust-for-Linux branch. Concurrently, projects are underway to utilize the proposed infrastructure for developing drivers for NVMe storage, the 9p network protocol, and Apple M1 GPUs using Rust.
- For systems based on AArch64, RISC-V, and LoongArch architectures with EFI, direct loading of compressed kernel images has been implemented. Handlers for loading, starting, and unloading kernel images, which are called directly from EFI zboot, have also been added. Additionally, handlers for installing and removing protocols from the EFI protocol database have been introduced. Previously, unpacking was carried out by a separate bootloader, but now this can be done by the handler in the kernel itself — the kernel image is formed as an EFI application.
- Part of the patches implementing a multi-level memory management model has been included, allowing for the separation of memory banks with different performance characteristics. For example, the most frequently used pages can be placed in the fastest memory, while seldom used pages can be stored in relatively slower memory. A mechanism for identifying the location of frequently used pages in slow memory has been adopted into the 6.1 kernel to promote them to fast memory, and a general concept of memory levels and their relative performance has been realized.
- The MGLRU (Multi-Generational LRU) mechanism has been integrated, which replaced the old implementation of LRU (Least Recently Used) based on two queues with a multi-tiered structure that better identifies which memory pages are genuinely in use and which can be evicted to swap space.
- Support for the data structure 'maple tree', proposed by Oracle engineers, has been added, which is presented as a more efficient replacement for the 'red-black tree'. The maple tree is a variant of B-tree that supports range-based indexing and is designed for effective cache utilization. of modern processorsSome memory management subsystems have already been transitioned to the maple tree, positively impacting their performance. In the future, the maple tree may be used to implement range locking.
- The BPF subsystem has added the ability to create "destructive" BPF programs, specifically designed to initiate a crash via the call crash_kexec(). Such BPF programs may be needed for debugging purposes to trigger a crash dump at a specific time. Access to destructive operations when loading a BPF program requires setting the BPF_F_DESTRUCTIVE flag, enabling sysctl kernel.destructive_bpf_enabled, and having CAP_SYS_BOOT rights.
- BPF programs now have the capability to iterate over cgroup elements, as well as iterate over resources (files, vma, processes, etc.) of a specific thread or task. A new map type has been implemented for creating user-defined ring buffers.
- A special call has been added for memory allocation in BPF programs (memory allocator), which provides safer memory distribution in the context of BPF than the standard kmalloc().
- The first part of changes has been integrated, enabling the creation of drivers for input devices with a HID (Human Interface Device) interface, implemented as BPF programs.
- The kernel has completely removed the code for supporting the a.out executable file format, which was deprecated in version 5.1, and was disabled for major architectures starting with versions 5.18 and 5.19. The a.out format has long been obsolete on Linux systems, and generating a.out files is not supported by modern toolchains in default configurations for Linux. The loader for a.out files can be fully implemented in user space.
- Support for performance measurement events (perf event), kexec, kdump, and BPF JIT compilation has been implemented for systems based on the LoongArch instruction set architecture, used in Loongson 3 5000 processors, which implements a new RISC ISA similar to MIPS and RISC-V.
- A new mode IORING_SETUP_DEFER_TASKRUN has been proposed in the io_uring asynchronous I/O interface, allowing for the temporary deferral of tasks related to the ring buffer until a request is received from the application. This can be used to organize batch execution and prevent delay issues caused by preempting the application at an inopportune moment.
- User space processes are now able to initiate the conversion of a range of regular memory pages into a set of huge memory pages (Transparent Huge Pages).
- An implementation of the device /dev/userfaultfd has been added, allowing access to the functionality of the userfaultfd() system call using permissions in the file system. The userfaultfd functionality allows the creation of handlers for page faults in user space.
- The requirements for the GNU Make utility have been raised — to build the kernel, at least version 3.82 is now required.
- Disk subsystem, input/output, and file systems
- Significant performance optimizations have been made to the Btrfs file system, including a dramatic increase in the performance of the ioctl call FIEMAP. Support for asynchronous buffered writes has been added for applications using io_uring. The 'send' operation now supports files protected by fs-verity.
- Performance optimizations related to journal maintenance and read-only mode have been added to the ext4 file system.
- In the EROFS (Enhanced Read-Only File System), designed for use on partitions that are read-only, the ability to share data duplicated across different file systems has been implemented.
- The statx() system call has been updated to include the capability of returning information about the applicability of direct I/O to a file.
- Support for creating temporary files with the O_TMPFILE flag has been added to the FUSE (Filesystems in User Space) subsystem.
- Virtualization and Security
- The implementation of the CFI (Control Flow Integrity) protection mechanism has been replaced. This mechanism adds a check before each indirect function call to detect certain forms of undefined behavior that could potentially disrupt the normal execution order (control flow) due to exploits that modify function pointers stored in memory. The standard CFI implementation from the LLVM project has been replaced with a variant also based on Clang, but specifically tailored for protecting low-level subsystems and operating system kernels. In LLVM, the new implementation will be introduced in Clang 16 and will be included with the option '-fsanitize=kcfi'. A key difference in the new implementation is that it is not tied to optimizations during linking (LTO) and does not lead to replacing function pointers with references in the jump table.
- For LSM modules (Linux Security Module), a feature has been provided to create handlers that intercept namespace creation operations.
- Tools have been provided for verifying PKCS#7 digital signatures in BPF programs.
- In /dev/random, the ability to open in non-blocking mode (O_NONBLOCK) has been restored, which was inadvertently removed in kernel 5.6.
- On x86 architecture systems, a warning has been added for mappings in the kernel subsystems that allow execution and writing of memory pages simultaneously. There are plans to potentially prohibit such memory mappings entirely in the future.
- A debugging mechanism, KMSAN (Kernel Memory Sanitizer), has been added to detect the use of uninitialized memory in the kernel, as well as leaks of uninitialized memory between user space and devices.
- Improvements have been made to the cryptographically secure random number generator, CRNG, used in the getrandom call. The changes were made by Jason Donenfeld, the author of WireGuard, and are aimed at enhancing the security of extracting pseudo-random integers. VPN In the TCP stack, a feature has been implemented (disabled by default) that allows separate use of hash tables for sockets in each namespace, which improves the performance of systems with a large number of namespaces.
- Network subsystem
- In the TCP stack, a feature has been implemented (disabled by default) that allows separate use of hash tables for sockets in each namespace, which improves the performance of systems with a large number of namespaces.
- Support for the outdated DECnet protocol has been removed. API stubs have been left for user space to allow the compilation of applications using DECnet, but these applications will not be able to connect to the network.
- The netlink protocol has been documented.
- Hardware
- Support for DSC (Display Stream Compression) has been added in the amdgpu driver for lossless data compression when communicating with displays that support very high resolutions. Work continues to ensure support for AMD RDNA3 (RX 7000) and CDNA (Instinct) platforms. Support for IP components DCN 3.2, SMU 13.x, NBIO 7.7, GC 11.x, PSP 13.x, SDMA 6.x, and GMC 11.x has been added. The amdkfd driver (for discrete AMD GPUs such as Polaris) has implemented support for GFX 11.0.3.
- The i915 (Intel) driver has included support for Meteor Lake GPUs. DP 2.0 (DisplayPort) interface support has been added for Meteor Lake and newer GPUs. Identifiers for GPUs based on the Alder Lake S microarchitecture have been added.
- Support for audio subsystems implemented in Apple Silicon, Intel SkyLake, and Intel KabyLake processors has been added. The CS35L41 HDA audio driver now supports sleep mode. ASoC (ALSA System on Chip) support has been added for integrated audio chips from Apple Silicon, AMD Rembrandt DSPs, AMD Pink Sardine ACP 6.2, Everest ES8326, Intel Sky Lake and Kaby Lake, Mediatek MT8186, NXP i.MX8ULP DSPs, Qualcomm SC8280XP, SM8250, SM8450, and Texas Instruments SRC4392.
- Support for Samsung LTL101AL01, B120XAN01.0, R140NWF5 RH, Densitron DMT028VGHMCMI-1A TFT, AUO B133UAN02.1, IVO M133NW4J-R3, Innolux N120ACA-EA1, AUO B116XAK01.6, BOE NT116WHM-N21, INX N116BCA-EA2, INX N116BCN-EA1, and Multi-Inno Technology MI0800FT-9 LCD panels has been added.
- Support for AHCI SATA controllers used in the Baikal-T1 SoC has been added.
- Support for MediaTek MT7921, Intel Magnetor (CNVi, Integrated Connectivity), Realtek RTL8852C, RTW8852AE, and RTL8761BUV (Edimax BT-8500) Bluetooth chips has been added.
- Support for spectral scanning in the 160 MHz range has been added in the ath11k driver for Qualcomm wireless modules, along with multi-threaded NAPI and improved support for Qualcomm WCN6750 Wi-Fi chips.
- Drivers for keyboards associated with the PinePhone, InterTouch touchpads (ThinkPad P1 G3), X-Box Adaptive Controller, PhoenixRC Flight Controller, VRC-2 Car Controller, DualSense Edge Controller, IBM operation panels, XBOX One Elite controllers, XP-PEN Deco Pro S tablets, and Intuos Pro Small (PTH-460) have been added.
- A driver for Aspeed HACE (Hash and Crypto Engine) cryptographic accelerators has been added.
- Support for integrated Thunderbolt/USB4 controllers in Intel Meteor Lake has been added.
- Support for Sony Xperia 1 IV, Samsung Galaxy E5, E7, and Grand Max smartphones, as well as Pine64 Pinephone Pro, has been added.
- Support has been added for ARM SoC and boards: AMD DaytonaX, Mediatek MT8186, Rockchips RK3399 and RK3566, TI AM62A, NXP i.MX8DXL, Renesas R-Car H3Ne-1.7G, Qualcomm IPQ8064-v2.0, IPQ8062, IPQ8065, Kontron SL/BL i.MX8MM OSM-S, MT8195 (Acer Tomato), Radxa ROCK 4C+, NanoPi R4S Enterprise Edition, JetHome JetHub D1p. Drivers for Samsung, Mediatek, Renesas, Tegra, Qualcomm, Broadcom, and NXP SoCs have been updated.
At the same time, the Latin American Free Software Foundation has released a fully free kernel version 6.1 — Linux-libre 6.1-gnu, cleaned of firmware and driver elements that contain non-free components or code segments limited by the manufacturer. The new release includes a cleanup of the new rtw8852b driver and DTS files for various Qualcomm and MediaTek SoCs with processors based on the AArch64 architecture. The blob cleanup code in drivers and subsystems amdgpu, i915, brcmfmac, r8188eu, rtw8852c, Intel ACPI has been updated. The cleanup of deprecated drivers tm6000 TV cards, cpia2 v4l, sp8870, av7110 has been adjusted.
Source: opennet.ru
