Linux Patched For Silent User-Space Data Loss Bug That's Existed Since 2023

Reported at the beginning of the month was the bug and a small C program to reproduce the issue. If the kernel is running with transparent hugepages (THP) enabled and under cgroup limits, writes that happen after a MADV_FREE call could be completely lost.

This bug isn't hypothetical but has come up in production with at least users of the Polars data analytics library finding production data loss from this kernel bug. Triggering it requires the right mix of transparent hugepage usage, MADV_FREE usage, and heavy memory reclaim pressure. This patch fixes the bug and fortunately amounts to just one line of code changed.

The patch was merged as part of this week's x86/urgent merge. It's also marked for back-porting to the currently supported stable kernel series. The bug was introduced back in July 2023 and present in kernel releases since Linux 6.6.