• Kees Cook's avatar
    bug: Provide toggle for BUG on data corruption · de54ebbe
    Kees Cook authored
    The kernel checks for cases of data structure corruption under some
    CONFIGs (e.g. CONFIG_DEBUG_LIST). When corruption is detected, some
    systems may want to BUG() immediately instead of letting the system run
    with known corruption.  Usually these kinds of manipulation primitives can
    be used by security flaws to gain arbitrary memory write control. This
    provides a new config CONFIG_BUG_ON_DATA_CORRUPTION and a corresponding
    macro CHECK_DATA_CORRUPTION for handling these situations. Notably, even
    if not BUGing, the kernel should not continue processing the corrupted
    structure.
    
    This is inspired by similar hardening by Syed Rameez Mustafa in MSM
    kernels, and in PaX and Grsecurity, which is likely in response to earlier
    removal of the BUG calls in commit 924d9add ("list debugging: use
    WARN() instead of BUG()").
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
    Acked-by: default avatarRik van Riel <riel@redhat.com>
    de54ebbe
list_debug.c 1.72 KB