Re: [PATCH v2] sched: unlikely corrupted stack end

From: kbuild test robot
Date: Tue Jun 14 2016 - 05:09:20 EST


Hi,

[auto build test ERROR on tip/sched/core]
[also build test ERROR on v4.7-rc3 next-20160614]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/WANG-Chao/sched-unlikely-corrupted-stack-end/20160614-162711
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64

All error/warnings (new ones prefixed by >>):

warning: (FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && KMEMCHECK && LOCKDEP) selects FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CRIS || M68K || FRV || UML || AVR32 || SUPERH || BLACKFIN || MN10300 || METAG) || ARCH_WANT_FRAME_POINTERS)
warning: (FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && KMEMCHECK && LOCKDEP) selects FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CRIS || M68K || FRV || UML || AVR32 || SUPERH || BLACKFIN || MN10300 || METAG) || ARCH_WANT_FRAME_POINTERS)
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/uapi/linux/capability.h:16,
from include/linux/capability.h:15,
from include/linux/sched.h:15,
from arch/ia64/kernel/asm-offsets.c:9:
include/linux/sched.h: In function 'task_stack_end_corrupted':
>> arch/ia64/include/asm/ptrace.h:37:29: error: 'IA64_TASK_SIZE' undeclared (first use in this function)
#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + IA64_THREAD_INFO_SIZE + 31) & ~31)
^
include/linux/compiler.h:170:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
>> arch/ia64/include/asm/thread_info.h:74:57: note: in expansion of macro 'IA64_RBS_OFFSET'
#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
^
>> include/linux/sched.h:3006:20: note: in expansion of macro 'end_of_stack'
return unlikely(*(end_of_stack(p)) != STACK_END_MAGIC);
^
arch/ia64/include/asm/ptrace.h:37:29: note: each undeclared identifier is reported only once for each function it appears in
#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + IA64_THREAD_INFO_SIZE + 31) & ~31)
^
include/linux/compiler.h:170:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
>> arch/ia64/include/asm/thread_info.h:74:57: note: in expansion of macro 'IA64_RBS_OFFSET'
#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
^
>> include/linux/sched.h:3006:20: note: in expansion of macro 'end_of_stack'
return unlikely(*(end_of_stack(p)) != STACK_END_MAGIC);
^
>> arch/ia64/include/asm/ptrace.h:37:46: error: 'IA64_THREAD_INFO_SIZE' undeclared (first use in this function)
#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + IA64_THREAD_INFO_SIZE + 31) & ~31)
^
include/linux/compiler.h:170:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
>> arch/ia64/include/asm/thread_info.h:74:57: note: in expansion of macro 'IA64_RBS_OFFSET'
#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
^
>> include/linux/sched.h:3006:20: note: in expansion of macro 'end_of_stack'
return unlikely(*(end_of_stack(p)) != STACK_END_MAGIC);
^
make[2]: *** [arch/ia64/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2

vim +/end_of_stack +3006 include/linux/sched.h

2990 * When the stack grows up, this is the highest address.
2991 * Beyond that position, we corrupt data on the next page.
2992 */
2993 static inline unsigned long *end_of_stack(struct task_struct *p)
2994 {
2995 #ifdef CONFIG_STACK_GROWSUP
2996 return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;
2997 #else
2998 return (unsigned long *)(task_thread_info(p) + 1);
2999 #endif
3000 }
3001
3002 #endif
3003
3004 static inline int task_stack_end_corrupted(struct task_struct *p)
3005 {
> 3006 return unlikely(*(end_of_stack(p)) != STACK_END_MAGIC);
3007 }
3008
3009 static inline int object_is_on_stack(void *obj)
3010 {
3011 void *stack = task_stack_page(current);
3012
3013 return (obj >= stack) && (obj < (stack + THREAD_SIZE));
3014 }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data