|
|
Log in / Subscribe / Register

LWN.net Weekly Edition for October 22, 2026

Welcome to the LWN.net Weekly Edition for October 22, 2026

This edition contains the following feature content:

This week's edition also includes these inner pages:

  • Brief items: Brief news items from throughout the community.
  • Announcements: Newsletters, conferences, security updates, patches, and more.

Please enjoy this week's edition, and, as always, thank you for supporting LWN.net.

Comments (none posted)

Vendor hooks in the Android kernel

By Jonathan Corbet
October 15, 2026

LPC
Since Android's inception, the kernels it has used have diverged significantly from the mainline. While many of those differences have been resolved over time, and the move to the generic kernel image has helped to bring Android closer, current devices still carry a lot of out-of-tree changes. The preferred form for such changes is by way of vendor hooks. At the 2026 Linux Plumbers Conference, Todd Kjos ran a fast-paced session in the Android track to discuss vendor hooks and how they are used.

[Todd Kjos] The 6.6 kernel is the one used on the largest number of Android systems currently, he began; 6.18 can be found mostly on flagship devices at this point. The Android 6.6 kernel carries a large number (just over 3,100) of out-of-tree patches, nearly half of which (1,531) are backports of features from newer kernel releases. There is a relatively small set (287 patches) of "from list" changes that are being discussed on mailing lists but which have not yet found their way into the mainline. The remaining 1,306 patches, about 42%, are "pure Android" changes that are not upstream, and are not currently on their way upstream. Of those, something over a third are vendor hooks (much of the rest is build-system and configuration changes).

A vendor hook, at the lowest level, is simply a special-purpose tracepoint that has been added to the Android kernel. When an Android vendor wants to make a change to the generic kernel, a vendor hook is placed in the appropriate location; the code tends to look like:

    trace_android_vh_feature_name(parameters);

That vendor's device loads a special kernel module that attaches to the vendor-hook tracepoint in order to intercept the control flow at that point. The attached hook can change data structures, inject new code, short-circuit mainline code, and more; it is kernel code with few limits. These hooks allow vendors to add their special code to their kernel without interfering with others, he said.

Finally, 15% of the Android-specific patches are exports of symbols for consumption by the vendor hooks. Android attempts to maintain a stable ABI for these hooks which, Kjos said, often constrains the changes that can be made.

Nearly half of the vendor hooks in the Android kernel are located in the memory-management subsystem and the CPU scheduler; that is where vendors are trying hardest to differentiate their products. Some of these changes are on their way upstream, many others are not.

The chief reason for the use of vendor hooks, he said, is urgency; changes are needed for current products, and the upstreaming process is far too slow. Vendors often have "good intentions", but lack the patience to do the work to mainline their changes. Sometimes they eventually follow through, often they do not. Another reason for vendor hooks is to support hardware that has no upstream drivers.

In general, the policy for the generic kernel image is that the only way to add features to the kernel (other than contributing them upstream, of course) is by way of a vendor hook. The Android maintainers do not understand all of the systems out there and are not able to determine which proposed changes are actually important. As a result, Kjos said, the policy toward vendor hooks is permissive.

The most complex vendor hook in use currently is Qualcomm's Window Assisted Load Tracking (WALT) feature, which is a replacement for the per-entity load tracking (PELT) mechanism used in the mainline. The load tracker informs the CPU scheduler about the resources actually being used by each task in the system, allowing for better scheduling and placement decisions; WALT (which was posted upstream a decade ago) is said to be better for mobile workloads than PELT is. Some of the ideas from WALT, he said, have worked their way into PELT over the years.

Another common use for vendor hooks in the scheduler is avoidance of priority-inversion problems. Some vendors tweak the kernel's locking primitives; others maintain a special run queue in the scheduler for important processes. The objective is always to ensure quick response to user action and smooth displays without dropped frames.

There are about 800 vendor hooks in the kernel, which is quite a few. Kjos concluded by saying that the Android developers would like to reduce that number, and asked how the situation can be improved.

Noting that many of the tweaks were focused on the scheduler, I asked whether thought had been put into directing vendors toward the extensible scheduler class (sched_ext) as an alternative to vendor hooks. Kjos answered that sched_ext is supported in the Android kernel now; that has, he said somewhat ruefully, inevitably resulted in the addition of vendor hooks to the sched_ext infrastructure as well. He added that, in all honesty, he thought it would be better to remain with vendor hooks rather than moving to scheduler implementations that are entirely out of tree. Later in the Android track, Aiqun Yu talked about an effort to move the scheduling of realtime tasks into sched_ext as a way of removing some vendor hooks.

Another audience member observed that one way to reduce the number of vendor hooks would be to simply push back harder on their addition. That is, of course, easier said than done. Kjos responded by repeating that the Android group lacks the expertise to judge all of these hooks, so it is hard to say that any given addition is not valid. At that point, the session ran out of time and the discussion moved on.

The slides from this talk are available.

[Thanks to the Linux Foundation, LWN's travel sponsor, for supporting my travel to this event.]

Comments (4 posted)

Hash-based module integrity for reproducible distributions

By Jake Edge
October 21, 2026

LPC

We last looked in on hash-based integrity checking for kernel modules just over a year and half ago. Since that time, the patch set has undergone multiple revisions. At the 2026 Linux Plumbers Conference (LPC), Thomas Weißschuh described the need for kernel-module integrity guarantees while still providing reproducible builds, how his patches implement that, and some ideas for possible further work.

He began by noting that he has been working on the kernel since he started as a hobbyist in 2018; he is now employed at Linutronix and works on the kernel as part of his job. He then read out the definition of a reproducible build from the Reproducible Builds project, which has been working with distributions and upstream projects, including the kernel, for many years at this point:

A build is reproducible if given the same source code, build environment and build instructions, any party can recreate bit-by-bit identical copies of all specified artifacts.

The two most important pieces of that definition are "bit-by-bit" and "any party", Weißschuh said. If a build process can fulfill those requirements, it will work for anyone who needs it, even if their specific requirements are less strict than the definition provides for. He noted that two other talks that were also in the Build Systems microconference, on OpenWrt reproducibility and bit-by-bit reproducible kernels for WhatsApp, might be of interest to attendees as well.

Reproducible community distributions need independent rebuilders to verify that their packages are truly reproducible. "There's distributions that collaborate, where they build the other distribution's packages. It's a completely different kind of package, [built] on their own infrastructure, then they can cross-check if everything worked out." There are also portals where users can submit the hashes from packages they have built in order to compare with others' results. Beyond that, there are cryptographically signed public transparency logs that collect information on builds from various entities, which can be used to decide whether to trust a particular package build or not.

[Thomas Weißschuh]

He said he was focused on community distributions, such as Debian, Arch Linux, and others; they have achieved 95% reproducibility or better at this point. In fact, Debian is around 99% and will soon add reproducibility to the policy manual as a requirement for its packages, though he was not sure when that would happen.

Currently, a signed module has its signature tacked onto the end of the .ko file; the kernel can verify the signature using a public key that is built into the image. The kernel will contain an X.509 certificate for the public key, but in order reproducibly build the module with its signature, the private key must also be available. That obviously does not work from a security perspective, as attackers can then sign any modules they wish, which defeats the purpose. The most common signing process is for a key pair to be generated at build time; the public key is built into the kernel, and the private key is discarded after it is used to sign any modules that are being built at the same time. That is secure, but not reproducible later.

Kernel modules have full access to all of the kernel internals, memory, and so on, so they are obviously important to protect (and protect against). The kernel's lockdown mode "tries to prevent the root user from compromising the kernel by locking down certain interfaces and it also prevents unsigned modules to be loaded". Other systems, such as Android, have different mechanisms to prevent unauthorized modules from being loaded.

Distributions make different tradeoffs in handling kernel modules. Arch Linux builds its modules with an ephemeral key that is discarded after the build, so it chooses security over reproducibility, while NixOS has no module signatures, which prioritizes reproducibility. Debian has support for both security and reproducibility, but it has a "more involved packaging process" with a special non-public key for some, signed modules and no signatures for reproducible kernel-module builds.

List of hashes

The solution that he and others came up with is to create a list of all of the hashes of the authorized modules and store them in the kernel image. The list will be loaded into memory and used to validate any modules that are loaded. OpenWrt is looking at that solution, but it takes a lot of memory; for example, 5000 modules with 32-byte SHA-256 hash values results in "150KB of memory that are just gone forever from the kernel". One way around that might be to only load parts of the list as needed into memory, but that complicates things. "The building is more complicated, the loading at run time is more complicated, so it's not so great." That solution was discovered by "kpcyrd" from the Reproducible Builds project and, independently by Weißschuh, both in 2024; it was also shipped as part of a commercial Linux vendor's product ten years ago, though he was unsure whether he could name the company so he did not.

One of the reviewers of his patch set suggested using a Merkle tree instead of the list of hashes. A Merkle tree is a binary tree of hash values. Each leaf in the tree is the hash of a kernel module. The next levels in the tree consist of the hashes of pairs of the values for modules, then hashes of pairs of those nodes, and so on, up to the root of the tree. When a module is loaded, its hash is combined with the other hashes on the path to the root and then compared with the hash stored as the root of trust; if they match, the module is valid. A module signature can be created using the index of the module in the leaf nodes along with the hashes of the nodes that are needed on the path to the root.

Using a Merkle tree would fix the memory problem by adding the signature to the module's .ko file, which can then be discarded after validation and loading. Creating the tree just requires using a hash function, which is deterministic, thus reproducible. The root of trust is a single hash for the root of the tree along with the depth of the tree; that is the only information that needs to stay in memory. That root of trust is smaller than the existing X.509 key certificate or the list of hashes used in the earlier versions of his patch set.

There are some benefits to that approach, he said. It would remove the need to do X.509 certificate handling at run time; that code is complicated and has features, such as algorithm flexibility, that are not needed to validate modules that are built alongside the kernel. The dependency on OpenSSL at build time could also be removed in favor of simpler tools that calculate the hashes and create the Merkle tree. An enterprise distributor noticed another benefit: only the root of trust needs to be signed. Previously, the distribution had been using a hardware security module (HSM) to sign each of the thousands of modules, which slowed down the build due to the HSM bottleneck.

Future work

Currently, modversions are used to allow modules built for a given kernel version to load into kernels with "compatible" function prototypes and data structures. That ability is not needed for modules that are built with the kernel and can be verified from the Merkle tree so it could be removed for these built-in modules. Similarly, certain symbol exports could be restricted to only be available to modules listed in the tree. Having verifiable modules would also mean that the metadata specified via the MODULE_INFO() macro could be trusted; currently, modules can just fake whatever they want to put into that metadata, Weißschuh said. Once the kernel can reliably verify built-in modules, other things could also be tied to the "built-in" attribute.

While the new feature "sounds very nice", there is some work that needed to be done to integrate it with the kernel build process. Kbuild currently is set up to build the kernel image first, then calculate some data from it, such as BPF Type Format (BTF) information, then build the modules. In order to put module hashes into the kernel image, the modules must be built first. His patches have some #ifdef conditions to handle that, but it is rather messy and he would like to do something cleaner.

Modules are typically stripped, which removes all of the debugging symbols and reduces their size substantially, when they are installed, thus after the build has completed. But stripping a module changes its hash, so for his scheme, it must be done during the build. His patches strip the modules at build time to calculate the hashes, but still provide the unstripped versions for packaging as before. That relies on both stripping operations producing the same binary, which he is not entirely happy with as a solution, but has not found a better way.

In a review of his patches, Sashiko noted that there is a bug in Kbuild when the makefile is invoked with both the vmlinux and modules targets at once. "The way Kbuild is set up, it will currently be racy and break." Perhaps no one actually cares, he said, but Sashiko did find it; "this is what you get if you are too slow to submit your stuff before Sashiko exists", he said with a smile.

There are some more things he would like to look into going forward. He wants to rework Kbuild or the makefiles to get rid the "hackery" he had to add; he does not know enough about Kbuild but hopes to talk with some experts about it. Another open question is how this new module-signature mechanism should interact with the kernel's Integrity Measurement Architecture (IMA). Currently, IMA can verify module signatures that are appended to each module, so he wondered if IMA needed to be extended to support the Merkle-tree approach. Meanwhile, there are already other Merkle-tree implementations in the kernel (e.g. for fs-verity), should there be a shared implementation for all of those in the kernel tree?

He concluded with the status of the patches. The feature is well-liked by various groups, Weißschuh said, including the Reproducible Builds project, community distributions, and the kernel crypto developers. He is looking for reviews of the patches, especially in the crypto and Kbuild areas; "there's not much review going on". He has a tree on kernel.org with a branch that he intends to keep updated to the latest mainline.

The first "question" was from Matthew Garrett who wanted to be added to the list of those who are in favor of the patches; "lockdown is my fault and I like this" verification scheme. Fs-verity maintainer Eric Biggers also said that he liked the solution because it was so much simpler than the existing signature-handling code in the kernel. He noted that it requires building all of the modules with the kernel, because adding other modules later would not be possible. Weißschuh agreed, but said someone could extend the scheme to work with additional modules that were built later and incorporated into their own Merkle tree; that information could be passed into the kernel at boot time to expand the list of allowed modules.

Biggers said that he has also worked on dm-verity, which uses a Merkle tree, but he did not see an opportunity to share Merkle tree implementations between it, fs-verity, and module verification. The SHA-256 code should be shared, of course, but each Merkle tree has its own layout and ways that it is used, so there is little commonality. Weißschuh said that he is using the same SHA-256 function for verifying modules, but for now is still using OpenSSL for SHA-256 at build time; as he said earlier, that dependency could be removed in favor of simpler tools if desired.

The YouTube video and slides from the talk are available.

[Thanks to the Linux Foundation, LWN's travel sponsor, for assistance in attending LPC in Prague.]

Comments (10 posted)

Safe self-referential data structures in kernel Rust

By Daroc Alden
October 16, 2026

Kangrejos

Self-referential structures that can be used without unsafe code have posed a problem for Rust for years. There are many cases where a self-referential data structure is the elegant algorithmic choice, but implementing it in accordance with Rust's lifetime rules is all but impossible. At Kangrejos 2026, Gary Guo presented a clever solution to the problem in the context of the kernel's pin_init crate, which helps with the creation of immovable data structures, typically for interoperability with C. Guo's changes could help remove most of the unsafe code related to lifetimes in the Nova driver and, eventually, other Rust components.

Type theory background

Guo began with some background definitions from his slides that are necessary to understand the problem and his solution to it. Many programming languages have a notion of subtyping. For example, in Python all classes are subtypes of object. Rust has extremely limited subtyping, which only applies to types that differ only with regard to lifetimes. But, for example, the reference type &'a Foo is considered a subtype of &'b Foo when the lifetime 'a lasts longer than 'b. To put it another way, whenever the program asks for a reference that lasts at least as long as 'b, it is valid to supply an &'a Foo as long as 'a is, in fact, a lifetime that outlasts 'b.

For generic types, we can introduce some further relationships related to subtyping, he said. If some type Sub is a subtype of Super, then a generic type where Generic<Sub> is a subtype of Generic<Super> is called covariant. Built-in references are an example of a covariant type: an &&'a Foo (a reference to a reference to a Foo) is a subtype of &&'b Foo under the same conditions as the example above. On the other hand, some types work the opposite way. When Generic<Sub> is a supertype of Generic<Super>, Generic is said to be contravariant. An example is function types; the type fn(&'b Foo) is a subtype of fn(&'a Foo) because it is less demanding. Passing a function that expects a reference which lives at least as long as 'b to a piece of code that is going to give it something that lives for 'a is valid, as long as 'a outlives 'b.

And, of course, most generic types are neither subtypes nor supertypes of each other, even if they take the same type parameter. This case is called invariance. Mutable containers are almost always invariant, since if it were possible to write a supertype of the contained item into them, this could result in a container that contains the wrong type of item. An &mut &'a Foo and an &mut &'b Foo are not interchangeable in either direction, since the mutable reference can be read from (a covariant operation) and written to (a contravariant operation).

Another important background concept, Guo explained, is the idea of well-formedness. Referring to a type in a Rust program at all requires the compiler to check that the type is well-formed (i.e., that the type being named is allowed to exist at all). For example, if two lifetimes 'c and 'd exist and don't overlap at all, then trying to name the type "&'c &'d Foo" doesn't make sense, because no such thing can possibly exist. At the time the 'c lifetime starts, there can't be any 'd references, and vice versa. Writing a nested reference like the above requires that 'd lasts longer than 'c.

Rust programmers don't typically need to worry much about well-formedness, because the compiler inserts the necessary type bounds automatically. One use that does require manual tweaking is when the compiler warns that some generic type parameter needs to live for the 'static lifetime — that requirement comes from needing the type to outlive with some other lifetime in the program, and the only lifetime that outlives all other lifetimes is 'static.

One subtle detail about well-formedness in Rust was necessary to highlight: there is a difference between type inference in function signatures and function bodies. When a type appears in a function signature, the compiler assumes that it must be well-formed, and generates bounds that must be satisfied by the caller of the function to ensure that is the case. When a type appears in a function body, the compiler directly checks whether the written type is well-formed or not.

The last piece that Guo needed to introduce was a little more complicated. Polymorphism is the type-theory word for generics; a function is polymorphic if it takes a generic type parameter, and can therefore be called on several different types. Languages differ in exactly how they implement polymorphism, primarily on whether it is possible to define polymorphic function pointers, or whether function pointers must have a concrete type specified in advance. Rust chose the former option, which is known as higher-rank polymorphism, although it only allows it to apply to lifetime parameters. As a result, the following Rust code works:

    fn foo<'a>(x: &'a u32) {}
    fn test() {
        // bar is a reference to a function ...
        let bar = &foo;
        // ... that can be called on references
        // with two different lifetimes:
        bar(&identity(1));
        bar(&identity(2));
    }

Note that the identity() function, which simply returns its input, is necessary here to prevent the compiler from determining the lifetimes to be 'static and therefore equivalent. Since the example takes references to two different temporary values, the former is always cleaned up by the time the latter executes, so the lifetimes are disjoint.

That example uses type inference to determine the type of bar, but if required to write it out, the programmer would write "&dyn for<'a> Fn(&'a u32)". That is, a pointer to a function that has a parameter which is a reference to a u32 that is valid for any lifetime that the caller names.

Device resource lifetimes

With that background out of the way, Guo was able talk about why the kernel needs self-referential structures. Devices can have resources that may only be accessed as long as the device is bound. For example, unplugging a device can unbind it, making it invalid to access its device memory. The original solution to modeling this in the Rust driver bindings was the Devres type, which used a Revocable pointer internally to force users to check that their device still existed on every access to it. This was messy, because it introduced fallible access paths across driver code, when the driver should really already know when a device is bound or unbound.

Eventually, an in-progress patch set needed access to a device while within the Drop implementation of a type, which is not permitted to fail. Fixing that with the existing abstractions would have required rewriting the type to not reference the device, which would have turned into a large refactoring of the driver's logic. Since it was obvious to human examination that the device could not be unbound in the relevant context, it would have also introduced several unreachable error paths. So, Guo began looking for a way to model this problem with Rust lifetimes, so that the compiler could be used to prove that the various error paths really were unnecessary.

The first problem is dealing with type erasure. Drivers can provide "auxiliary buses", which are interfaces that are exposed to other drivers. When another driver binds to the auxiliary bus, it receives an auxiliary::Device structure, which erases any type information about the driver it is bound to. If a driver's main structure does not have any generic lifetime parameters, it is easy to convert a Device to the expected type using Any:

    impl auxiliary::Device {
        fn registration_data<'this, T: Any>(&'this self)
            -> Option<&'this T>;
    }

The above is a simplified type compared to the implementation in the kernel, but it captures the same operation: given a reference to a Device, and some expected type T, registration_data() will either return a reference to T valid for the same lifetime, or fail. That only works when T implements Any, but only types that do not contain non-'static lifetimes are allowed to implement Any. So, in order to allow driver resources to be associated with lifetimes, Guo needed to change the registration_data() API to avoid using Any.

His proposed solution looks like this:

    impl auxiliary::Device {
        fn registration_data<'this,
                             for<'a> T<'a>
            >(&'this self)
            -> Option<&'this T<'this>>;
    }

That is, require a driver type T to be well-formed for any lifetime, as expressed using a higher-rank polymorphic type (technically, a higher-kinded type, meaning a type that passes generic arguments to a type variable). That means that now, when trying to down-cast a Device into a T, the code can always produce a T value that lives for as long as the provided reference does. This is safe because the driver providing the auxiliary bus already needs to live for that lifetime. The change essentially allows the lifetime to be passed through the type-erased interface.

The problem is that Rust does not currently support writing the above. It may do so in the future, since the compiler team has been expanding support for higher-rank polymorphic types throughout the language slowly and cautiously, to avoid breaking the type system. Not much code needs to write higher-ranked types, so this is not normally a problem.

The fact that other parts of the language do support higher-rank polymorphic types, however, means that it is possible to implement a workaround by defining some helper traits and rewriting the function signature to use them. Implementing the helper trait correctly is tedious (and can sometimes expose bugs in the current trait solver), so the kernel provides a CovariantForLt!() macro (and a non-covariant version) that implements the boilerplate automatically. With that in place, the signature essentially becomes:

    impl auxiliary::Device {
        fn registration_data<'this,
                             T: CovariantForLt + 'static
            >(&'this self)
            -> Option<&'this T::Of<'this>>
    }

The actual signature in the kernel also adds a Pin wrapper and uses Result to provide a more informative error message. With the problem of converting type-erased auxiliary::Device structures back into typed driver structures involving lifetimes solved, it is now possible to rewrite existing driver structures that use Devres to use plain references. For example:

    struct MyDriver {
        device: ARef<Device>,
        pci_bar: Arc<Devres<Bar<BAR_SIZE>>>,
    }

becomes:

    struct MyDriver<'bound> {
        device: &'bound Device,
        pci_bar: Arc<Bar<'bound, BAR_SIZE>>,
    }

This is better, but it still includes a reference-counted pointer, Arc, when it really shouldn't be needed: conceptually, the PCI base address register (BAR) should live for the same amount of time as the Device structure. That can be worked around; the Nova driver uses unsafe code to initialize a structure that looks like this:

    #[pin_data]
    struct NovaCore<'bound> {
        reg: auxiliary::Registration<
            'bound, ForLt!(NovaCoreApi<'_>)
        >,
        gpu: Gpu<'bound>,
        bar: Bar<'bound, BAR_SIZE>,
    }

The reason that code is unsafe is that gpu holds a reference to the BAR internally, so it should not outlive the Bar structure, but this declaration says that they live for the same amount of time. That makes constructing and deconstructing values of this type require a small amount of unsafe code. It would be a better solution if it were possible to teach the existing pin_init!() macro to handle all of the unsafe parts and make creating a NovaCore structure safe. The entire effort began by trying to remove unnecessary error paths in drivers; replacing those with more unsafe code would not be a huge improvement.

This is a known problem in the Rust ecosystem, Guo said. Several existing crates, such as moveit, rental, yoke, and ouroboros implement self-referential structure initialization for safe code. The kernel's requirements make adopting their use quite difficult, however. The user-space crates all assume that implicit allocation is acceptable in some cases, but it is not permitted in the kernel in general. Additionally, many of the existing crates are unsound — they do not implement their unsafe components correctly, and it is possible to write seemingly safe code using them that breaks Rust's language guarantees.

So, Guo decided to figure out a solution himself. With his patch set, it is now possible to write Nova's driver structure like this:

    #[pin_data]
    struct NovaCore<'bound> {
        reg: auxiliary::Registration<
            'gpu, ForLt!(NovaCoreApi<'_>)
        >,
        gpu: Gpu<'bar>,
        bar: Bar<'bound, BAR_SIZE>,
    }

And to initialize the resulting structure using a normal pin_init!() call. He is fairly certain that his solution is sound, although the latter half of the talk was dedicated to explaining the great lengths necessary to achieve that. The key syntactical change is that now the #[pin_data] macro allows using the names of members of the structure as lifetimes. Therefore, the code can accurately record the fact that gpu keeps a reference to bar or that reg references gpu. Using this information, in turn, it generates code for constructing and deconstructing the self-referential structure correctly.

Actually accessing the self-referential fields is a little different, because the language doesn't really support accessing self-referential fields. Instead, the #[pin_data] macro generates helper functions. A field named foo will generate a method called foo() (for covariant fields) or with_foo() (for invariant fields). Writing to the structure can be done using the with_project() helper function. That syntax could potentially be improved a bit if the Beyond the & initiative makes progress.

The long, hard road to soundness

Writing a basic macro that allows that syntax to work was not really the hard part, however, Guo explained. The part that took up most of his time was making sure that the resulting interface was completely sound. To illustrate why, he put up the simplest possible example, and then walked through a number of potential macro implementations and why they were wrong.

    #[pin_data]
    struct MyStruct {
        borrow: &'owner String,
        owner: String,
    }

The easiest way to expand this would be to convert the &'owner String type to &'static String and then check accesses to the field. This doesn't work because user code could just access the borrow field directly, without the check, and do something that violates the 'owner lifetime.

Preventing that is not particularly difficult. The pin_init crate can define a private wrapper type, Erase, and use it to wrap the value of the field. That way other code cannot directly access the value of the field. Except that is not sound either, because auto traits can still observe the wrapped type, and therefore make incorrect inferences based on the 'static lifetime. That is not observable with the example because String is thread-safe (Sync), but it could come up with other types. If the given example were expanded to use 'static, the compiler would infer that it should implement Send, which allows sending the structure to another thread, and that is not necessarily permitted.

So, to prevent that, it is once again necessary to turn to higher-rank polymorphism. The pin_init crate defines a much fancier wrapper type, and this allows the compiler to infer auto trait implementations correctly. The most complex part of the fancy wrapper type is the fact that it needs to be written recursively, to deal with cases where a field references the lifetime of multiple other fields. In the code below, the implementations of traits for (T,) are the base case of the recursion, where the one-item tuple type (_,) is used as a marker that it is time to stop. The recursive case uses function types as wrappers to introduce lifetimes, since function types are allowed to be written with higher-rank polymorphism.

    trait EraseLifetime {
        type Erased;
    }
    impl<T> EraseLifetime for (T,) {
        type Erased = T;
    }
    impl<T> EraseLifetime for T where
        T: for<'a> FnOnce<(&'a (),), Output: EraseLifetime>,
    {
        type Erased = <
            <T as FnOnce<(&'static (),)>>::Output
            as EraseLifetime
        >::Erased;
    }

    #[repr(transparent)]
    pub struct Erase<F: EraseLifetime>(F::Erased);
    unsafe impl<T: Send> Send for Erase<(T,)> {}
    unsafe impl<F: EraseLifetime> Send for Erase<F>
    where
        F: for<'a> FnOnce<(&'a (),), Output::EraseLifetime>,
        for<'a> Erase<<F as FnOnce<(&'a (),)>>::Output>: Send,
    {}

The result is a way for the macro to encode a type that essentially acts as for<'a> Foo<'a> even though Rust does not yet permit that for non-function types. The minimal example can be expanded to:

    struct MyStruct {
        borrow: Erase<
            for<'owner> fn(&'owner ()) -> (&'owner String,)
        >,
        owner: String,
    }

That way code outside of pin_init cannot directly access the data inside borrow, but it also isn't given an incorrect lifetime such as 'static, so the compiler is happy. There is an unstable Rust feature, unsafe binders, which would let the entire wrapper type be done away with, in favor of writing:

    struct MyStruct {
        borrow: unsafe<'owner> &'owner String,
        owner: String,
    }

Until that feature is stabilized, however, the wrapper-based workaround allows pin_init to restrict access to the underlying field just as well, and users will not need to care much about the implementation since it is internal to pin_init. Guo did warn that, if the kernel ever changed the semantics of pinning to be per-byte, the above implementation would become unsound and would need to be updated.

Stop, drop, and roll

There is some work still needed, however: the above allows self-referential structures to be safely constructed, but it is still possible to cause problems when freeing them. "This is one of the parts of the language [that] I hate most. Of many," Guo said. In Rust, the compiler will drop fields of a structure in order. If the owner field is listed first, then it will be dropped first, which will make borrow into a dangling reference, which is not permitted.

It is fairly easy to check that fields are declared in the right order by making sure that fields can only refer to later fields. Except that check alone is not enough. Consider this pathological example:

    #[pin_data]
    struct MyStruct {
        what_the_heck: &'later_owner &'owner (),
        borrow: &'owner String,
        owner: String,
        later_borrow: &'later_owner String,
        later_owner: String,
    }

The existence of a &'later_owner &'owner () makes the compiler assume that 'owner must be a longer lifetime than 'later_owner, which isn't true, because owner is dropped first. This makes it possible to convert a &'owner String into an &'later_owner String, so user code could take the value in borrow, move it to later_borrow and access owner after it has already been dropped.

This is because the compiler assumes that references in structure definitions are well-formed — an assumption that is generally safe in the absence of macros doing strange things with lifetimes. Luckily, there is a separate context where well-formedness is checked rather than assumed: inside a function body. The solution, therefore, is to have #[pin_data] generate a new function, which will never be called, that declares local variables with the same types in the order that they will be dropped. Even though it won't be called, the compiler will still type-check it, which makes the example above emit a compiler error.

Access

With creation and destruction handled, Guo turned his attention to accessing fields. Direct access is blocked by the opaque wrapper, but developers still need to access those values somehow. For covariant fields, it's easy to generate a method that takes a reference to the overall structure and returns a reference to a specific field. Non-covariant fields are more complicated, because the code needs to ensure that the involved lifetimes are not inadvertently extended. Guo accomplishes this by introducing a callback-based API that uses a higher-ranked polymorphic function trait bound to ensure that the provided callback is able to comply with the requirements imposed by the self-referential type.

This technically lets users access the fields of the structure, but it's not easy to access multiple non-covariant fields at the same time. Therefore, the macro also generates a project() method that produces a new type that downgrades borrowed fields to shared references. Invariant fields are removed, since they can't be safely downgraded in this way. The result is a new type that provides convenient read-only access to most fields of the structure at the same time.

But sometimes code needs mutable access to multiple fields simultaneously, or to invariant fields. To handle that, Guo's code generates a final method, with_project(), that uses the same callback-based interface to provide access to a projected type holding mutable references to the self-referential type's fields.

"This is perhaps one of the most thorough defenses ever done by a self-referential library," Guo said. Despite the complicated code generation, he believed that the resulting design was sound, and as ergonomic as it could be given the kernel's constraints. Since every property relied on for soundness was checked by generating code that used Rust's type system to perform the check, he was convinced that the design was good.

The next problem

At least, he was convinced until Danilo Krummrich tried to use the new design in Nova, and ended up producing an example that should have worked, but instead resulted in a difficult compilation error. The core part of his example looks like this:

    #[pin_data]
    pub(crate) struct CommandQueue<'a> {
        #[pin]
        #[not_covariant]
        inner: Mutex<CommandQueueInner<'a>>,
    }

Nvidia GPUs have a command queue that is used to communicate with the GPU system processor (GSP). Access is protected by a mutex, so that the command queue structure can be shared between threads. In practice, the code never actually puts new data with a lifetime inside the inner structure, but the compiler has no way to know that. Therefore, introducing the mutex makes the field invariant over 'a. That would not be a problem if that invariance did not propagate to other structures that contain a reference to the command queue, eventually reaching the top level NovaCore structure.

That leads to problems when constructing an auxiliary device. The auxiliary registration field in NovaCore uses the ForLt!() macro discussed above. That macro only allows a structure to be generic over a single lifetime, which is the lifetime of the overall driver in this case. Since the propagated lifetime from the command queue ends up being fixed by the command queue's invariance, the auxiliary registration must be given two incompatible lifetimes.

Guo was eventually able to discover a workaround: keep a reference to the overall device in the command queue structure, so that the data inside the mutex can refer to its lifetime directly. Due to well-formedness constraints, this lets the compiler see that the two syntactically different lifetimes are compatible, and eliminates the problem.

    #[pin_data]
    pub(crate) struct CommandQueue<'a> {
        #[pin]
        #[not_covariant]
        inner: Mutex<CommandQueueInner<'dev>>,
        dev: &'a Device<Bound>,
    }

But is this workaround really sound? As it turns out, no, and it reveals a problem in the implementation of #[pin_data]. To explain why this workaround is invalid, Guo needed to turn to the concept of an existential lifetime.

Existential lifetimes

At this point, Guo switched to a slide showing formal type-theory inference rules, which produced some general disbelieving laughter. Guo insisted that this really was the best way to understand. The code examples he had shown so far had included higher-ranked universal quantification: for<'a> &'a Foo is a type that is valid for any choice of 'a. Existential lifetimes are the opposite (or, more specifically, the categorical dual): a type that is valid for some lifetime 'a, but the programmer is not required to name which specific lifetime they are talking about. Rust mostly does not support them, but if it did, a syntax such as exists<'a> Foo<'a> might be taken to mean that there is some choice of lifetime that makes Foo<'a> a valid type, but the specific choice is not being named.

If such a type existed, then it would be possible to write self-referential structures using it, with the exists clause serving to introduce the lifetimes of individual fields:

    struct MyStruct {
        borrow: exists<'owner> &'owner String,
        owner: String,
    }

This is helpful because it would remove the need for a generic lifetime parameter to be passed to self-referential structures, which would make the types themselves lifetime-free. And there is a way to write this in Rust, even though it doesn't support existential types directly. The Church encoding of existential types allows them to be expressed in terms of universally quantified higher-ranked polymorphic types. The existential type:

    type X = exists<'a> Foo<'a>;

becomes:

    trait ExistsFoo {
        fn with<R>(
            self,
            f: impl for<'a> FnOnce(Foo<'a>) -> R
        ) -> R;
    }

    type X = dyn ExistsFoo;

This is exactly the encoding that the generated with_*() methods produce. Guo called this approach "basically ForLt!() turned inside out," although the correspondence was not particularly obvious.

That correspondence did show that the problematic command-queue type could be rewritten in terms of exists. That produces a type that is structurally similar to the below:

    type X<'a> = exists<'b> (&'b &'a String, Mutex<&'b String>);

Treating that type as covariant over 'a would be unsound. The presence of the first reference implies that 'a outlives 'b. That's not true under that assumption in general, because 'a could be covariantly shortened, leading to a use-after-free bug. This is strange because the corresponding structure type that does not use existential types is sound:

    type X<'a, 'b> = (&'b &'a String, Mutex<&'b String>);

In this case, the compiler has enough information to say that 'b forms a lower-bound on 'a. Therefore, it forbids shortening 'a in such a way that it would no longer outlive 'b. The compiler couldn't make that determination in the hypothetical existential-type version because the lifetime 'b was effectively erased by the exists binding.

So, this suggests a more restrictive subtyping rule for existential lifetimes: in order to be able to say that an expression involving existential types is covariant over a free lifetime 'a, that lifetime must occur in covariant position and no erased non-covariant lifetime may be a lower bound for it, as implied by the well-formedness conditions. It is acceptable for erased non-covariant lifetimes to be upper bounds for 'a, however. This alternate rule would make the problematic existential type invariant over 'a, which would be safe.

Existential lifetimes do not exist in Rust today, but if they were ever implemented they would need to follow this rule to be sound, Guo said.

Back through the mirror

With that insight in hand, it is possible to transform the problematic type back to the format that the command queue structure was written in. This adds an additional check to the generated code, and correctly causes the compiler to determine that CommandQueue<'a> is invariant over 'a.

That closes the soundness hole, but it still leaves a problem: the whole motivation of adopting the workaround in the command-queue structure was to ensure that the type would be covariant over 'a, so that its invariant nature does not propagate up to the root driver and cause problems for the auxiliary binder. Therefore, it would be pleasant to have a way to write that correctly.

The solution is a slight extension to the #[pin_data] macro, allowing it to introduce new lifetimes that are used as upper bounds for lifetime parameters (lifetimes that must live longer than the lifetime parameter). Since that is an exception to the more restrictive subtyping rule for existential lifetimes, it allows introducing an existential lifetime that cannot be misused to cause a use-after-free bug. But because the Church encoding of an existential type would be complex to write, the macro adopts some custom syntax to allow writing exists bindings, even though Rust does not normally support those. The result is that the command-queue type can be written like this:

    #[pin_data]
    pub(crate) struct CommandQueue<'a>
    where
        exists<'cmdq>: 'a,
    {
        #[pin]
        #[not_covariant]
        inner: Mutex<CommandQueueInner<'cmdq>>,
    }

With this, all lifetime-related unsafe code in Nova can be removed, Guo said, apart from the debugfs code which needs an additional interface change. In terms of the implementation, it adds surprisingly little code to pin_init, since much of the implementation can be shared with covariant self-referential fields.

Next steps

Guo is pretty sure this time that the final implementation of #[pin_data] is correct. It also should not require users to understand most of the details that he went over in his talk. For the most part, users should be able to write self-referential structures just by using field names as lifetimes:

    #[pin_data]
    struct Example {
        borrower: &'owner Foo,
        owner: Foo,
    }

If they do something invalid, such as writing borrower after owner, the macro will say so with an explanatory message. Similarly, it infers the use of helper annotations like #[not_covariant] as far as possible. Guo isn't completely happy with the quality of the error messages; originally, he hoped to get a limited form upstream in this kernel cycle, so that he had time to work on improving the error messages and documentation for the rest of the work. Discussions after the conference convinced him to post all of the work as one series.

Still, despite Guo's commendable dedication to ensuring that the solution is simple for users, the solution is not particularly simple for reviewers of pin_init. By the end of Guo's talk, many of the kernel developers in attendance seemed somewhat shell-shocked. Whether Guo is able to get reasonable reviews of his patch set remains to be seen.

[ Thanks to the Linux Foundation, LWN's travel sponsor, for their assistance in traveling to Kangrejos. ]

Comments (33 posted)

Recent and future changes to the Linux NFS server

By Jonathan Corbet
October 16, 2026

LPC
The NFS network filesystem protocol has a long history on Unix-like operating systems (and beyond). NFS is still evolving, though, and implementations need to keep up. At the 2026 Linux Plumbers Conference, NFS developer Jeff Layton gave an overview of recent enhancements to the Linux implementation, along with some hints for what will be coming in the near future.

Layton jumped immediately into a long list of new features added to the NFS server, starting with LOCALIO. While NFS servers are normally on remote computers, there are situations where the client and server can be on the same physical host; this can happen with containerized workloads, for example. There is now a protocol that allows the two sides to determine whether they are on the same host and, if so, bypass most of the protocol handling and route requests directly to the filesystem, improving performance considerably.

[Jeff Layton] The server has supported remote copy requests for some time; if a file is being copied to another location on the same server, it makes sense to execute the operation on that server rather than routing the data through the client. Copies to a third server can also be made to bypass the client. Synchronous remote copy operations have been supported for some time; adding support for asynchronous operations was harder, and required fixing some problems in the specification first. The feature is now implemented and enabled by default.

Control over I/O caching is a big improvement, he said. Historically, the server has only used buffered I/O, which can fill the server's page cache when lots of data is moved. But NFS servers do not actually benefit much from the page cache; since NFS clients do aggressive caching of their own, the hit rate on the server's page cache tends to be low. Now the server can perform uncached I/O operations, either by using direct I/O or by explicitly requesting that caching be disabled. This feature is controlled by server options now, but will be exposed as options in the exports file in the future.

There has been work to increase a number of implementation limits. RPC frames can now be up to 4MB in size, and the server can have 8MB buffers. Thread-pool sizing can be dynamic, adding or removing server threads as needed; this feature is off by default, but that may change in the future. Finally, performance has been improved by breaking up the global mutex, addressing a design that, he said, was "fine in the 1990s". There are now separate mutexes for each network connection, and a reduced (but still global) mutex protecting the file cache.

Layton mentioned the server's use of multi-grain timestamps. The NFS protocol depends heavily on metadata attributes for cache invalidation, and the file-modification times in particular. Those times have traditionally been coarse-grained on Linux; that can lead to problems when multiple changes can happen without apparently changing a file's timestamps. Using multi-grain timestamps ensures that every file change will cause an observable timestamp change. There is support for multi-grain timestamps in the Btrfs, ext4, XFS, and tmpfs filesystems now, with more in the works.

Traditionally, the server has been the keeper of truth regarding file timestamps. The NFSv4.1 attribute-delegation feature allows clients to manage them (along with the file size), resulting in less traffic to the server. This feature, which is described in RFC 9754, turned out to be tricky to implement. But then, Layton said, "anything with timestamps turns out to be tricky".

NFSv4 write delegation allows clients to do more aggressive caching as well. Recent changes have added support for write delegations on files opened for write-only access; this is helpful for single-client, write-intensive workloads.

NFSv4.1 directory delegations can improve the caching of directory entries in clients, and this feature provides for asynchronous notification of changes as well. The server can now send incremental updates to a client rather than revoking a delegation entirely. This feature is supported almost fully, he said, but lacks support for "child attribute" delegations, which cover all of the children of a given directory. Those are bad for scalability, so he did not implement them. The client side now has support for revocable delegations. This feature speeds up "the only benchmark that matters" — kernel builds.

Dynamic session resizing will provide more control over per-client resource consumption on the server. The number of slots available to each client will vary, depending on the workload and the resources available on the server.

The original specification for NFS access control lists (ACLs) followed a Windows-like model; this was an attempt to bring Windows users over to NFS that did not really work. The NFSv4.2 POSIX ACL extension backs away from that approach; the server can now send POSIX ACLs directly between the client and server.

Signed NFS file handles have been added as a defense against handle-guessing attacks. An attacker who can correctly guess a file handle can gain access to files that would otherwise be unreachable. File handles can now be cryptographically signed, and that signature is verified before allowing access via a handle. An attacker who can sniff network traffic can still pick up a valid file handle, but combining this feature with TLS gives a "fairly secure" solution.

Case folding is not something he cares much about, he said, but some Windows users do, and the NFS specification allows it. Now, if a filesystem implements case folding on the server side, that behavior can be presented to clients as well.

Then, there is NFS re-export, where a server exports a filesystem that it, in turn, is accessing via NFS. There are a few use cases for this feature, including adding support for clients that do not implement the newer protocols. There are some sites that want to build caching proxies for NFS; this is done in AWS and on the Google cloud now. He suggested reading the extensive "Adventures in NFS re-exporting" thread for more information.

The NFS server has long been managed via a virtual filesystem interface, which is awkward to deal with. This problem has been addressed by adding a netlink API, which is also easier to implement and more extensible. There is a new command (nfsdctl) in the nfs-utils package that uses this interface. New features will only be controllable by way of this API; the old /proc/fs/nfsd interface has been deprecated. The mountd daemon has also been moved over to netlink.

The kernel's XDR code was once written by hand, but now there is an xdrgen toolchain to generate it automatically. The result is far less error-prone. The tool currently produces C code, but that will change to Rust at some point. The Sun RPC layer is a large attack surface for the kernel; moving it to a safe language makes sense, he said.

There is a new document aimed at contributors to the NFS code; Layton expressed doubt about whether anybody is actually reading it, though.

Like everybody else, the NFS maintainers are seeing a flood of patches of varying quality. Since the NFS server is exposed to the network, it is important to take security seriously, so the developers have been trying to fix as many vulnerability reports as possible. The "worst of the worst" have been fixed upstream at this point.

The talk ended with a whirlwind tour of changes that can be expected soon. The I/O caching controls will be moving to the exportfs command in the near future. Support for pNFS SCSI layout is improving, with hardening being a priority. More of the protocol code will be created by xdrgen in the future, and more control operations will move to the netlink API. "TLS session tagging" will allow administrators to use certificates to restrict access to filesystems. Support for the old NFSv2 protocol will be removed; Layton said there is no real reason to use it, and its removal is just waiting for distributors to turn it off. Finally, he mentioned work at the virtual filesystem level to support parallel directory-changing operations, which are serialized now. NFS doesn't need this feature in general, he said as the talk concluded, but it can be beneficial for workloads that are heavy with file creation and deletion operations.

[Thanks to the Linux Foundation, LWN's travel sponsor, for supporting my travel to this event.]

Comments (19 posted)

SUSE's efforts to disable setuid system-wide

By Joe Brockmeier
October 20, 2026

All Systems Go!

Setuid (and setgid) binaries have long been a source of headaches, and security vulnerabilities, on Linux systems. They are largely seen as something to be avoided; SUSE's security team, for example, forbids the inclusion of setuid or setgid binaries in packages unless they have been reviewed and explicitly allowed. Thorsten Kukuk wants to go a step further and disallow them entirely. At the 2026 All Systems Go! conference, he spoke about his work to disable setuid system-wide, as well as some of the hurdles that remain.

I did not attend the All Systems Go! conference this year, but I watched the video of this session after it was published, and followed the slides.

Problems with setuid

Kukuk introduced himself as a distinguished engineer at SUSE. He leads its "Future Technology Team", which is responsible for integrating new technologies into SUSE's products that might be interesting to customers. One of the areas he has been exploring is using systemd's "NoNewPrivileges=yes" configuration option for PID 1 itself, thereby enabling the kernel's no_new_privs flag for all processes.

He explained that when execve() is called by a binary that is setuid, setgid, or has file capabilities, then the new process receives them as well. However, if the no_new_privs flag is set, then this is prevented, and the setting is persistent across new execve(), clone(), and fork() syscalls. He noted that no_new_privs does not block privilege changes that do not involve execve(); a task with the appropriate privileges can still call setuid() or setresuid().

The reason this flag is important is that setuid binaries provide an easy way for attackers to elevate privileges if there is a bug in a setuid program. He said the feedback from SUSE's security team is that a "a well-defined IPC service [that calls a privileged program] is infinitely preferable over any setuid binary". The team wanted to deny setuid programs years ago, "but never had the resources and time to do it".

When the Copy Fail disclosure was announced, Kukuk tried the generic, distribution-independent exploits on systems with NoNewPrivileges=yes enabled. "None of them worked." In the pre-LLM era he would have said that disabling setuid binaries "would have stopped every script kiddie". He doubted that it would stop all of them now, however, because some will simply use an LLM to tailor attacks to specific systems. That does not, however, mean that it's not worthwhile to disable setuid binaries.

Finding setuid binaries

Kukuk said that he set out to find all of the setuid binaries or file capabilities used by applications, and focused on the server profile first to avoid being overwhelmed by all of the desktop applications that might use them. He added, later, that he is already using NoNewPrivileges= on his own desktop. "Even on a desktop with KDE it's working, at least with the applications I need".

He wrote a utility called scan-caps, which is part of account-utils, to list all binaries that are configured with setuid, setgid, or capabilities. He displayed a slide with a long list of utilities and applications that he identified as part of his work, such as the shadow-utils password suite, Linux pluggable-authentication modules (PAM), polkit, su, sudo, and others.

His goal is to make sure that the majority of tools work without any change for the user. "If we use a replacement for the shadow suite, we should not notice that it is using something else. Configuration, behavior should all stay the same". There is a small set of what he called "intrusive packages" that would introduce behavioral changes. For example, if sudo is replaced with run0, then users will have to change the way they manage a system. "In one case, you edit the sudoers file, in the other case, you need to create polkit rules. That is a breaking change."

Account management

Kukuk started his work by looking at account management, "because password authentication is something you always need". All of the setuid binaries he found that were related to account management, sudo, Linux PAM, and even MariaDB's authentication can require access to /etc/shadow to read a user's entry. He decided to delegate that to systemd services (pwaccessd and pwupdd) that communicate via a varlink interface. The pwaccessd service allows access to a user's own /etc/passwd or /etc/shadow entry, while the pwupd service lets users change their password and so forth. These services are running as root, he said, but sandboxed as much as possible; they only have access to /etc/passwd and /etc/shadow. "Even if you somehow manage to break out or call it, you cannot do much more."

His account-utils suite includes versions of standard utilities such as chage, chsh, and passwd that use the systemd services instead of GNU C Library functions to modify user passwords, and so forth. His first idea was to "enhance" the shadow-utils suite to communicate with the new systemd services. "Looking at the code, I didn't find a way without rewriting the whole code to attach such a call. So I created new, very small client binaries, and the same for PAM unix".

The end result is that the additional privileges are no longer needed, and that all tools handling authentication are now using the same set of rules. If those rules need to be changed, the configuration is in a single place (pwaccessd.conf) and the administrator does not have to find all of the applications that are handling authentication. There is also a PAM module (pam_unix_ng.so) that uses pwaccessd for accessing account information and authentication. Applications such as MySQL or MariaDB that need to access user passwords for authentication can be added to the access list via pwaccessd.conf.

Kukuk said that run0 was the only tool that could replace the system-management tools that require setuid binaries: su, sudo and polkit's pkexec. However, he said, there were a few problems with run0 as a replacement. The first problem he cited was that desktop users who use run0 in a terminal session are likely to be presented with a KDE or GNOME dialog for authentication, rather than being able to enter the password at the terminal as expected. (This is a known problem.)

He said that he had already seen quite a few bug reports about this behavior, including a few that thought that the prompt was caused by malware. To make run0 less surprising to users, he created a wrapper for it that supports the most important options of pkexec, su, and sudo. "I haven't run into any case where the wrapper couldn't replace a real sudo or su call in a script."

Other scenarios

There were a few other cases that he went through rather quickly, such as running setuid binaries within containers. He said that he had a plan for using eBPF to mark "trustworthy" containers so that the no_new_privs flag would not be set for them.

But the big question, Kukuk said, is whether setuid binaries were needed in containers at all. He had looked at 40 containers and found that su was only being used to drop privileges, rather than to gain new ones. However, sudo was affected by setting no_new_privs and refused to work at all. He did find that his Pi-hole container did not work, surprisingly. "All my tools are telling me it should work, so I need to take a deeper look".

The only real issue, he said, was with distribution containers using tools such as Distrobox. Users tend to run those as a regular user, but use sudo and su to become root within the container to install software. The workaround for those is to use podman exec or docker exec outside the container. He also found that running rootless containers works with Podman, but not Docker. The reason Docker does not work is because it depends on RootlessKit, which has a bug in the way it manages privileges. That may be fixed in an upcoming release, but he was not certain of that.

Filesystem in Userspace (FUSE) mounts also require a setuid binary. He noted that he uses the Signal desktop application's AppImage, which requires FUSE, and the fusermount3 binary is setuid root. He said that he is currently using defused, which is a fusermount implementation that does not require setuid.

Postfix has three setgid binaries, postdrop, postlog, and postqueue. He said that there is some work upstream to create a "postdmux" systemd service that would eliminate the need for these binaries to be setgid, but it's unclear when that will land.

Kukuk said that the SELinux policies have been adjusted for running with NoNewPrivileges=yes in most cases, but policies for run0 are still incomplete. For example, he said that it is not currently possible to use run0 with chown, passwd, or local scripts if SELinux is enabled. He noted that he is now running with NoNewPrivileges=yes enabled on all of his openSUSE Tumbleweed and MicroOS systems, with the exception of his Pi-hole DNS server.

Questions

One member of the audience asked if the account-utils work integrated properly with KDE's user-management module, which is part of its system settings. Kukuk said that KDE is using the PAM interface, "and it does not know what the module under the hood is doing, and doesn't care". He said that it should be completely transparent with no behavioral difference between his PAM module and the original.

Another person wanted to know what the plan was for openSUSE Tumbleweed, and if account-utils would be enabled by default. Kukuk said that MicroOS was already using account-utils for new installations. Since Tumbleweed is a rolling-release distribution, it is a bit trickier. He said there were discussions with maintainers to fix or work around weird problems, such as dependency conflicts and obsolete packages when using RPM. His plan is to make it the default for new Tumbleweed installations.

SUSE and openSUSE have only recently switched from using AppArmor as the default mandatory-access control (MAC) system to using SELinux instead. The last question was whether Kukuk had tried his NoNewPrivileges experiment with AppArmor instead of SELinux. Kukuk said that he had been told that AppArmor had "big problems" with NoNewPrivileges, but that he had no experience with it. He said that he thought Canonical had "the most skilled" AppArmor developers, and might be the best positioned to look into it. "All of our security experts are SELinux experts, so I don't even have the knowledge somewhere in house" to look at it. With that, there were no more questions and the session ended.

Comments (14 posted)

Discussing a rewrite of XArray

By Daroc Alden
October 20, 2026

Kangrejos

The work to support block sizes larger than the page size on XFS has been difficult. Many users of XFS run stable kernels, which means that they aren't testing new XFS code as it is released. That has made Daniel Gomez wonder whether adopting Rust for some of the data structures underlying XFS, particularly XArrays, could reduce the number of bugs lurking in the code. At Kangrejos 2026, he led a discussion about the potential problems with converting XArray to Rust. The assembled kernel developers had a number of reasons to be cautious about replacing the XArray code, but Gomez was determined to experiment with the possibility, citing both security and performance improvements.

XFS added support for large folios in December 2021, Gomez said, as part of the general effort across the kernel to move to folios. In June 2023, some users of XFS reported filesystem corruption: pages from some files ended up mixed into other files. The cause turned out to be a bug introduced with the addition of folio support. This bug was present in the kernel for years, Gomez emphasized, and nobody saw it, possibly because users were relying on stable kernels.

Ultimately, the XFS developers had to revert folio support while they attempted to find the underlying cause. This posed a problem because the work to enable larger block sizes on XFS depends on the conversion to folios, so it had to go on hold. Eventually, the maintainers were able to trace the problem to a misuse of the XArray API; the code was performing tree operations without a lock. Refactoring to change how the XFS code used locks fixed the problem. But it made Gomez wonder whether a Rust implementation could have prevented the bug from being committed in the first place.

XArray background

An XArray is a radix tree pretending to be an array, Gomez said. XArrays are used all over the kernel. Although the kernel has supported radix trees for some time, there were a number of different subsystems using custom ad-hoc datastructures in addition. Eventually, Matthew Wilcox took on the task of consolidating them on a single implementation. Most of those users only needed an expandable array, so that is the basic interface that XArrays present. For those cases that needed more detailed control of the underlying tree, there is also an advanced XArray interface that exposes more operations.

[Daniel Gomez]

The simple API, which uses functions called xa_*(), handles locking automatically. Reading from an XArray with this API uses read-copy-update (RCU), and writes go through an internal spinlock. The advanced API, which is named xas_*(), leaves locking up to the user. Gomez described using it as "kind of like [having] a cursor inside the tree, pointing at a given index" that could then be moved around and operated on. The advanced API is mainly used by the page cache, he said, although some filesystems, including XFS, also use it.

Kent Overstreet opined that a radix tree was the wrong data structure for this use case. A maple tree (which is a kind of B-tree optimized for in-memory use) would be more appropriate, Overstreet said. Gomez said that the page cache maintainers had talked about replacing the use of XArray with a maple tree, but had not yet managed it. He also pointed out that XArrays have a lot of features that the kernel's implementation of maple trees does not, and he was unsure if those features could be ported.

The widespread use of XArrays also complicates any porting attempt. There are 351 users across the kernel, with 126 different maintainer entries covering one or more XArrays, Gomez said. There have already been three CVEs in 2026 caused by misuse of XArrays, he continued, and presumably other non-security-related bugs.

Preventing bugs

The argument for moving away from XArray is to prevent bugs, he said. Rust code, even when it uses unsafe code internally, can provide safe interfaces that cannot be misused from safe Rust code. With so many users of XArrays across the kernel, some of them are probably misusing the XArray interface, and it's hard to tell. People say that the XArray implementation is battle tested, and any new implementation would need huge amounts of testing to catch up, Gomez said. He doesn't buy that, though, because when there are bugs involving XArray, it can take years for anyone to notice, even when the bugs are serious.

So, he and his colleagues have started working on a Rust implementation of XArray, just to see if it could remove the bugs that they had observed when using the C version. They have some promising results, but before putting more time in it, Gomez wanted to ask whether it was even possible to rewrite a core piece of the kernel in Rust. So far, Rust has been adopted at the edges of the kernel — in drivers, and in the Rust code necessary to support them. Porting XArray to Rust would be a large change.

Miguel Ojeda said that if there were Rust users for XArrays, then adding a Rust implementation of XArray was easy to justify. The Rust for Linux project already has permission to duplicate some pieces of the kernel in Rust when necessary to present a safe Rust API to drivers and other Rust components. Providing a C API for C callers is trickier, he said. Normally, Greg Kroah-Hartman will not accept code of that sort. Individual maintainers can bypass that rule within their subsystems, but they would need to be thoroughly convinced to do so. Practically, Rust reimplementations of core features may need to wait for Rust to be supported on every architecture that the kernel supports, Ojeda said.

That is not to say that the work lacks value, he continued. He offered a collection of quotes from core kernel maintainers about the long-term plans for Rust in the kernel to anyone who needed something to show their managers in order to justify work on Rust abstractions.

Daniel Almieda noted that the plan for the job queue in the Tyr driver is to use the C version of XArray; if Gomez did add a Rust implementation, Tyr could be the first Rust user. Gomez thought that was helpful, but he was personally more concerned with discovering and preventing existing bugs, like the one in XFS. Almieda said that Tyr will also expose a C API for the job queue, so the two of them should work together on how to handle that, which Gomez agreed with.

Alistair Francis asked why Gomez thought that rewriting XArray in Rust would help with problems caused by misusing the interface, given that the C code calling into it could still misuse it. Gomez thought that having an API that explicitly documented each of the requirements to safely use it in the types of the involved functions would be helpful, even for C users.

Gomez had proposed to talk about this topic at the Linux Storage, Filesystem, Memory Management, and BPF Summit in May 2026; during the discussion of his proposal he'd gotten a few responses. Wilcox had told him that thinking about rewriting XArray was premature because of the state of Rust's architecture support. Andreas Hindborg had said it was worth experimenting to see whether Rust would help in his case. Ultimately, Gomez decided to go ahead with the experiment, at least far enough to see what the sticking points would be.

Implementation problems

The first problem that the attempt ran into was how XArray uses pointer tagging in each of the slots in its tree nodes. Gomez had hoped that the Rust compiler would be able to perform that optimization automatically, but it wasn't, so he had to implement it by hand. That optimization, which was discussed in the previous session, is something that the Rust project is working on.

Another problem was with tail-call optimization. A naive porting of the C code was noticeably slower, because LLVM was not able to turn recursive calls to tree-handling code into loops. The problem was that the Rust code automatically inserted calls to Drop::drop() where the C code had none, which prevented the recursive calls from being tail calls. Gomez was able to restructure the code to work around that, but a #[must_tail] attribute would have made his job easier.

Finally, there is the problem of allowing XArrays with different node sizes. The Rust code could use const generics to express this, but const generics are an unstable feature. Benno Lossin suggested a workaround involving a macro to generate the different node sizes; there's nothing wrong with that, Gomez said, but he would prefer to use const generics once that is possible.

Once those problems were dealt with, the Rust version of the code did work. While there are existing benchmarks for kernel features that use XArrays, Gomez didn't think that they would give the best results for comparing the two implementations, so he wrote his own data-structure-focused benchmark. He thinks that adapting that code to be a general data-structure-benchmarking library for the kernel could be useful.

Currently, his Rust code is "a bit faster" than the C implementation, although not all of the more obscure XArray features are implemented, so he doesn't want to definitively say that the Rust implementation is faster yet. More importantly, the interface is much safer: it uses a few tricks to verify at run time that it is being used correctly. At that point, he opened the floor to discussion: does the potential benefit of this approach outweigh all of the reasons not to rewrite XArrays?

Discussion

Josh Triplett thought that, while Gomez could try to argue that the Rust code could be better for security, he would get less pushback if he instead focused on performance. "If you can show that it's 50-70% faster, it's really hard to argue with that," he said. Overstreet asked whether Rust was taking advantage of LLVM's noalias attribute; since Rust has more information about when references alias, it can potentially pass that information to LLVM to produce better code for the same overall algorithm. Ojeda said that Rust code does emit noalias attributes, but he wasn't sure how much LLVM was taking advantage of that. Simple cases produce better code generation, but more complex code is hard to assess.

Gary Guo thought that aliasing information did not benefit Rust kernel code because many types are marked as using an UnsafeCell for C interoperability, which disables many of Rust's aliasing guarantees. So, the only benefit from the attribute will be for types that never cross the boundary between the two languages. Ojeda agreed, saying that was another reason that the Rust for Linux project had focused on adding Rust support at the edges of the kernel first, since that makes the Rust code more self-contained.

Hindborg suggested that some of the overhead could be eliminated by imposing safety requirements on C callers. It should be possible to generate a checklist of items to check when interacting with a Rust type from C. If those were automatically included in the documentation and checked by the C programmers at each call site, the Rust code could drop some of its defensive programming. The C callers would still be able to violate Rust's safety properties, but C programmers already have to be careful about reading the documentation of the functions that they use, and at least this way it would be documented.

The existing XArray documentation for the C implementation does not include information on the requirements to use the API safely, Hindborg continued. That may contribute to why there are misuses of its API.

There were no more forthcoming comments, so Gomez spoke briefly about his plans for the future. The core functionality of the Rust XArray code is solid, but there is more work to be done on making it take less memory. Right now, the tree only expands and never shrinks. That needs to be fixed. The code also needs to add the entry, preloading, and RCU APIs. The last item, in particular, will benefit from Lossin's work on field projections.

Since the conference, Gomez has shared his patch set (having it reviewed by Wilcox) and asked for it to be included in the 7.4 kernel. The current work is incomplete, and users of XArray should probably not switch over yet, but the code is available to test and examine.

[ Thanks to the Linux Foundation, LWN's travel sponsor, for assistance in getting to Kangrejos. ]

Comments (16 posted)

Cross-crate forward declarations in Rust

By Daroc Alden
October 19, 2026

Kangrejos

Rust has several ad-hoc mechanisms to allow user code to influence how the standard library executes. For example, custom panic handlers and custom allocators both involve registering functions that core standard library code needs to call. With more similar features planned, Jana Dönszelmann spotted the developing pattern and put together a general solution, introducing a safer, checked analogue of C's weak symbol linking. At Kangrejos 2026, she explained how this new language feature works, and proposed using it to clean up the kernel's handling of integer overflows in Rust code.

[Jana Dönszelmann]

Dönszelmann has been a full-time contributor to the Rust compiler for the past two years, and has recently been occupied with work on the new trait solver. In between working on the trait solver, she has prototyped a new compiler flag, -Coverflow-checks=report that is likely to be useful to the kernel. Currently, when an integer overflow occurs in Rust code, the developer has a choice between a panic, or silently wrapping the overflowed value. There are library methods to perform checked mathematical operations that can return an error, as well, but many overflows occur in code that uses the normal mathematical operators.

In the kernel, panic-on-overflow in Rust code is enabled in both debug and release builds. By introducing that rule early, the Rust for Linux developers hoped to keep overflows out of the Rust code entirely, but that decision has caused some friction with the rest of the kernel. Linus Torvalds, in particular, is of the opinion that unexpected integer overflows should not crash the entire kernel.

Theoretically, this behavior could be configured using a custom panic handler. The kernel already defines one, since the default user-space implementation does not make sense in the kernel. The problem is that, currently, Rust defines the panic handler to be a function that never returns. That assumption is woven deeply enough into the language that providing a custom panic handler that calls WARN() and continues is simply not feasible.

Forward declarations

Custom panic handlers are also an example of a weird corner in the language, Dönszelmann said, because the core library already needs to know how to panic. Therefore, it forward-declares that there exists some panic handler, and leaves it up to subsequent crates to define the panic handler. That is normal in C, but wildly atypical in Rust, which ordinarily relies on order-independent name resolution within a single crate to address problems that C would solve with forward declarations. As a result, the standard library has only three cases of forward declaration: panic handling, custom allocators, and debugging logging. They're all handled as special cases.

Dönszelmann has been hoping to replace those mechanisms with a proper language feature that lets Rust programs deal with cross-crate forward references safely. That will only be useful for a small handful of libraries, but it will prevent them from relying on custom link-time logic. It would also make it relatively painless to add a separate function that permits reporting and continuing when an error occurs.

The language feature is currently using the name "externally implementable items", but Dönszelmann called this a temporary name that could be replaced when the feature was stabilized. The feature is available in nightly versions of the Rust compiler. One indicates an externally implementable item by adding an #[eii] annotation to the function signature. If the crate defines a function body, it is used as a fallback implementation, should no other crate define the item. If another crate does define the function, the body is ignored. If two crates attempt to define the function, or if there is no fallback implementation and no other definition, it results in a compiler error. That condition is checked by the compiler for safety, but actually implemented using weak linking, so that crates can still have their code generated in parallel.

With that infrastructure present in the language, Dönszelmann's prototype adds a new externally implementable item called report_integer_overflow() which is called automatically when integer overflow occurs, as long as the new compiler flag that she added is enabled. It is a normal function, and can return to the calling code, so the compiler will not treat subsequent code as being dead. The default implementation simply calls into the existing panic handler, so a program will need to both build with -Coverflow-checks=report and define its own handler in order to benefit from the new behavior.

Dönszelmann thought that was pretty much what the kernel needed, but acknowledged that she was a compiler developer, not a kernel developer, and said she wanted to hear what the assembled kernel people thought about the feature before she actually proposed the prototype for inclusion in the language. Externally implementable items are implemented in the compiler today, but with limited target support. Windows makes it difficult to use weak linking correctly, so externally implemented items are currently limited to Unix-like platforms. It will not be difficult to stabilize the new overflow-checking mode if the design is agreed on, she predicted, because the code is quite simple.

Discussion

Miguel Ojeda thought that it was worth adding the new compiler flag for use in the kernel. Gary Guo asked whether externally implementable items could be inlined. They aren't currently inlined, Dönszelmann said, but they could be in principle. Guo was glad to hear that, since he had been concerned about the performance impact of using externally implementable items generally, but agreed when Ojeda pointed out that the kernel probably doesn't care if the call to WARN() is cold.

Alice Ryhl expressed worry over the use of weak linking. She has seen cases where one symbol is overridden by another symbol, and that causes problems. Greg Kroah-Hartman said that weak symbols were common across the kernel, and didn't think that an additional use here would be a problem. Dönszelmann clarified that, while plain weak linking could have conflicting symbol implementations, since the Rust compiler can see the entire graph of crates being compiled, it can ensure that there is at most one definition for a given symbol.

Andreas Hindborg said that he had a benchmark for block-layer Rust code, and offered to try out Dönszelmann's code on it, to see whether the added return paths from the overflow-reporting function caused any performance regressions. Dönszelmann was happy for people to try the feature, but did not think it would have any performance impact compared to the existing panic-handler implementation. Nadrieril asked whether externally implementable items supported dynamic linking. Dönszelmann called that a "trick question", pointing out that with dynamic linking, it is no longer clear how to ensure that a single implementation exists across the whole program. She called that more of a philosophical problem than a technical one — if people want to define what the expected behavior is, it's probably possible to implement.

Guo and Ryhl suggested some alternate ways the feature could be implemented without weak linking; Dönszelmann pointed out that most of these approaches would not work for programs that attempt to take the address of a static item. Ojeda thought that the approach Dönszelmann had presented would be preferable to simply accepting overflow silently, which Torvalds might otherwise push for. So he was in favor of trying the change. Josh Triplett suggested that perhaps the correct choice would be to stop the current kernel thread, instead of crashing the whole kernel. At that point the session was out of time, but in discussions afterward Guo pointed out that having a kernel thread die in Rust code is actually unsound, because the thread's stack is freed and not leaked. Triplett thought that sounded fixable, but agreed that it made sense to avoid crashing the thread until that was dealt with.

[ Thanks to the Linux Foundation, LWN's travel sponsor, for assistance in traveling to Kangrejos. ]

Comments (14 posted)

Development statistics for the 7.3 kernel

By Jonathan Corbet
October 19, 2026
Linus Torvalds released the 7.3 kernel, at the end of the usual nine-week development cycle, on October 18. This cycle, abundantly fueled by LLM-assisted contributions, broke just about every record imaginable. As usual, we have compiled some statistics showing how this release, which is expected to be the next long-term-support (LTS) kernel, came together. Also included is an attempt to determine whether automated patch review is actually reducing the number of bugs introduced into the kernel.

This development cycle was the first in the project's history to exceed 20,000 commits overall, 18,765 of those were non-merge commits. These commits added nearly 920,000 lines of code while removing just over 270,000, for a net growth of about 650,000 lines; that is a lot of new code to absorb. This code was contributed by 3,021 developers, smashing through the short-lived record of 2,652 set by the 7.2 cycle. To give a sense for what is happening with contributor counts, here is a plot of contributors per release over the entire git history:

[Plot: developers per
  release]

The most active developers this time around were:

Most active 7.3 developers
By changesets
Christian Brauner 2161.2%
Bui Duc Phuc 2061.1%
Pengpeng Hou 1650.9%
Sean Christopherson 1610.9%
Pan Chuang 1500.8%
Tejun Heo 1420.8%
Maxime Ripard 1340.7%
Krzysztof Kozlowski 1310.7%
SJ Park 1230.7%
Alex Hung 1220.7%
Namjae Jeon 1200.6%
Uwe Kleine-König 1150.6%
Alex Deucher 1110.6%
Takashi Iwai 1040.6%
Breno Leitao 990.5%
Rosen Penev 960.5%
Imre Deak 950.5%
Kumar Kartikeya Dwivedi 910.5%
Lorenzo Stoakes890.5%
Thomas Weißschuh 850.5%
By changed lines
Aurabindo Pillai 12646412.5%
Alex Hung 400824.0%
Jeff Chen 358273.5%
Dongdong Hao 170461.7%
Christian Brauner 148731.5%
Lachlan Hodges 139491.4%
Dimitri Sivanich 135801.3%
Tejun Heo 120131.2%
Mickaël Salaün 100811.0%
Eric Biggers 93490.9%
Ching-Te Ku 85760.8%
Bhawanpreet Lakha 82990.8%
Sean Christopherson 81080.8%
Ce Sun 74920.7%
Mikhail Kshevetskiy 73470.7%
David Christensen 70510.7%
Chun-Tse Shao 64110.6%
Taniya Das 63990.6%
Kumar Kartikeya Dwivedi 63770.6%
Ian Rogers 63060.6%

The biggest contributor of non-merge changesets this time around was Christian Brauner [KSDB], who made significant improvements to the binfmt_misc subsystem and contributed fixes throughout the virtual filesystem layer. Bui Duc Phuc [KSDB], a contributor who was first seen in the 7.1 development cycle, was a close second with work that focused mostly on fixes within the sound-driver subsystem. Pengpeng Hou [KSDB], first seen in 7.0, made fixes throughout the driver subsystem. Sean Christopherson [KSDB] worked extensively with the KVM hypervisor. Pan Chuang [KSDB], who had three commits in the kernel (starting with 6.17) until now, contributed a pile of driver-subsystem cleanups.

In the lines-changed column, Aurabindo Pillai [KSDB] contributed five commits containing, inevitably, a large set of machine-generated amdgpu register definitions. Alex Hung [KSDB] added numerous AMD graphics tests. Jeff Chen [KSDB] contributed three commits, one of which was a driver for NXP IW61x WiFi interfaces. Dongdong Hao [KSDB] added the leapraid SCSI driver and associated documentation.

The 7.2 development statistics included a note that the percentage of commits containing Reviewed-by tags had been dropping for a few development cycles; that trend has reversed in 7.3, where 1,399 commits (7.5%) had Tested-by tags and 9,545 (50.9%) had Reviewed-by tags. The top testers and reviewers were:

Test and review credits in 7.3
Tested-by
Dan Wheeler 26116.5%
Luca Ceresoli 855.4%
Mykola Marzhan 291.8%
Tommaso Merciai 241.5%
Victor Nogueira 201.3%
Michael Kelley 191.2%
Mostafa Saleh 191.2%
Deborah Brouwer 191.2%
Wolfram Sang 181.1%
Nathan Chancellor 181.1%
Randy Dunlap 181.1%
Charlie Jenkins 161.0%
Heiko Stuebner 150.9%
K Prateek Nayak 140.9%
Samuel Salin 140.9%
Reviewed-by
Konrad Dybcio 4743.7%
Dmitry Baryshkov 3052.4%
Christoph Hellwig 2461.9%
Andy Shevchenko 2061.6%
Frank Li 1981.6%
Krzysztof Kozlowski 1931.5%
Simon Horman 1701.3%
Ilpo Järvinen 1641.3%
Luca Ceresoli 1391.1%
Thomas Zimmermann 1231.0%
Andrea Righi 1170.9%
Bhawanpreet Lakha 1110.9%
Hannes Reinecke 1060.8%
Linus Walleij 1050.8%
Cezary Rojewski 1000.8%

Dan Wheeler [KSDB] remains the most prolific tester, trying out about four changes to the AMD graphics drivers every day of this 63-day development cycle; nobody else comes close. Meanwhile, Konrad Dybcio [KSDB] somehow managed to review 474 Qualcomm driver and devicetree changes — over seven per day. Dmitry Baryshkov [KSDB] (nearly five per day) and Christoph Hellwig [KSDB] (just under four per day) were slackers by comparison.

It is also worth taking a quick look at the Reported-by tags in this release. These tags appeared in 1,411 commits, or 7.5% of the total, and the numbers look like this:

Top bug reporters for 7.3
Sashiko 30419.4%
Syzbot23915.3%
kernel test robot 895.7%
Vega 835.3%
Nicholas Carlini 412.6%
Konrad Dybcio 301.9%
Xiang Mei 201.3%
Dan Carpenter 171.1%
Chris Mason 140.9%
TencentOS Corvus AI 130.8%
Yuhao Jiang 130.8%
Weiming Shi 110.7%
Martin Hodo 110.7%
Mark Brown 90.6%
autonomouscodesecurity@microsoft.com90.6%

The Sashiko review tool [KSDB], which did not exist one year ago, is now responsible for nearly 20% of the Reported-by tags in this release. Overall, automated systems are the source of nearly half of the credited bug reports.

See this KSDB page for more information on the use of all of these tags in the 7.3 kernel.

Work on 7.3 was supported by 232 employers that we were able to identify; the most active of those were:

Most active 7.3 employers
By changesets
(Unknown)385120.5%
AMD11866.3%
Intel11796.3%
Google11386.1%
Qualcomm11155.9%
Red Hat8374.5%
(None)6793.6%
Kylinsoft6243.3%
Meta5242.8%
IBM4722.5%
NVIDIA4002.1%
SUSE3631.9%
(Consultant)3031.6%
Oracle2711.4%
(Academia)2681.4%
Renesas Electronics2401.3%
NXP Semiconductors2371.3%
Arm2341.2%
Amutable2161.2%
Huawei Technologies1740.9%
By lines changed
AMD22517322.3%
(Unknown)14438714.3%
Qualcomm617716.1%
Google569775.6%
NXP Semiconductors455064.5%
Intel447744.4%
Red Hat384203.8%
(None)320753.2%
Meta277682.7%
IBM204412.0%
NVIDIA167371.7%
Realtek157311.6%
Amutable148731.5%
Morse Micro139491.4%
HP Enterprise136981.4%
Renesas Electronics117561.2%
(Consultant)114051.1%
Cloudflare100701.0%
Collabora84050.8%
Samsung83990.8%

The continuing flood of new developers is behind the inexorable growth in the "unknown" category; the bulk of them probably are working on their own time, but there is no easy way to know for sure. An interesting trend to note is the increase in contributions from Kylinsoft, which develops the Chinese Kylin OS distribution. There are 92 developers affiliated with this company who contributed to 7.3, most of whom contributed only a handful of commits. As a group, they appear to be working through lists of LLM-identified bugs.

First-time developers and young bugs

Quite a few of the above-mentioned Kylinsoft employees made their first kernel contributions in the 7.3 cycle. All told, there were 807 new developers seen this time around, continuing the trend we have been seeing over the course of 2026:

[First-time developers by
release]

Well over a quarter of the developers contributing to 7.3 were people who had never been seen in the community before. The growth trend in new contributors clearly cannot continue forever; maintainers are already losing their ability to keep up with this flood. But it also shows no signs of slowing down.

These new contributors are making changes all over the kernel. Many of them are trivial — typo fixes and the like — but many others are significant changes to important kernel subsystems. It is clear that many of these contributors do not really understand the code they are using LLMs to modify, leading to concerns about the quality of their patches and the long-term maintainability of a kernel that is being flooded with those patches.

One claim that has been heard recently is that the advent of automated patch review has increased the quality of the incoming code, making it safer to accept more of it with less human intervention. Determining whether that is really true will take years, because it takes that long for many bugs to surface. One can try to get an early indication of which way the wind is blowing, though, by looking at the bugs that did show up early on:

[Short-term fixes, by release]

Here, the lower (blue) bar is the number of commits that included a Fixes tag indicating that the bug had been introduced in the previous release. The blue bar for 7.3, on the right-hand side, is thus the number of 7.3 commits fixing bugs that were introduced in 7.2. That value appears to be relatively stable over the recent release history, with no obvious trend. That said, bear in mind that the overall patch volume has increased with recent kernels, so a steady rate of previous-release fixes suggests a lower bug rate overall.

The upper (orange) bar is the number of fixes to commits merged during the same release cycle; these are bugs that never find their way into a released kernel. That number does appear to be falling with the most recent releases, especially when considering the increased patch volume.

Rather than trying to imagine how the change in patch volume affects these numbers, one can simply plot them as a percentage of the total number of commits in the relevant release:

[Short-term fixes, by
release, percentages]

Here, the change seems clearer. The number of short-term-buggy commits as a percentage of the total has remained roughly constant over recent years. But that percentage began to fall in 7.1, and has fallen more sharply since. Specifically, bugs that turn up and must be fixed within the same release cycle seem to be declining. That suggests that automated patch review may, indeed, be filtering out the sorts of bugs that become immediately apparent once the affected code starts seeing wider testing. Of course, another explanation could be that, while bugs are being introduced at the usual rate, they are now being found and fixed at a lower rate. Given the accelerated rate of bug-finding in general, though, that explanation seems unlikely. The real story will take years to play out, but the preliminary indications are that the quality of code going into the kernel, with regard to obvious bugs at least, might just be improving.

As the development community heads into the 7.4 merge window, there are nearly 16,000 non-merge changesets sitting in linux-next. That is significantly more than the patches that were staged for 7.3, suggesting that the records set by 7.3 will, once again, be short-lived. The nature of the kernel-development community is changing, and what we will end up with is far from clear. It is certain to be an interesting ride, though; stay tuned and we will see where it goes together.

Comments (6 posted)

Understanding Nix flakes

October 21, 2026

This article was contributed by Tyler Langlois

Nix flakes are an experimental feature of the Nix package-management tool designed to build projects in a more self-contained and reproducible way. Despite the feature's experimental status, it has become increasingly popular for open-source projects to publish flake.nix files that offer predefined development environments and build automation even when those repositories may not offer an upstream package or module for the NixOS Linux distribution. Although Nix flakes have a complicated history, and the path for stabilization is uncertain, flakes can provide useful capabilities for projects that choose to include them.

Why flakes?

The promise of flakes is to provide reliable and reproducible methods for acquiring and building software. Let's say that an open-source project is trying to provide Linux users with an easy way to set up a development environment for its software. Distributions tend to have different versions of programming languages, libraries, etc. which means that a user on Debian 13 is going to have slightly different versions of software than a user on Fedora 45. Some dependencies may not be packaged for the distributions at all. This is a headache for everyone involved.

Projects can avoid the headache by shipping a Nix flake that pins the versions of its dependencies and lets each user install the same software regardless of which distribution they are running. End users can reliably install dependencies, build projects, and run tests often just with a local (and properly configured) Nix installation and few (if any) other toolchain requirements.

Flakes are written in the Nix language and are primarily used by the Nix package manager. While NixOS can use flakes via utilities like nixos-rebuild, flakes function independently from NixOS. flake.nix files are at the core of how flakes work: these files contain inputs that are defined as URL-like remote resources (typically software repositories) and outputs that flake consumers can use, like packages or tests for those packages.

A simple flake might look like the following snippet of Nix code:

    {
      inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
      };
    
      outputs = { nixpkgs, ... }: {
        packages.x86_64-linux.hello =
          nixpkgs.legacyPackages.x86_64-linux.hello;
      };
    }

The legacyPackages name is a bit deceptive because its Nix packages are not literally legacy packages: the name is a compatibility shim to avoid a situation in which a command such as nix flake show might list more than 100,000 packages in the terminal. When legacyPackages is used, instead of packages, the nix command will avoid listing all packages when printing its values, as documented upstream.

Upon adding the input called nixpkgs to the flake.nix file, nix flake lock will create a flake.lock file that pins the nixpkgs input against the NixOS/nixpkgs repository at the commit referenced by the nixpkgs-unstable branch. Like a Cargo.lock file in a Rust project or a Gemfile.lock file in a Ruby project, the flake.lock JSON file anchors each input to a concrete upstream revision. Doing so permits the flake to consistently refer to its dependencies and reliably build its outputs with a known-compatible set of inputs.

Locking a flake's inputs against the latest commit for a branch is one way to express an upstream reference, but the flake reference format permits a few additional strategies including a specific tag or other forms like absolute paths. A locked revision remains part of the repository and can be updated later with the nix flake update command (if the reference refers to a non-specific target like a branch name rather than a Git hash).

The outputs attribute of a flake is written as a Nix function. When Nix processes a flake.nix file, the inputs are fetched and passed to the outputs function where it can actually use the concrete values from inputs like nixpkgs. In this case, the flake will simply provide the hello package drawn from the nixpkgs-unstable branch.

By default, Nix assumes that each reference under inputs itself contains its own flake.nix and, therefore, its own set of outputs. These are the values that are used as each input is referenced in the outputs function (like nixpkgs.legacyPackages in the example code).

This example illustrates bundling a package into a Nix flake, but there are more top-level attributes that offer other uses when present in a flake's outputs. For example, devShells provides development environments pre-populated with libraries and environment variables, while nixosModules may be imported into a NixOS configuration for use in one's NixOS configuration. The nix command-line tool recognizes many attributes as part of a flake's schema, although the structure of a flake's outputs outside these conventional names is arbitrary.

Locked inputs are one important trait of flakes, but another behavior that is arguably just as important is that flakes are evaluated in pure evaluation mode, which means that external factors that may change the values that Nix computes are forbidden by default. For example, environment variables may not be read and network access is gated by checking downloaded artifacts with checksums. Although this behavior can be relaxed with the --impure flag, enforcing it adds to the reproducible quality of a flake.

It should be noted that some features of Nix flakes are also addressed by other libraries or tooling. For example, locked dependencies (akin to a Nix flake input) can be achieved without the use of flakes with niv, a project that provides capabilities similar to a flake.lock file. Development shells are supported by existing, non-experimental commands with shell.nix files. For many users, Nix flakes serve as a more general, unifying umbrella for useful concepts like inputs, lock files, and Nix commands.

Flakes in the wild

How does one use flake.nix when encountering these files in a source code repository? First, the nix utility must be installed and Nix flakes enabled before use: each nix command must include the --experimental-features 'nix-command flakes' command-line option or the stanza experimental-features = nix-command flakes must be set in $HOME/.config/nix/nix.conf or /etc/nix/nix.conf per the Nix flakes setup documentation.

Most nix operations that interact with flakes can do so via either a local checkout of a repository or with a flake reference (which can be any of the URL-like formats accepted under a flake's inputs attribute). The following command, for example, displays all the outputs available from the Ghostty repository for the Ghostty terminal emulator:

    nix flake show github:ghostty-org/ghostty

In this example, the github:ghostty-org/ghostty flake reference is internally expanded into an upstream GitHub URL that fetches tarballs rather than cloning entire repositories. The following output from the nix flake show command has been trimmed down for readability:

    github:ghostty-org/ghostty/<hash-value>... 
    ├───packages
    │   └───x86_64-linux
    │       └───ghostty: package 'ghostty-1.3.2-dev+3c1ef5b-nix'
    ├───devShells
    │   └───...
    ├───checks
    └───...

In addition to the ghostty package for the x86_64-linux architecture, there are other outputs like checks that define tests that may be run directly against the flake with commands like nix flake check.

The devShells output is particularly useful. As a Zig-based project, Ghostty requires a compatible language toolchain for contributors to build and test the project. Manually installing zig is one option, but using the Nix flake development shell can make the process easier. Entering the development shell is done with the develop subcommand:

    nix develop github:ghostty-org/ghostty

After nix starts a shell with the environment populated from the flake.nix file, the zig command is available:

    $ zig version
    0.16.0

This installation of zig is scoped only to Ghostty's development shell and is not installed system-wide (zig and its supporting libraries are installed into the Nix store). In addition to zig, all of the other dependencies relevant for development are added to the $PATH and necessary libraries are included as well. When part of a repository, flake.lock files ensure that downstream users of nix develop will end up with the same versions of all utilities and libraries as the original Nix flake author. Because the development shell is constructed from separate and distinct paths in the Nix store, multiple versions of the same toolchain can coexist on the same host without executables or shared libraries colliding.

The same principles apply for any repository that provides a flake.nix, whether the project relies on C++, Rust, or any other language. The --command flag lets a command run within an indicated development shell non-interactively. Niri and pandoc are just a few of the many projects that provide flake.nix files and development shells that bundle each of their respective build environments:

    $ nix develop github:niri-wm/niri --command rustc --version
    rustc 1.97.0 (2d8144b78 2026-07-07) (built from a source tarball)
    $ nix develop github:jgm/pandoc --command ghc --version
    The Glorious Glasgow Haskell Compilation System, version 9.10.3

In each of these cases, none of the cited toolchains were present beforehand on the host system. Each command and its associated libraries necessary for project compilation are provided entirely through the Nix flake development shell.

A tumultuous history

Shipping around locked dependencies and development shells are useful capabilities, so why do flakes remain an experimental feature gated behind additional configuration steps?

Flakes were first introduced in July 2019 in NixOS RFC 49 by Eelco Dolstra, the original author of Nix. Throughout the year-long RFC process, development of the underlying plumbing for what would ultimately become Nix flakes continued in the Nix GitHub repository. After a period of extended discussion, the proposal PR was closed and the RFC withdrawn in July 2020 because of a failure to reach consensus for adoption. Concerns about scope, design, and other considerations remain visible in the (large) discussion thread attached to RFC 49 that eventually led to its closure.

Since RFC 49 failed to pass, flakes were included in the Nix 2.4 release in 2021 as an experimental feature. Nix flakes remained accessible only when explicitly enabled, and that requirement remains in place for the upstream Nix project. As we'll see later, this is one aspect of flake usage that has splintered across different implementations.

Adoption

In the years following the initial release, Nix flakes have been widely adopted. In the 2025 NixOS Community Survey, which drew input from nearly 3,400 Nix users, 78.9% of respondents reported using flakes. A smaller random sampling of 300 repositories, conducted by Nix maintainer Jörg Thalheim, across GitHub repositories with shell.nix or flake.nix files present found significant adoption over the traditional development shell method using shell.nix files.

Community growth around Nix flakes without a formal plan laid out by an RFC has become somewhat of a sore spot in the Nix community. Contributors eager for the features within Nix flakes are frustrated at the ongoing experimental label, while some involved in the original RFC process remain dissatisfied with the expansive scope and design of Nix flakes that has arguably escaped the limited scope intended by attaching the experimental label.

Contributor Graham Christensen wrote in 2021: "I believe Flakes are astonishingly important and will be very powerful, but the RFC experience has turned so many people against it on principle." Jade, a contributor to the Lix alternative to Nix reflected on flakes with a more hesitant tone: "Even assuming that flakes are good at macro-level composition, they often are accompanied by poor use of micro-level composition, which still is best done by using the old primitives.". Former contributor Samuel Dionne-Riel opined that Nix flakes was an experiment that did too much at once, "and it sucks because so much of it is good, or are good [but] undercooked ideas".

Despite these and other concerns, the use of flakes is widespread at this point; many third-party utilities work as expected with flakes regardless. In practice, the ways to use flakes via Nix have remained consistent in terms of their commands and configuration settings although there are no guarantees without the removal of the experimental label by maintainers.

A future for flakes?

The rift within the Nix community on the subject of flakes has become so wide that alternative implementations have cited their stance on flakes as a distinguishing characteristic. The Nix package manager (usually referred to as CppNix in reflection of its C++ code base) still marks the feature as experimental, but Lix has designated flakes as a frozen feature slated for future extraction into a plugin, while Determinate Nix (a downstream distribution of CppNix) expressly supports flakes and has marked them as a stable feature enabled by default.

As for Nix itself, RFC 136 ("A plan to stabilize the new CLI and Flakes incrementally") lays out a path forward for Nix flakes to become a stable feature. It was proposed in October 2022, and ultimately accepted in August 2023. There is a flakes stabilization milestone to track the work needed to remove the "experimental" label from flakes.

Some work heralds potential breaking changes for flakes (such as changing lock attributes), while other plans offer less-visible but significant performance improvements such as "lazy trees" (to avoid spurious file copies to the Nix store). In addition to work on the flakes feature, the design of the newer command-line interface for nix will have to be stabilized before moving on to complete the implementation of flakes and mark them as a stable feature. There will need to be an additional RFC for the final design of flakes once that happens.

The need to address command-line design stems from the fact that flake-related commands are often conflated with other Nix commands. For example, the experimental feature that provides alternative commands like nix env shell in contrast to nix-shell that often rely on flake-like semantics. As noted in the text of the RFC:

There are many criticisms about Flakes. But one of them especially relevant to stabilizing is a perception that Flakes have encroached on other new features, in the sense that it ought to be possible to use those other features without Flakes but isn't in practice. For example, there is no reason in theory that pure evaluation of Nix expressions requires Flakes.

Despite its criticisms, the RFC expresses optimism about the future of flakes:

We could, of course, just "rip off the band-aid" and stabilize everything at once. The argument for that would be that enough time has passed and the concerns of (less numerous) long-time users are not important. But we think the plan here has little downsides; we can instead make everyone happy with only some delay. If that is true, why not do that instead!

Flakes remain an experimental feature of the nix command-line utility but development continues. There is no concrete target completion date for the stabilization effort, so when (or if) flakes will finally graduate into stable status remains unclear, but with a plan in place and their adoption still growing, Nix flakes are likely to appear more often across the software landscape.

Comments (4 posted)

Page editor: Joe Brockmeier

Inside this week's LWN.net Weekly Edition

  • Briefs: eMudhra CA compromise; PHP RCEs; Node.js and musl vulnerabilities; GNOME OS; OpenBSD 8.0; Ubuntu 26.10; TAB results; Quotes; ...
  • Announcements: Newsletters, conferences, security updates, patches, and more.
Next page: Brief items>>

Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds