lkml.org 
[lkml]   [2017]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH v2] stackdepot: ignore junk last entry in case of switch from user mode.
From
Date
Hi Dmitry,

>diff --git a/lib/stackdepot.c b/lib/stackdepot.c
>index f87d138..a045748 100644
>--- a/lib/stackdepot.c
>+++ b/lib/stackdepot.c
>@@ -214,6 +214,13 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace,
> if (unlikely(trace->nr_entries == 0))
> goto fast_exit;
>
>+ /*
>+ * Ignore last entry if it belongs to user space
>+ * in case of switch from user mode.
>+ */
>+ if (!kernel_text_address(trace->entries[trace->nr_entries - 1]))

can we also add this check here:-
if (!kernel_text_address(trace->entries[trace->nr_entries - 1]) || in_interrupt())

Because on further checking , last frame in case of svc to interrupt mode is some random core kernel / Kernel Module address
like below:-

irq_exit+0xe4/0x140
__handle_domain_irq+0x9c/0x130
gic_handle_irq+0x40/0x80
__irq_svc+0x44/0x7c
hdmi_ocm_rx_get_scdc_sts+0x160/0x170 [sdp_hdmi] >> we need this frme??

This generates mismatch with existing entires and new entries get created and depot_index
value keep on increasing slowly and reaches max value (STACK_ALLOC_SLABS_CAP) but after this change
depot_index gets a stable value after some time. (Tested on ARM)

>+ trace->nr_entries--;
>+
> hash = hash_stack(trace->entries, trace->nr_entries);
> bucket = &stack_table[hash & STACK_HASH_MASK];
>
>--
>1.9.1

Regards,
Vaneet Narang

\
 
 \ /
  Last update: 2017-10-12 13:55    [W:1.783 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site