mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
perf: Have get_perf_callchain() return NULL if crosstask and user are set
[ Upstream commit 153f9e74dec230f2e070e16fa061bc7adfd2c450 ] get_perf_callchain() doesn't support cross-task unwinding for user space stacks, have it return NULL if both the crosstask and user arguments are set. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250820180428.426423415@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
34b5aba851
commit
89fbfc799e
@@ -184,6 +184,10 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
|
||||
struct perf_callchain_entry_ctx ctx;
|
||||
int rctx;
|
||||
|
||||
/* crosstask is not supported for user stacks */
|
||||
if (crosstask && user && !kernel)
|
||||
return NULL;
|
||||
|
||||
entry = get_callchain_entry(&rctx);
|
||||
if (!entry)
|
||||
return NULL;
|
||||
@@ -200,7 +204,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
|
||||
perf_callchain_kernel(&ctx, regs);
|
||||
}
|
||||
|
||||
if (user) {
|
||||
if (user && !crosstask) {
|
||||
if (!user_mode(regs)) {
|
||||
if (current->flags & (PF_KTHREAD | PF_USER_WORKER))
|
||||
regs = NULL;
|
||||
@@ -209,9 +213,6 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
|
||||
}
|
||||
|
||||
if (regs) {
|
||||
if (crosstask)
|
||||
goto exit_put;
|
||||
|
||||
if (add_mark)
|
||||
perf_callchain_store_context(&ctx, PERF_CONTEXT_USER);
|
||||
|
||||
@@ -219,7 +220,6 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
|
||||
}
|
||||
}
|
||||
|
||||
exit_put:
|
||||
put_callchain_entry(rctx);
|
||||
|
||||
return entry;
|
||||
|
||||
Reference in New Issue
Block a user