]> git.baikalelectronics.ru Git - kernel.git/commit
lkdtm/stackleak: prevent unexpected stack usage
authorMark Rutland <mark.rutland@arm.com>
Wed, 27 Apr 2022 17:31:25 +0000 (18:31 +0100)
committerKees Cook <keescook@chromium.org>
Sun, 8 May 2022 08:33:08 +0000 (01:33 -0700)
commita0753e72d4fb668a5e7ee9306bb0ef8ed1374c9b
treeab423d6a439df190bc88905c336210f424b5cc46
parent358934ce842b7b9d0b73e5d95681ba7e3934418d
lkdtm/stackleak: prevent unexpected stack usage

The lkdtm_STACKLEAK_ERASING() test is instrumentable and runs with IRQs
unmasked, so it's possible for unrelated code to clobber the task stack
and/or manipulate current->lowest_stack while the test is running,
resulting in spurious failures.

The regular stackleak erasing code is non-instrumentable and runs with
IRQs masked, preventing similar issues.

Make the body of the test non-instrumentable, and run it with IRQs
masked, avoiding such spurious failures.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Popov <alex.popov@linux.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220427173128.2603085-11-mark.rutland@arm.com
drivers/misc/lkdtm/stackleak.c