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

s390: stack address vs thread_info

Avoid using the address of a process' thread_info structure as the
kernel stack address. This will break as soon as the thread_info
structure will be removed from the stack, and in addition it makes the
code a bit more understandable.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
c3bdf2e1 43799597

+6 -10
+2 -2
arch/s390/include/asm/kprobes.h
··· 43 43 #define MAX_INSN_SIZE 0x0003 44 44 #define MAX_STACK_SIZE 64 45 45 #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ 46 - (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ 46 + (((unsigned long)task_stack_page(current)) + THREAD_SIZE - (ADDR))) \ 47 47 ? (MAX_STACK_SIZE) \ 48 - : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 48 + : (((unsigned long)task_stack_page(current)) + THREAD_SIZE - (ADDR))) 49 49 50 50 #define kretprobe_blacklist_size 0 51 51
+4 -8
arch/s390/kernel/dumpstack.c
··· 78 78 sp = __dump_trace(func, data, sp, 79 79 S390_lowcore.async_stack + frame_size - ASYNC_SIZE, 80 80 S390_lowcore.async_stack + frame_size); 81 - if (task) 82 - __dump_trace(func, data, sp, 83 - (unsigned long)task_stack_page(task), 84 - (unsigned long)task_stack_page(task) + THREAD_SIZE); 85 - else 86 - __dump_trace(func, data, sp, 87 - S390_lowcore.thread_info, 88 - S390_lowcore.thread_info + THREAD_SIZE); 81 + task = task ?: current; 82 + __dump_trace(func, data, sp, 83 + (unsigned long)task_stack_page(task), 84 + (unsigned long)task_stack_page(task) + THREAD_SIZE); 89 85 } 90 86 EXPORT_SYMBOL_GPL(dump_trace); 91 87