Skip to content

Commit

Permalink
x86/stacktrace: Remove the pointless ULONG_MAX marker
Browse files Browse the repository at this point in the history
Terminating the last trace entry with ULONG_MAX is a completely pointless
exercise and none of the consumers can rely on it because it's
inconsistently implemented across architectures. In fact quite some of the
callers remove the entry and adjust stack_trace.nr_entries afterwards.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Alexander Potapenko <glider@google.com>
Link: https://lkml.kernel.org/r/20190410103643.750954603@linutronix.de
  • Loading branch information
KAGA-KOKO committed Apr 14, 2019
1 parent fdc7833 commit c5c27a0
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions arch/x86/kernel/stacktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ static void noinline __save_stack_trace(struct stack_trace *trace,
if (!addr || save_stack_address(trace, addr, nosched))
break;
}

if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX;
}

/*
Expand Down Expand Up @@ -97,7 +94,7 @@ __save_stack_trace_reliable(struct stack_trace *trace,
if (regs) {
/* Success path for user tasks */
if (user_mode(regs))
goto success;
return 0;

/*
* Kernel mode registers on the stack indicate an
Expand Down Expand Up @@ -132,10 +129,6 @@ __save_stack_trace_reliable(struct stack_trace *trace,
if (!(task->flags & (PF_KTHREAD | PF_IDLE)))
return -EINVAL;

success:
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX;

return 0;
}

Expand Down Expand Up @@ -221,9 +214,6 @@ void save_stack_trace_user(struct stack_trace *trace)
/*
* Trace user stack if we are not a kernel thread
*/
if (current->mm) {
if (current->mm)
__save_stack_trace_user(trace);
}
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX;
}

0 comments on commit c5c27a0

Please sign in to comment.