Messages in this thread | | | Date | Wed, 27 Apr 2022 11:25:14 +0800 | From | kernel test robot <> | Subject | [mark:stackleak/rework 9/9] drivers/misc/lkdtm/stackleak.c:30:34: error: call to undeclared function 'stackleak_task_high_bound'; ISO C99 and later do not support implicit function declarations |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git stackleak/rework head: 7d99ba3a2a80dcf7265eafacebceaa798f5ca231 commit: 7d99ba3a2a80dcf7265eafacebceaa798f5ca231 [9/9] WIP: stackleak: rework the LKDTM stackleak test config: hexagon-randconfig-r025-20220425 (https://download.01.org/0day-ci/archive/20220427/202204271126.59JDH9bK-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id=7d99ba3a2a80dcf7265eafacebceaa798f5ca231 git remote add mark https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git git fetch --no-tags mark stackleak/rework git checkout 7d99ba3a2a80dcf7265eafacebceaa798f5ca231 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/misc/lkdtm/
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/misc/lkdtm/stackleak.c:30:34: error: call to undeclared function 'stackleak_task_high_bound'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] const unsigned long task_high = stackleak_task_high_bound(current); ^ >> drivers/misc/lkdtm/stackleak.c:31:33: error: call to undeclared function 'stackleak_task_low_bound'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] const unsigned long task_low = stackleak_task_low_bound(current); ^ >> drivers/misc/lkdtm/stackleak.c:32:37: error: no member named 'lowest_stack' in 'struct task_struct' unsigned long lowest_sp = current->lowest_stack; ~~~~~~~ ^ >> drivers/misc/lkdtm/stackleak.c:33:29: error: use of undeclared identifier 'current_stack_pointer' unsigned long current_sp = current_stack_pointer; ^ 4 errors generated.
vim +/stackleak_task_high_bound +30 drivers/misc/lkdtm/stackleak.c
13 14 /* 15 * Check that stackleak tracks the lowest stack pointer and erases the stack 16 * below this as expected. 17 * 18 * Returns true if tests pass, false otherwise. 19 * 20 * To prevent the lowest stack pointer changing during the test, IRQs are 21 * masked and instrumentation of this function is disabled. We assume that the 22 * compiler will create a fixed-size stack frame for this function. 23 * 24 * We cannot call any non-inlined functions during the test as these may alter 25 * the lowest stack pointer and the poisoned region. As soon as we log an error 26 * the test must be aborted as the printing code will use the stack. 27 */ 28 static noinstr bool check_stackleak_irqoff(void) 29 { > 30 const unsigned long task_high = stackleak_task_high_bound(current); > 31 const unsigned long task_low = stackleak_task_low_bound(current); > 32 unsigned long lowest_sp = current->lowest_stack; > 33 unsigned long current_sp = current_stack_pointer; 34 unsigned long check_high, check_low, check_ptr; 35 unsigned long untracked_low; 36 unsigned long found = 0; 37 const unsigned long check_depth = 38 STACKLEAK_SEARCH_DEPTH / sizeof(unsigned long); 39 40 /* 41 * Check that the current and lowest recorded stack pointers are within 42 * expected bounds. 43 */ 44 if (current_sp < task_low || current_sp >= task_high) { 45 pr_err("FAIL: current_stack_pointer (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n", 46 current_sp, task_low, task_high - 1); 47 return false; 48 } 49 if (lowest_sp < task_low || lowest_sp >= task_high) { 50 pr_err("FAIL: current->lowest_stack (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n", 51 lowest_sp, task_low, task_high - 1); 52 return false; 53 } 54 55 /* 56 * Poison values are naturally-aligned unsigned long, and any poison 57 * will be below the used portion of the stack, so align down to find 58 * the address immediately above the first possible poison value. 59 */ 60 current_sp = ALIGN_DOWN(current_sp, sizeof(unsigned long)); 61 lowest_sp = ALIGN_DOWN(current_sp, sizeof(unsigned long)); 62 63 /* 64 * This function is not instrumented. If its stack frame starts more 65 * than STACKLEAK_SEARCH_DEPTH below the lowest recorded stack pointer 66 * (after alignment), erasing will not function correctly. 67 */ 68 if (current_sp < lowest_sp - STACKLEAK_SEARCH_DEPTH) { 69 pr_err("FAIL: stack pointer (0x%lx) is %ld bytes below current->lowest_stack (0x%lx)\n", 70 current_sp, lowest_sp - current_sp, lowest_sp); 71 return false; 72 } 73 74 /* 75 * Depending on what has run prior to this function (including any 76 * interrupts handled on the task stack), it's possible that: 77 * 78 * a) current_stack_pointer < current->lowest_stack 79 * 80 * b) current_stack_pointer == current->lowest_stack 81 * 82 * c) current_stack_pointer > current->lowest_stack 83 * 84 * For the high boundary we must start checking immediately below the 85 * lowest of the two. 86 * 87 * For the low boundary we start immediately above the STACK_END_MAGIC. 88 */ 89 check_high = min(current_sp, lowest_sp); 90 check_low = task_low; 91 92 check_ptr = check_high - sizeof(unsigned long); 93 94 if (check_ptr <= check_low) { 95 pr_err("FAIL: not enough stack space for the test\n"); 96 return false; 97 } 98 99 /* 100 * Search for 'check_depth' poison values in a row as stackleak_erase() 101 * does. 102 */ 103 while (check_ptr > check_low && found <= check_depth) { 104 if (*(unsigned long *)check_ptr == STACKLEAK_POISON) 105 found++; 106 else 107 found = 0; 108 109 check_ptr -= sizeof(unsigned long); 110 } 111 112 /* 113 * Either we found 'check_depth' poison values in a row, or we hit the 114 * low check boundary. Either way, 'check_ptr' is just below the last 115 * poison we checked. 116 */ 117 untracked_low = check_ptr + sizeof(unsigned long) * found; 118 119 /* 120 * Check for any remaining unpoisoned stack. 121 */ 122 while (check_ptr > check_low) { 123 unsigned long val = *(unsigned long *)check_ptr; 124 125 if (val != STACKLEAK_POISON) { 126 pr_err("FAIL: non-poison value 0x%lx %lu bytes into poison region\n", 127 val, untracked_low - check_ptr); 128 return false; 129 } 130 131 check_ptr -= sizeof(unsigned long); 132 } 133 134 pr_info("tracked: %lu bytes, untracked: %lu bytes, poisoned: %lu bytes\n", 135 task_high - check_high, 136 check_high - untracked_low, 137 untracked_low - task_low); 138 139 return true; 140 } 141
-- 0-DAY CI Kernel Test Service https://01.org/lkp
| |