s390: stack address vs thread_info
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 27 Jun 2016 05:57:21 +0000 (07:57 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 28 Jun 2016 07:33:00 +0000 (09:33 +0200)
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>
arch/s390/include/asm/kprobes.h
arch/s390/kernel/dumpstack.c

index b47ad3b642cc9ad4e5d25f240fcaafdc278bb19e..591e5a5279b05e46395ab949cb9bfb88ce92b6d3 100644 (file)
@@ -43,9 +43,9 @@ typedef u16 kprobe_opcode_t;
 #define MAX_INSN_SIZE          0x0003
 #define MAX_STACK_SIZE         64
 #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
-       (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \
+       (((unsigned long)task_stack_page(current)) + THREAD_SIZE - (ADDR))) \
        ? (MAX_STACK_SIZE) \
-       : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
+       : (((unsigned long)task_stack_page(current)) + THREAD_SIZE - (ADDR)))
 
 #define kretprobe_blacklist_size 0
 
index 69f9908ac44ccc18b04d5946a50364e40d75be91..6693383bc01bc7b78b4a98895a06052ccd8d77ec 100644 (file)
@@ -78,14 +78,10 @@ void dump_trace(dump_trace_func_t func, void *data, struct task_struct *task,
        sp = __dump_trace(func, data, sp,
                          S390_lowcore.async_stack + frame_size - ASYNC_SIZE,
                          S390_lowcore.async_stack + frame_size);
-       if (task)
-               __dump_trace(func, data, sp,
-                            (unsigned long)task_stack_page(task),
-                            (unsigned long)task_stack_page(task) + THREAD_SIZE);
-       else
-               __dump_trace(func, data, sp,
-                            S390_lowcore.thread_info,
-                            S390_lowcore.thread_info + THREAD_SIZE);
+       task = task ?: current;
+       __dump_trace(func, data, sp,
+                    (unsigned long)task_stack_page(task),
+                    (unsigned long)task_stack_page(task) + THREAD_SIZE);
 }
 EXPORT_SYMBOL_GPL(dump_trace);