Linux Kernel & OS

Linus Torvalds removes unsafe __get_user() and __put_user() from Linux 7.4

Key Takeaway

Linus Torvalds merged a patch removing the historical __get_user() and __put_user() kernel functions, which lacked user address range validation and were slower than modern alternatives.

Summary

Linus Torvalds personally authored and merged a patch removing the __get_user() and __put_user() functions from the Linux 7.4 kernel. These functions were faster but less safe variants of get_user() and put_user() that skipped pointer validation checks. The removal completes the elimination of the interface for x86/x86_64, though some remnants remain in other architecture ports. Torvalds used Claude Code as an assistive tool for this work, describing it as a "fancy sort of Coccinelle script" for source transformations.

What replaces the removed functions

  • The removed __get_user() and __put_user() lacked user address range checks, making them insecure when misused
  • Modern replacement: scoped user access region helpers, implemented by Thomas Gleixner in commit e497310b4ffb ("uaccess: Provide scoped user access regions")
  • These helpers make correct user-space access patterns easier to write and harder to get wrong
  • x86/x86_64 cleanup is complete; ARM64 already maps the old names to the safe versions
  • Some non-trivial cases remain in other CPU architecture ports

Why it matters

The removal eliminates a longstanding footgun in kernel development where developers could accidentally choose the unsafe variant. The scoped helpers reduce boilerplate and should make user-space access code more maintainable across the kernel.

Original reference: www.phoronix.com →