summaryrefslogtreecommitdiffstats
path: root/lib/muldi3.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2024-05-01 16:29:48 -0700
committerKees Cook <keescook@chromium.org>2024-05-01 16:35:06 -0700
commit74df22453c51392476117d7330bf02cee6e987cf (patch)
tree1fed486e0d7f8044c5a2d86b57599485981a726f /lib/muldi3.c
parenta284e43852380ab71eeb996389e01992d74a8dde (diff)
downloadlinux-stable-74df22453c51392476117d7330bf02cee6e987cf.tar.gz
linux-stable-74df22453c51392476117d7330bf02cee6e987cf.tar.bz2
linux-stable-74df22453c51392476117d7330bf02cee6e987cf.zip
kunit/fortify: Fix replaced failure path to unbreak __alloc_size
The __alloc_size annotation for kmemdup() was getting disabled under KUnit testing because the replaced fortify_panic macro implementation was using "return NULL" as a way to survive the sanity checking. But having the chance to return NULL invalidated __alloc_size, so kmemdup was not passing the __builtin_dynamic_object_size() tests any more: [23:26:18] [PASSED] fortify_test_alloc_size_kmalloc_const [23:26:19] # fortify_test_alloc_size_kmalloc_dynamic: EXPECTATION FAILED at lib/fortify_kunit.c:265 [23:26:19] Expected __builtin_dynamic_object_size(p, 1) == expected, but [23:26:19] __builtin_dynamic_object_size(p, 1) == -1 (0xffffffffffffffff) [23:26:19] expected == 11 (0xb) [23:26:19] __alloc_size() not working with __bdos on kmemdup("hello there", len, gfp) [23:26:19] [FAILED] fortify_test_alloc_size_kmalloc_dynamic Normal builds were not affected: __alloc_size continued to work there. Use a zero-sized allocation instead, which allows __alloc_size to behave. Fixes: 4ce615e798a7 ("fortify: Provide KUnit counters for failure testing") Fixes: fa4a3f86d498 ("fortify: Add KUnit tests for runtime overflows") Link: https://lore.kernel.org/r/20240501232937.work.532-kees@kernel.org Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'lib/muldi3.c')
0 files changed, 0 insertions, 0 deletions