Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lkdtm/stackleak: Fix noinstr violation

Fixes the following warning:

vmlinux.o: warning: objtool: check_stackleak_irqoff+0x2b6: call to _printk() leaves .noinstr.text section

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/ee5209f53aa0a62aea58be18f2b78b17606779a6.1681320026.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Peter Zijlstra
f571da05 e0b081d1

+6
+6
drivers/misc/lkdtm/stackleak.c
··· 43 43 * STACK_END_MAGIC, and in either casee something is seriously wrong. 44 44 */ 45 45 if (current_sp < task_stack_low || current_sp >= task_stack_high) { 46 + instrumentation_begin(); 46 47 pr_err("FAIL: current_stack_pointer (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n", 47 48 current_sp, task_stack_low, task_stack_high - 1); 48 49 test_failed = true; 49 50 goto out; 50 51 } 51 52 if (lowest_sp < task_stack_low || lowest_sp >= task_stack_high) { 53 + instrumentation_begin(); 52 54 pr_err("FAIL: current->lowest_stack (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n", 53 55 lowest_sp, task_stack_low, task_stack_high - 1); 54 56 test_failed = true; ··· 88 86 if (*(unsigned long *)poison_low == STACKLEAK_POISON) 89 87 continue; 90 88 89 + instrumentation_begin(); 91 90 pr_err("FAIL: non-poison value %lu bytes below poison boundary: 0x%lx\n", 92 91 poison_high - poison_low, *(unsigned long *)poison_low); 93 92 test_failed = true; 93 + goto out; 94 94 } 95 95 96 + instrumentation_begin(); 96 97 pr_info("stackleak stack usage:\n" 97 98 " high offset: %lu bytes\n" 98 99 " current: %lu bytes\n" ··· 118 113 } else { 119 114 pr_info("OK: the rest of the thread stack is properly erased\n"); 120 115 } 116 + instrumentation_end(); 121 117 } 122 118 123 119 static void lkdtm_STACKLEAK_ERASING(void)