[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-cac9b9a4b08304f11daace03b8b48659355e44c1@git.kernel.org>
Date: Thu, 18 Jul 2019 07:52:04 -0700
From: tip-bot for Peter Zijlstra <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...nel.org, vegard.nossum@...cle.com,
devel@...ukata.com, linux-kernel@...r.kernel.org, hpa@...or.com,
joel@...lfernandes.org, peterz@...radead.org
Subject: [tip:core/urgent] stacktrace: Force USER_DS for
stack_trace_save_user()
Commit-ID: cac9b9a4b08304f11daace03b8b48659355e44c1
Gitweb: https://git.kernel.org/tip/cac9b9a4b08304f11daace03b8b48659355e44c1
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Thu, 18 Jul 2019 10:47:47 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Thu, 18 Jul 2019 16:47:24 +0200
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@...cle.com>
Reported-by: Eiichi Tsukata <devel@...ukata.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Vegard Nossum <vegard.nossum@...cle.com>
Reviewed-by: Joel Fernandes (Google) <joel@...lfernandes.org>
Link: https://lkml.kernel.org/r/20190718085754.GM3402@hirez.programming.kicks-ass.net
---
kernel/stacktrace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
index e6a02b274b73..f5440abb7532 100644
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -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
Powered by blists - more mailing lists