Linux Eliminates the Strncpy API After Six Years of Work, 360 Patches

simonpure1 pts0 comments

Linux Finally Eliminates The strncpy API After Six Years Of Work, 360+ Patches - Phoronix

Articles & Reviews

News Archive

Forums

Premium Ad-Free<br>Contact

Popular Categories

Close

Articles & Reviews

News Archive

Forums

Premium

Contact

Categories

Computers Display Drivers Graphics Cards Linux Gaming Memory Motherboards Processors Software Storage Operating Systems Peripherals

Linux Finally Eliminates The strncpy API After Six Years Of Work, 360+ Patches

Written by Michael Larabel in Linux Kernel on 20 June 2026 at 10:22 AM EDT. 7 Comments

Linux 7.2 has finally eliminated the strncpy API from the Linux kernel. The strncpy() function for copying up to a specified number of bytes has long been deprecated and after six years of work and hundreds of patches, no more users of the strncpy interface within the Linux kernel remained that it has now been eliminated.

The strncpy function within the Linux kernel has been a "persistent source of bugs" for years due to counter-intuitive semantics and behavior around NUL termination along with performance issues due to redundant zero-filling of the destination. It took work over the last six years with around 362 commits to eliminate users of strncpy code within the kernel, but they are over the finish line for Linux 7.2.

This merge on Friday eliminated the strncpy API and the last per CPU architecture strncpy implementations.

In place of strncpy, Linux kernel code should use strscpy() for NUL terminated destinations, strscpy_pad() for NUl-terminated destinations with zero-padding, strtomem_pad() for non-NUL-terminated fixed-width fields, memcpy_and_pad() for bounded copies with explicit padding, or memcpy() for known-length memory copies.

7 Comments

Tweet

Linux 7.2 Gets Rid Of The Last Optimized MD5 Implementation<br>AF_ALG Deprecation Approved For Linux 7.2, Useless & Insecure Crypto Driver Code Removed<br>Linux 7.2 Protects Against "Stupid Or Malicious" DoS Attempts By Arming Timers In The Past<br>Linux 7.2 Slab Changes Include More Performance Optimizations<br>Initial AMDGPU HDMI 2.1 FRL Support Successfully Merged For Linux 7.2<br>Linux 7.2 Improves Anonymous/Unnamed Pipe Performance For Shell Pipelines & More

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Arch Linux Now Believes Malware Incident Under Control: More Than 1,500 Affected Packages<br>Arch Linux's AUR Sees More Than 400 Packages Compromised With Malware<br>Arch Linux AUR Hit By Another Wave Of Now More Sophisticated Malware Attack<br>Russian Spam & Profanities Are Now Plaguing The Arch Linux AUR<br>AMD Opens Pre-Orders For The Linux-Friendly Ryzen AI Halo Developer Platform<br>Linux 7.1 Released: New NTFS Driver, Intel FRED For Panther Lake, Faster Arc Graphics<br>Linux 7.2 Optimization Shows +5% IOPS For EXT4 & XFS After Moving Around Two Lines Of Code<br>Firefox 152 Now Available With JPEG-XL Support Built By Default, Modernized Settings UI

Linux Finally Eliminates The strncpy API After Six Years Of Work, 360+ Patches

Linux's ARM64 NEON Intrinsics CRC64 Code Adapted To Work On 32-bit ARM

GIMP v0.54 From 1996 With Motif Toolkit Now Flatpak'ed For Modern Linux Desktops

exFAT File-System Enjoys Better Performance On Linux 7.2 With IOmap Conversion

KDE Plasma 6.8 Making It Easier To Configure Multi-Monitor Setups

New NTFS Driver Sees Hardening & Fixes, Windows Native Symlinks With Linux 7.2

Open-Source NVIDIA NVK Vulkan Driver Now Supports DLSS

AMD-Powered Barco MXRT Graphics Cards Finally Seeing Linux Driver Support

systemd 261 Released With New systemd-sysinstall OS Installer, IMDSD & Storagectl

AMD ACP7.D/7.E/7.F Driver Added In Linux 7.2: "Substantial Design Changes" For AMD Audio

Phoronix Premium allows ad-free access to the site, multi-page articles on a single page, and other features while supporting this site's continued operations.

How NVIDIA Vera CPU Performance Compares To The Ampere Altra Max

Intel Core Ultra X7 Panther Lake Performance On Linux 7.1

Open-Source Success Achieved For Greater Transparency & Security: Running AMD openSIL + Coreboot On EPYC

Benchmarking The Performance Benefits To Ubuntu 26.10 amd64v3 Packages

RISC-V CPU Performance Up 8x In Five Years: SiFive HiFive Unmatched To SpacemiT K3

The mission at Phoronix since 2004 has centered around enriching the Linux hardware experience. In addition to supporting our site through advertisements, you can help by subscribing to Phoronix Premium. You can also contribute to Phoronix through tips/donations via PayPal or Stripe.

Contact

Michael Larabel

Support Phoronix

While Having...

linux strncpy performance years phoronix work

Related Articles