Skip to content

RFC kunit vs structleak

Arnd Bergmann linux-hardening linux-kselftest linux-usb lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bitfield: build kunit tests without structleak pluginlib/Makefile+1 -00 replies
2/3drivers/base: build kunit tests without structleak plugindrivers/base/test/Makefile+1 -00 replies
3/3thunderbolt: build kunit tests without structleak plugindrivers/thunderbolt/Makefile+1 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/3] kunit vs structleak

From: Arnd Bergmann <[email protected]>

I ran into a couple of problems with kunit tests taking too much stack space, sometimes dangerously so. These the the three instances that cause an increase over the warning limit of some architectures:

lib/bitfield_kunit.c:93:1: error: the frame size of 7440 bytes is larger than 2048 bytes [-Werror=frame-larger-than=] drivers/base/test/property-entry-test.c:481:1: error: the frame size of 2640 bytes is larger than 2048 bytes [-Werror=frame-larger-than=] drivers/thunderbolt/test.c:1529:1: error: the frame size of 1176 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Ideally there should be a way to rewrite the kunit infrastructure that avoids the explosion of stack data when the structleak plugin is used.

A rather drastic measure would be to use Kconfig logic to make the two options mutually exclusive. This would clearly work, but is probably not needed.

As a simpler workaround, this disables the plugin for the three files in which the excessive stack usage was observed.

Arnd

Arnd Bergmann (3):
bitfield: build kunit tests without structleak plugin drivers/base: build kunit tests without structleak plugin
thunderbolt: build kunit tests without structleak plugin

 drivers/base/test/Makefile   | 1 +
 drivers/thunderbolt/Makefile | 1 +
 lib/Makefile                 | 1 +
 3 files changed, 3 insertions(+)
Cc Kees Cook <[email protected]>
Cc Brendan Higgins <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Alan Maguire <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Vitor Massaru Iha <[email protected]>
Signature · 1 line
2.29.2