Skip to content

Commit 4130a61

Browse files
mrutland-armkees
authored andcommitted
lkdtm/stackleak: avoid spurious failure
The lkdtm_STACKLEAK_ERASING() test scans for a contiguous block of poison values between the low stack bound and the stack pointer, and fails if it does not find a sufficiently large block. This can happen legitimately if the scan the low stack bound, which could occur if functions called prior to lkdtm_STACKLEAK_ERASING() used a large amount of stack. If this were to occur, it means that the erased portion of the stack is smaller than the size used by the scan, but does not cause a functional problem In practice this is unlikely to happen, but as this is legitimate and would not result in a functional problem, the test should not fail in this case. Remove the spurious failure case. 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: Kees Cook <keescook@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20220427173128.2603085-9-mark.rutland@arm.com
1 parent 77cf2b6 commit 4130a61

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

drivers/misc/lkdtm/stackleak.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ void lkdtm_STACKLEAK_ERASING(void)
5353
found = 0;
5454
}
5555

56-
if (found <= check_depth) {
57-
pr_err("FAIL: the erased part is not found (checked %lu bytes)\n",
58-
i * sizeof(unsigned long));
59-
test_failed = true;
60-
goto end;
61-
}
62-
6356
pr_info("the erased part begins after %lu not poisoned bytes\n",
6457
(i - found) * sizeof(unsigned long));
6558

0 commit comments

Comments
 (0)