[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190718085754.GM3402@hirez.programming.kicks-ass.net>
Date: Thu, 18 Jul 2019 10:57:54 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Vegard Nossum <vegard.nossum@...cle.com>
Cc: tglx@...utronix.de, bp@...en8.de, mingo@...nel.org,
rostedt@...dmis.org, luto@...nel.org,
torvalds@...ux-foundation.org, hpa@...or.com,
dave.hansen@...ux.intel.com, jgross@...e.com,
linux-kernel@...r.kernel.org, zhe.he@...driver.com,
joel@...lfernandes.org, devel@...ukata.com
Subject: [PATCH] stacktrace: Force USER_DS for stack_trace_save_user()
On Wed, Jul 17, 2019 at 10:09:45AM +0200, Vegard Nossum wrote:
> On 7/17/19 10:07 AM, Peter Zijlstra wrote:
> > Does something like the below help?
> Yes.
Thanks!
---
Subject: stacktrace: Force USER_DS for stack_trace_save_user()
From: Peter Zijlstra <peterz@...radead.org>
Date: Thu Jul 18 10:47:47 CEST 2019
When walking userspace stacks, we should set USER_DS, otherwise
access_ok() will not function as expected.
Reported-by: Vegard Nossum <vegard.nossum@...cle.com>
Tested-by: Vegard Nossum <vegard.nossum@...cle.com>
Reported-by: Eiichi Tsukata <devel@...ukata.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -226,12 +226,17 @@ unsigned int stack_trace_save_user(unsig
.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