• David Gow's avatar
    kunit: Always print actual pointer values in asserts · 2d68df6c
    David Gow authored
    KUnit assertions and expectations will print the values being tested. If
    these are pointers (e.g., KUNIT_EXPECT_PTR_EQ(test, a, b)), these
    pointers are currently printed with the %pK format specifier, which -- to
    prevent information leaks which may compromise, e.g., ASLR -- are often
    either hashed or replaced with ____ptrval____ or similar, making debugging
    tests difficult.
    
    By replacing %pK with %px as Documentation/core-api/printk-formats.rst
    suggests, we disable this security feature for KUnit assertions and
    expectations, allowing the actual pointer values to be printed. Given
    that KUnit is not intended for use in production kernels, and the
    pointers are only printed on failing tests, this seems like a worthwhile
    tradeoff.
    Signed-off-by: default avatarDavid Gow <davidgow@google.com>
    Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    2d68df6c
assert.c 4.52 KB