Story Details

  • When eBPF pt_regs reads return garbage on the latest Linux kernels, blame Fred

    Posted: 2025-03-01 01:37:26

    A recent Linux kernel change inadvertently broke eBPF programs relying on PT_REGS_RC(regs). Intended to optimize register access for x86, this change accidentally cleared the return value register before eBPF programs using kprobe and kretprobe could access it. This resulted in eBPF tools like bpftrace and bcc showing garbage data instead of expected return values. The issue primarily affects x86 systems running kernel versions 6.5 and later and has already been fixed in 6.5.1, 6.4.12, and 6.1.38. Users of affected kernels should update to receive the fix.

    Summary of Comments ( 9 )
    https://news.ycombinator.com/item?id=43214576

    The Hacker News comments discuss the complexities and nuances of the issue presented in the article about pt_regs returning garbage in recent Linux kernels due to changes introduced by "Fred." Several commenters express sympathy for Fred, highlighting the challenging trade-offs inherent in kernel development, especially when balancing performance optimizations with backward compatibility. Some point out the difficulties of maintaining eBPF programs across kernel versions and the lack of clear documentation or warnings about these breaking changes. Others delve into the technical specifics, discussing register context, stack unwinding, and the implications for debuggers and profiling tools. The overall sentiment seems to be one of acknowledging the difficulty of the situation and the need for better communication and tooling to navigate such kernel-level changes. A few users also suggest potential workarounds and debugging strategies.