Skip to content

Commit 20c7e29

Browse files
committed
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull stacktrace fix from Thomas Gleixner: "A small fix for a stacktrace regression. Saving a stacktrace for a foreign task skipped an extra entry which makes e.g. the output of /proc/$PID/stack incomplete" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: stacktrace: Don't skip first entry on noncurrent tasks
2 parents 79a6406 + b0c51f1 commit 20c7e29

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/stacktrace.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
141141
struct stacktrace_cookie c = {
142142
.store = store,
143143
.size = size,
144-
.skip = skipnr + 1,
144+
/* skip this function if they are tracing us */
145+
.skip = skipnr + !!(current == tsk),
145146
};
146147

147148
if (!try_get_task_stack(tsk))
@@ -298,7 +299,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *task,
298299
struct stack_trace trace = {
299300
.entries = store,
300301
.max_entries = size,
301-
.skip = skipnr + 1,
302+
/* skip this function if they are tracing us */
303+
.skip = skipnr + !!(current == task),
302304
};
303305

304306
save_stack_trace_tsk(task, &trace);

0 commit comments

Comments
 (0)