Share this article

Latest news

With KB5043178 to Release Preview Channel, Microsoft advises Windows 11 users to plug in when the battery is low

Copilot in Outlook will generate personalized themes for you to customize the app

Microsoft will raise the price of its 365 Suite to include AI capabilities

Death Stranding Director’s Cut is now Xbox X|S at a huge discount

Outlook will let users create custom account icons so they can tell their accounts apart easier

Microsoft Engineer Advances Rust integration in Linux kernel with Module initialization patches

The patches were sent on March 26, 2024

3 min. read

Published onApril 2, 2024

published onApril 2, 2024

Share this article

Read our disclosure page to find out how can you help Windows Report sustain the editorial teamRead more

Microsoft has been contributing to the Linux kernel for quite some time now, and the introduction of Rust programming language support is one of the examples.

This time, Wedson Almeida Filho, a Microsoft engineer who works closely in the Rust for Linux initiative, has revealed that patches have been sent to revolutionize module initialization within the kernel.

The latest patches, by Filho, show Microsoft’s commitment to facilitating the growth of Rust within the Linux ecosystem. These patches will refine the Allocation APIs for Rust Kernel code and introduce a new concept, i.e., in-place module initialization for Rust kernel modules

The second iteration of the RustAllocation APIsfor the Linux kernel:

We currently have a fork of the crate with changes to Vec; other changes have been upstreamed (to the Rust project). This series removes the fork and exposes all the functionality as extension traits.

Additionally, it also introduces allocation flag parameters to all functions that may result in allocations (e.g., Box::new, Arc::new, Vec::push, etc.) without the try_ prefix — the names are available because we build alloc with no_global_oom_handling.

Lastly, the series also removes our reliance on the allocator_api unstable feature.

Long term, we still want to make such functionality available in upstream Rust, but this allows us to make progress now and reduces our maintainance burden.

In summary:

Changes in v2: –

Earlier, the module initialization in the Linux kernel included returning an instance that would be moved to its designated memory space.

However, with the new patches, modules can be initialized directly in their intended memory location. This eliminates the need for unnecessary memory allocations and lets modules proficiently manage complex data structures such as locks.

Filho further said:

This allows us to have modules whose state hold objects that must be initialized in place like locks. It also allows us to implement registrations (e.g., driver registration) in place and have them similar to their C counterparts where no new allocations are needed.

This development has profound implications. By using Rust’s capabilities for in-place initialization, kernel developers can efficiently initiate modules and optimize memory usage.

In addition, this step will line up Rust-powered modules more closely with their C counterparts, which will reduce the gap between conventional and modern kernel development practices.

What was once thought of as an unusual union now seems to be the attestation of the transformative power of collaboration and innovation

What are your thoughts on the matter? Share your opinions with our readers in the comments section below.

More about the topics:Linux,microsoft

Srishti Sisodia

Windows Software Expert

Srishti Sisodia is an electronics engineer and writer with a passion for technology. She has extensive experience exploring the latest technological advancements and sharing her insights through informative blogs.

Her diverse interests bring a unique perspective to her work, and she approaches everything with commitment, enthusiasm, and a willingness to learn. That’s why she’s part of Windows Report’s Reviewers team, always willing to share the real-life experience with any software or hardware product. She’s also specialized in Azure, cloud computing, and AI.

User forum

0 messages

Sort by:LatestOldestMost Votes

Comment*

Name*

Email*

Commenting as.Not you?

Save information for future comments

Comment

Δ

Srishti Sisodia

Windows Software Expert

She is an electronics engineer and writer with a passion for technology. Srishti is specialized in Azure, cloud computing, and AI.