FR
live

Linus Torvalds removes the unsafe __get_user() and __put_user() functions from the Linux kernel, assisted by Claude Code

On October 21, 2026, Linus Torvalds merged into Linux 7.4 the removal of __get_user() and __put_user(), historical variants that do not validate the user address range and are therefore unsafe. He drafted the conversion partly with Claude Code, used “as a fancy sort of Coccinelle script”: AI is settling into kernel maintenance, including for eliminating whole classes of memory bugs.

A steel pegboard where several worn tools have been removed leaving clean empty hooks, one remaining tool tagged with a single amber cable tie.

October 21, 2026. Linus Torvalds merges into Linux 7.4 the removal of the __get_user() and __put_user() functions, which he calls historical “horrors”. October 21, 2026. These faster but unsafe variants skip user address-range validation when copying a single variable between user space and kernel space. October 21, 2026. On the mailing list he reveals he used Claude “as a fancy sort of Coccinelle script” to mechanize the conversion. Why it matters: the kernel’s creator is using AI not to write fresh code, but to eliminate a class of dangerous functions — a textbook case of what AI does best in C maintenance.

Why these functions were dangerous

get_user() and put_user() copy a simple variable — an integer, a pointer — between user space and kernel space. They are core primitives: every system call that reads or writes a value in user memory passes through them, directly or indirectly.

The double-underscore variants, __get_user() and __put_user(), were “faster” shortcuts that skipped the safety checks: no validation of the user address range. A malformed pointer forged by a malicious process could be dereferenced where it should not be. That is, by definition, an input-validation flaw in the heart of the kernel.

In the merge commit, Torvalds does not mince words: “This is long over-due,” he writes. The functions are “entirely historical”, are “never the right thing to use any more”, and “when mis-used (read: every case) they are not only slower than the right thing, but also insecure because they don’t check the user address range”. The translation fits in one line: they were both slower and less safe — the worst of both worlds.

A conversion a year in the making

The work did not come out of nowhere. Torvalds notes that most usage sites had been converted “long ago”, but that “various left-overs remained”. His starting point: a single patch written to “show people how to convert __{get,put}_user() to modern code”.

The keystone came from Thomas Gleixner, who implemented the scoped user access regions last year — bounded user-access zones, in commit e497310b4ffb (“uaccess: Provide scoped user access regions”). That mechanism makes the modern interfaces “particularly easy to use” and, in Torvalds’ words, “really removes any excuse for the old horrors”.

The difference between old and new reads in two lines:

c
/* Old, removed in Linux 7.4 — no address validation */
__get_user(val, ptr);

/* Modern — validates the user address range */
get_user(val, ptr);

The removal is now complete for x86 and x86_64, and covers all generic kernel code. Remnants remain in a few other architecture ports, either for non-trivial cases or because — as on ARM64 — the __get_user() functions already mapped to the safe versions.

For maintainers, the payoff is permanent: every remaining call site that used the unsafe variants is now forced through the validated path. The removal is not a one-time cleanup but a fence — new code can no longer reach for the unchecked variants, because they no longer exist. That is the difference between a fix, which closes one bug, and a class removal, which closes every future bug of that kind. It is also why the change lands in the Linux 7.4 merge window, where early testers can exercise it before the release is cut.

AI as a mechanical refactoring tool

The most commented angle is not the security, it is the AI. On the mailing list, Torvalds explains he used Claude as “a fancy sort of Coccinelle script”. Coccinelle is the source-to-source transformation and static-analysis tool kernel maintainers have used for years to mechanically rewrite code patterns at scale. The comparison is flattering: on this job, the AI did the work of a deterministic rewrite tool — not that of a creative code generator.

The use is part of a sequence. The week before, Torvalds had used AI to decipher bugs in the assoc_array library, then for a performance win on page-cache folio reference counting. He “continues with his recent uptick in kernel patches” written by himself, assisted in part by Claude Code.

The shift is already reshaping project governance. The kernel currently requires an Assisted-by: tag to document patches where AI contributed; since October 13, developers have been debating dropping that requirement, so routine has LLM use become in drafting and reviewing patches. The question is no longer whether AI participates in the kernel, but how to trace it.

The shift rides a broader debate about quality. On October 20, the Linux Foundation published a study estimating that roughly 25% of new open-source pull requests amount to AI-generated “slop” — low-quality code produced at scale. The contrast with Torvalds’ move is instructive: on one side, AI as a factory for lightly reviewed contributions; on the other, AI as a precise rewrite tool, supervised by the project’s most demanding maintainer. The difference is not the tool, but the human control around it.

What to take away

For an operator, nothing to patch urgently: the removal targets the in-development Linux 7.4 and does not change syscall behavior. It is a structural attack-surface reduction, not a fix for an already-exploited CVE.

The next hardening step is already visible: on October 22, developers revived the kernel-side shadow stacks effort, the hardware equivalent of a shadow stack to counter ROP attacks within the kernel itself — until now the mechanism only existed for user space. The direction is the same as for __get_user(): close off, inside the kernel, the whole classes of flaws that backward compatibility had let linger.

The signal is elsewhere. When the kernel’s creator uses an LLM to eliminate a class of dangerous functions, he validates a precise use of AI: mechanical refactoring under human control, where mistakes are costly and review stays mandatory. That is the opposite of the “generated code without review” maintainers fear — and a demonstration that AI has a place in the kernel’s gradual hardening.

Verdict

If you follow kernel development, note the direction: historical unsafe interfaces are being steadily removed, and x86 is leading. No immediate action is required — the affected stable release, Linux 7.4, is not out yet, and Linux 7.3 remains the current stable branch. If you contribute to the kernel, Torvalds’ message reads as a directive: Thomas Gleixner’s scoped user access regions have removed any excuse for keeping __get_user() and __put_user() in new code. And if you still doubt AI in critical systems, this specific case — an LLM used as a deterministic rewrite tool, reviewed by a human — is the soberest demonstration of its real value.

References

The cyber brief, every Tuesday

The flaws that matter and the patches to apply, in a ten-minute read.

No spam. One-click unsubscribe.
read next

On the same topic

Fedora 45 misses its second Go/No-Go and slips to November 3

On October 22, 2026, Fedora’s Go/No-Go meeting declared a second NO-GO: the distribution will not ship next week, held back by blockers touching the eMudhra mitigation, LVM on LUKS, and KDE Discover. Target November 3 as the new date, and read the blocker list as a lesson in release discipline.

Two CVSS 9.0 RCE flaws in KSMBD go public before any Linux kernel fix exists

On October 22, 2026, two remote code execution flaws rated CVSS 9.0 by Trend Micro’s Zero Day Initiative affect KSMBD, the SMB server built into the Linux kernel, with no fix in the mainline kernel. One triggers before any network authentication on port 445: check now whether the module is loaded on your servers.

← Back to the feed

Type at least two characters.

↑ ↓ navigate ↵ open esc dismiss