October 5, 2016 - Shuah Khan

Big no no to BUG_ON(), Beware of this Linux 4.8 Bug

BUG_ON() has been discouraged for debugging kernel problems for a very long time. However, there are still several BUG_ON() usages in the Linux Kernel. A late commit to Kernel 4.8 is one such case, and is now causing a lot of headaches with the release that came out on October 2nd, 2016.

This BUG_ON() is triggered when CONFIG_DEBUG_VM is enabled. Some distributions such as the standard Fedora Kernel config enable it by default. Linus Torvalds has discovered that once this BUG_ON() triggers, the machine will have problems handling kernel paging requests and report that a reboot is required to fix a recursive fault from which the machine will never recover!

Here’s his direct quote

The reason the machine *dies* from that thing is that we end up then immediately having a

and then a

and the machine will never recover.

Fixing this bug is number one priority for Linus and he asked Johannes Weiner to work on it. Measures are being taken to avoid having it end up in a stable release, but please check your kernel config to make sure CONFIG_DEBUG_VM is disabled until the bug is fixed.

Linus re-emphasized and warned to not use BUG_ON() for debugging, but rather use WARN_ON() which is a safer alternative to BUG_ON().

For more details on this problem, please follow the thread on the LKML.

Shuah Khan

About Shuah Khan

Shuah Khan is a Senior Linux Kernel Developer at Samsung's Open Source Group. She is a Linux Kernel Maintainer and Contributor who focuses on Linux Media Core and Power Management. She maintains Kernel Selftest framework. She has contributed to IOMMU, and DMA areas. In addition, she is helping with stable release kernel testing. She authored Linux Kernel Testing and Debugging paper published on the Linux Journal and writes Linux Journal kernel news articles. She has presented at several Linux conferences and Linux Kernel Developer Keynote Panels. She served on the Linux Foundation Technical Advisory Board. Prior to joining Samsung, she worked as a kernel and software developer at HP and Lucent.

Image Credits: Open Source Way

Development / Linux Bugs / Security Notice /

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Anti-Spam