• Kees Cook's avatar
    test_overflow: Add memory allocation overflow tests · ca90800a
    Kees Cook authored
    Make sure that the memory allocators are behaving as expected in the face
    of overflows of multiplied arguments or when using the array_size()-family
    helpers.
    
    Example output of new tests (with the expected __alloc_pages_slowpath
    and vmalloc warnings about refusing giant allocations removed):
    
    [   93.062076] test_overflow: kmalloc detected saturation
    [   93.062988] test_overflow: kmalloc_node detected saturation
    [   93.063818] test_overflow: kzalloc detected saturation
    [   93.064539] test_overflow: kzalloc_node detected saturation
    [   93.120386] test_overflow: kvmalloc detected saturation
    [   93.143458] test_overflow: kvmalloc_node detected saturation
    [   93.166861] test_overflow: kvzalloc detected saturation
    [   93.189924] test_overflow: kvzalloc_node detected saturation
    [   93.221671] test_overflow: vmalloc detected saturation
    [   93.246326] test_overflow: vmalloc_node detected saturation
    [   93.270260] test_overflow: vzalloc detected saturation
    [   93.293824] test_overflow: vzalloc_node detected saturation
    [   93.294597] test_overflow: devm_kmalloc detected saturation
    [   93.295383] test_overflow: devm_kzalloc detected saturation
    [   93.296217] test_overflow: all tests passed
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    ca90800a
test_overflow.c 14.4 KB