lkml.org 
[lkml]   [2019]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC patch 02/41] x86/stacktrace: Remove the pointless ULONG_MAX marker
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>
---
arch/x86/kernel/stacktrace.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -46,9 +46,6 @@ static void noinline __save_stack_trace(
if (!addr || save_stack_address(trace, addr, nosched))
break;
}
-
- if (trace->nr_entries < trace->max_entries)
- trace->entries[trace->nr_entries++] = ULONG_MAX;
}

/*
@@ -97,7 +94,7 @@ static int __always_inline
if (regs) {
/* Success path for user tasks */
if (user_mode(regs))
- goto success;
+ return 0;

/*
* Kernel mode registers on the stack indicate an
@@ -132,10 +129,6 @@ static int __always_inline
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;
}

@@ -221,9 +214,6 @@ void save_stack_trace_user(struct stack_
/*
* 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;
}

\
 
 \ /
  Last update: 2019-04-10 13:06    [W:0.381 / U:3.156 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site