forked from luck/tmp_suning_uos_patched
stacktrace: Force USER_DS for stack_trace_save_user()
When walking userspace stacks, USER_DS needs to be set, otherwise access_ok() will not function as expected. Reported-by: Vegard Nossum <vegard.nossum@oracle.com> Reported-by: Eiichi Tsukata <devel@etsukata.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Vegard Nossum <vegard.nossum@oracle.com> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Link: https://lkml.kernel.org/r/20190718085754.GM3402@hirez.programming.kicks-ass.net
This commit is contained in:
parent
8e144797f1
commit
cac9b9a4b0
|
@ -226,12 +226,17 @@ unsigned int stack_trace_save_user(unsigned long *store, unsigned int size)
|
|||
.store = store,
|
||||
.size = size,
|
||||
};
|
||||
mm_segment_t fs;
|
||||
|
||||
/* Trace user stack if not a kernel thread */
|
||||
if (current->flags & PF_KTHREAD)
|
||||
return 0;
|
||||
|
||||
fs = get_fs();
|
||||
set_fs(USER_DS);
|
||||
arch_stack_walk_user(consume_entry, &c, task_pt_regs(current));
|
||||
set_fs(fs);
|
||||
|
||||
return c.len;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user