]> asedeno.scripts.mit.edu Git - linux.git/commit
test_overflow: Add memory allocation overflow tests
authorKees Cook <keescook@chromium.org>
Thu, 10 May 2018 23:40:03 +0000 (16:40 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 5 Jun 2018 19:16:51 +0000 (12:16 -0700)
commitca90800a91ba723d78ded634d037c1d2df8b54d6
tree5c709a41d95010d66d7a3f22607614ae117f66d2
parent610b15c50e86eb1e4b77274fabcaea29ac72d6a8
test_overflow: Add memory allocation overflow tests

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: Kees Cook <keescook@chromium.org>
lib/test_overflow.c