Linux Changes Pipe Behavior After Breaking Problematic Android Apps On Recent Kernels

Written by Michael Larabel in Linux Kernel on 31 July 2021 at 12:10 PM EDT. 52 Comments
LINUX KERNEL
At the end of 2019 a rework to the Linux kernel's pipe code saw some of its logic reworked to only wake up readers if needed and avoid a possible thundering herd problem. But it turns out some Android libraries abused the functionality and this has led to broken Android applications when moving to recent kernels. While the user-space software is in the wrong, the kernel is sticking to its policy of not breaking user-space and as such Linus Torvalds has changed the code's behavior for Linux 5.14 and to be back-ported to prior stable kernels.

Rather than only waking up readers if needed, the change merged into the Linux kernel on Friday will make pipe writes always wake up readers. Due to some Android libraries like Realm misusing the EPOLL interface, the pipe change at the end of 2019 ended up breaking some Android apps.

This has broken "numerous Android applications" since Linux 5.5, but given the long period of times between kernel versions shipped by Android, it only has become a problem recently with Android transitioning to Linux 5.10 LTS. Realm's behavior has since been addressed but will take some period of time before all applications leveraging the library (and any other problematic libraries out there) are updated and re-built, thus for now broken Android applications are still out there.

While user-space was misusing an interface and that led to "all applications using this library stopped working", the Linux kernel carries a policy that if applications break from new kernel behavior/changes, it's a regression. Thus on Friday Linus Torvalds authored and merged this change to always make writes wake-up readers even if extraneous in order to better jive with the old behavior.

See this commit for those interested in all the technical details on the issue and resolution.
Related News
About The Author
Michael Larabel

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.

Popular News This Week